Hi everyone,
I'm always trying to configure the timer for my Zedboard and the system clock doesn't advance. I checked this in the Timer::system_clock() function
In order to construct my timer driver, I use mptimer option, so I configured the private timer of my board in the file timer-arm-mptimer.cpp. Private Timers call the function interval() which use the global timer of the board (bsp/zynq/ timer-arm-mptimer-zynq.cpp file) Here is a part of the implementation of my global timer (I just launch counter) :
Mmio_register_block t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
t.write<Mword>(0, GPT_CR);
t.write<Mword>(0, GPT_CNT0);
t.write<Mword>(0, GPT_CNT1);
t.modify<Mword>(GPT_CR_EN, 0, GPT_CR);
Mword vc = start_as_counter();
while (t.read<Mword>(GPT_CNT0) < Gpt_ticks)
;
Mword interval = (vc - stop_counter()) / Ticks;
t.write<Mword>(0, GPT_CR);
return interval;
The private timers are bind to the GIC with the IRQ 27, so I mentioned this value in the static unsigned irq() function.
GIC is initialized in the bsp/zynq/pic-arm-zynq.cpp file (similar to the iMX6 architecture)
Pic::init()
{
typedef Irq_mgr_multi_chip<Gic_sz> M;
M *m = new Boot_object<M>(1);
gic.construct(Kmem::mmio_remap(Mem_layout::Gic_cpu_phys_base),
Kmem::mmio_remap(Mem_layout::Gic_dist_phys_base));
m->add_chip(0, gic, gic->nr_irqs());
Irq_mgr::mgr = m;
}
To finish I saw timer_tick class. It seems to be a good way to update system clock because there are interrupts handler which call the update_system_clock function. So I added a call to the Timer_tick::setup() function in my startup-arm.cpp file after timer initialization. But when I boot the sytem I obtain the following message
Panic - Could not allocate scheduling IRQ 27
The origin of this problem is the allocate_irq() function
So do I have to modify something in my IRQ manager or did I forget one step during the construction of my timer driver ? Thanks in advance
Best regards,
Xavier Le Bars
On Wed Jul 16, 2014 at 15:10:29 +0200, Xavier LEBARS wrote:
I'm always trying to configure the timer for my Zedboard and the system clock doesn't advance. I checked this in the Timer::system_clock() function
In order to construct my timer driver, I use mptimer option, so I configured the private timer of my board in the file timer-arm-mptimer.cpp. Private Timers call the function interval() which use the global timer of the board (bsp/zynq/ timer-arm-mptimer-zynq.cpp file) Here is a part of the implementation of my global timer (I just launch counter) :
Mmio_register_block t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
t.write<Mword>(0, GPT_CR);
t.write<Mword>(0, GPT_CNT0);
t.write<Mword>(0, GPT_CNT1);
t.modify<Mword>(GPT_CR_EN, 0, GPT_CR);
Mword vc = start_as_counter();
while (t.read<Mword>(GPT_CNT0) < Gpt_ticks)
;
Mword interval = (vc - stop_counter()) / Ticks;
t.write<Mword>(0, GPT_CR);
return interval;
Is this calculating a proper interval value? For a start you can also just return a fixed value.
The private timers are bind to the GIC with the IRQ 27, so I mentioned this value in the static unsigned irq() function.
Why 27 and not 29?
GIC is initialized in the bsp/zynq/pic-arm-zynq.cpp file (similar to the iMX6 architecture)
Pic::init() { typedef Irq_mgr_multi_chip<Gic_sz> M; M *m = new Boot_object<M>(1); gic.construct(Kmem::mmio_remap(Mem_layout::Gic_cpu_phys_base), Kmem::mmio_remap(Mem_layout::Gic_dist_phys_base)); m->add_chip(0, gic, gic->nr_irqs()); Irq_mgr::mgr = m; }
This looks fine.
To finish I saw timer_tick class. It seems to be a good way to update system clock because there are interrupts handler which call the update_system_clock function. So I added a call to the Timer_tick::setup() function in my startup-arm.cpp file after timer initialization. But when I boot the sytem I obtain the following message
I do not think you need to add anything there.
Panic - Could not allocate scheduling IRQ 27
The origin of this problem is the allocate_irq() function
So do I have to modify something in my IRQ manager or did I forget one step during the construction of my timer driver ? Thanks in advance
For the mptimer it should just work given a proper interval() value. So does the mptimer tick, i.e. reading the counter register multiple times gives a changing value everytime? Regarding the interrupt number, timer-arm-mptimer.cpp already has it defined.
Adam
Hi,
Thanks for your answer,
-----Message d'origine----- De : l4-hackers [mailto:l4-hackers-bounces@os.inf.tu-dresden.de] De la part de Adam Lackorzynski Envoyé : jeudi 17 juillet 2014 23:21 À : l4-hackers@os.inf.tu-dresden.de Objet : Re: Timer Interrupt Handler Importance : Haute
On Wed Jul 16, 2014 at 15:10:29 +0200, Xavier LEBARS wrote:
I'm always trying to configure the timer for my Zedboard and the system clock doesn't advance. I checked this in the Timer::system_clock() function
In order to construct my timer driver, I use mptimer option, so I configured the private timer of my board in the file timer-arm-mptimer.cpp. Private Timers call the function interval() which use the global timer of the board (bsp/zynq/ timer-arm-mptimer-zynq.cpp file) Here is a part of the implementation of my global timer (I just launch counter) : Mmio_register_block
t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
t.write<Mword>(0, GPT_CR);
t.write<Mword>(0, GPT_CNT0);
t.write<Mword>(0, GPT_CNT1); t.modify<Mword>(GPT_CR_EN, 0, GPT_CR); Mword vc = start_as_counter();
while (t.read<Mword>(GPT_CNT0) < Gpt_ticks) ; Mword interval = (vc - stop_counter()) / Ticks;
t.write<Mword>(0, GPT_CR);
return interval;
Is this calculating a proper interval value? For a start you can also just return a fixed value.
With this configuration : Timer_freq = 32768, Ticks = 50,
I obtain the following interval value : 85899345
When I try to use a fixed value like in Tegra configuration (249 999 or 499 999), I see no effects.
The private timers are bind to the GIC with the IRQ 27, so I mentioned this value in the static unsigned irq() function.
Why 27 and not 29?
A mistake between Global Timer Interrupts ID 27 and private timer interrupts ID 29
GIC is initialized in the bsp/zynq/pic-arm-zynq.cpp file (similar to the iMX6 architecture)
Pic::init() { typedef Irq_mgr_multi_chip<Gic_sz> M; M *m = new Boot_object<M>(1); gic.construct(Kmem::mmio_remap(Mem_layout::Gic_cpu_phys_base), Kmem::mmio_remap(Mem_layout::Gic_dist_phys_base)); m->add_chip(0, gic, gic->nr_irqs()); Irq_mgr::mgr = m; }
This looks fine.
To finish I saw timer_tick class. It seems to be a good way to update system clock because there are interrupts handler which call the update_system_clock function. So I added a call to the Timer_tick::setup() function in my startup-arm.cpp file after timer initialization. But when I boot the sytem I obtain the following message
I do not think you need to add anything there.
Ok
Panic - Could not allocate scheduling IRQ 27
The origin of this problem is the allocate_irq() function
So do I have to modify something in my IRQ manager or did I forget one step during the construction of my timer driver ? Thanks in advance
For the mptimer it should just work given a proper interval() value. So does the mptimer tick, i.e. reading the counter register multiple times gives a changing value everytime? Regarding the interrupt number, timer- arm-mptimer.cpp already has it defined.
The counter register value change correctly
Xavier Le Bars
On Fri Jul 18, 2014 at 11:27:16 +0200, Xavier LEBARS wrote:
-----Message d'origine----- De : l4-hackers [mailto:l4-hackers-bounces@os.inf.tu-dresden.de] De la part de Adam Lackorzynski Envoyé : jeudi 17 juillet 2014 23:21 À : l4-hackers@os.inf.tu-dresden.de Objet : Re: Timer Interrupt Handler Importance : Haute
On Wed Jul 16, 2014 at 15:10:29 +0200, Xavier LEBARS wrote:
I'm always trying to configure the timer for my Zedboard and the system clock doesn't advance. I checked this in the Timer::system_clock() function
In order to construct my timer driver, I use mptimer option, so I configured the private timer of my board in the file timer-arm-mptimer.cpp. Private Timers call the function interval() which use the global timer of the board (bsp/zynq/ timer-arm-mptimer-zynq.cpp file) Here is a part of the implementation of my global timer (I just launch counter) : Mmio_register_block
t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
t.write<Mword>(0, GPT_CR);
t.write<Mword>(0, GPT_CNT0);
t.write<Mword>(0, GPT_CNT1); t.modify<Mword>(GPT_CR_EN, 0, GPT_CR); Mword vc = start_as_counter();
while (t.read<Mword>(GPT_CNT0) < Gpt_ticks) ; Mword interval = (vc - stop_counter()) / Ticks;
t.write<Mword>(0, GPT_CR);
return interval;
Is this calculating a proper interval value? For a start you can also just return a fixed value.
With this configuration : Timer_freq = 32768, Ticks = 50,
I obtain the following interval value : 85899345
That's far too large.
When I try to use a fixed value like in Tegra configuration (249 999 or 499 999), I see no effects.
Values must be in this range given the frequency the system uses.
The private timers are bind to the GIC with the IRQ 27, so I mentioned this value in the static unsigned irq() function.
Why 27 and not 29?
A mistake between Global Timer Interrupts ID 27 and private timer interrupts ID 29
Ok.
Panic - Could not allocate scheduling IRQ 27
The origin of this problem is the allocate_irq() function
So do I have to modify something in my IRQ manager or did I forget one step during the construction of my timer driver ? Thanks in advance
For the mptimer it should just work given a proper interval() value. So does the mptimer tick, i.e. reading the counter register multiple times gives a changing value everytime? Regarding the interrupt number, timer- arm-mptimer.cpp already has it defined.
The counter register value change correctly
It also wraps around? So there's no IRQ29. Does the UART IRQ work, i.e. entering JDB via ESC works (saying 'IRQ ENTRY')?
Adam
-----Message d'origine----- De : l4-hackers [mailto:l4-hackers-bounces@os.inf.tu-dresden.de] De la part de Adam Lackorzynski Envoyé : dimanche 20 juillet 2014 23:15 À : l4-hackers@os.inf.tu-dresden.de Objet : Re: Timer Interrupt Handler
On Fri Jul 18, 2014 at 11:27:16 +0200, Xavier LEBARS wrote:
-----Message d'origine----- De : l4-hackers [mailto:l4-hackers-bounces@os.inf.tu-dresden.de] De la part de Adam Lackorzynski Envoyé : jeudi 17 juillet 2014 23:21 À : l4-hackers@os.inf.tu-dresden.de Objet : Re: Timer Interrupt Handler Importance : Haute
On Wed Jul 16, 2014 at 15:10:29 +0200, Xavier LEBARS wrote:
I'm always trying to configure the timer for my Zedboard and the system clock doesn't advance. I checked this in the Timer::system_clock() function
In order to construct my timer driver, I use mptimer option, so I configured the private timer of my board in the file timer-arm-mptimer.cpp. Private Timers call the function interval() which use the global timer of the board (bsp/zynq/ timer-arm-mptimer-zynq.cpp file) Here is a part of the implementation of my global timer (I just launch counter) : Mmio_register_block
t(Kmem::mmio_remap(Mem_layout::Gpt_phys_base));
t.write<Mword>(0, GPT_CR);
t.write<Mword>(0, GPT_CNT0);
t.write<Mword>(0, GPT_CNT1); t.modify<Mword>(GPT_CR_EN, 0, GPT_CR); Mword vc = start_as_counter();
while (t.read<Mword>(GPT_CNT0) < Gpt_ticks) ; Mword interval = (vc - stop_counter()) / Ticks;
t.write<Mword>(0, GPT_CR);
return interval;
Is this calculating a proper interval value? For a start you can also just return a fixed value.
With this configuration : Timer_freq = 32768, Ticks = 50,
I obtain the following interval value : 85899345
That's far too large.
When I try to use a fixed value like in Tegra configuration (249 999 or 499 999), I see no effects.
Values must be in this range given the frequency the system uses.
The private timers are bind to the GIC with the IRQ 27, so I mentioned this value in the static unsigned irq() function.
Why 27 and not 29?
A mistake between Global Timer Interrupts ID 27 and private timer interrupts ID 29
Ok.
Panic - Could not allocate scheduling IRQ 27
The origin of this problem is the allocate_irq() function
So do I have to modify something in my IRQ manager or did I forget one step during the construction of my timer driver ? Thanks in advance
For the mptimer it should just work given a proper interval() value. So does the mptimer tick, i.e. reading the counter register multiple times gives a changing value everytime? Regarding the interrupt number, timer- arm-mptimer.cpp already has it defined.
The counter register value change correctly
It also wraps around? So there's no IRQ29. Does the UART IRQ work, i.e. entering JDB via ESC works (saying 'IRQ ENTRY')?
Sorry, I didn't understand the question about wrapping. The UART IRQ doesn't work, I can't use JDB on this board
Xavier
l4-hackers@os.inf.tu-dresden.de