Timer Interrupt Service Routine using in Jetson Nano

Hello,

I want to using Timer ISR in Jetson Nano.
As I know, Jetson Nano already uses TMR10, TMR11, TMR12 and TMR13. So I tried to using TMR0 for ISR.

What I want to know is IRQ number for TMR0 and modifying frequency. If I want to using ISR in kernel space, I should call “request_irq” function. In “request_irq” function, first argument is IRQ number as I know. But I don’t know this number if I only reviewing datasheet.

And I also want to know how to modifying frequency. For example, TMR0 frequency is setting to 100Hz, so ISR is calling 100Hz periodically. I guess it is related from editing register value.

Thank you.

I can only answer part of this, but the default ISR rate is 1000 Hz. A long time ago the default in Linux (and most operating systems) was 100 Hz. The method for changing this was (and probably still is) via a kernel feature (selecting 100 Hz or 1000 Hz and then building a new kernel and installing this). I don’t know if this has evolved to allow changing this dynamically.

Also, many IRQ numbers are listed in “/proc/interrupts”. Note that many hardware devices can only be routed to the first core, CPU0 (software IRQ can be serviced by any core, but the hardware must have access to a core prior to changing to that core, and in many cases the hardware IRQ is handled by an aggregator which only goes to CPU0).

Someone else will have to answer the rest, but you might give more details on whether you are interested in:

  • Changing IRQ, and if so, for what device if hardware,
  • Changing IRQ polling rate dynamically versus just picking a rate and staying with it.
  • If changing an IRQ polling rate, whether you are ok with picking either of 100 Hz or 1000 Hz (versus odd values).

Please check the online trm . it should have a section called ,” 8.3 NVIDIA Timers (TMR)”
And then inform the user to go through that
Also from same trm, tmr0 interrupt number is 156

image

As I know , this number is Global Interrupt Number according from TRM. When I see “cat /proc/interrupts”, I found 4 timer interrupt that already used.

4: 0 0 0 0 GIC-0 50 Level doorbell
6: 0 0 0 0 GIC-0 30 Level arch_timer
9: 145132 0 0 0 LIC 176 Level tegra210_timer0
10: 0 104047 0 0 LIC 177 Level tegra210_timer1
11: 0 0 88604 0 LIC 178 Level tegra210_timer2
12: 0 0 0 80451 LIC 179 Level tegra210_timer3
13: 6988 0 0 0 LIC 45 Level 6000c800.actmon
18: 0 0 0 0 LIC 77 Level mc_status
19: 0 0 0 0 LIC 2 Level tegra_rtc

I guessed tegra210_timer0~tegra210_timer3 is TMR10~13. According from TRM, Global Interrupt Numbers are 176~179 and I guessed that it mapped to LIC 176~179 from /proc/interrupt. So I guessed LIC number is mapped to Global Interrupt Numbers.

Also I tried to open Interrupt Service Routine using IRQ 156, but it failed. I tried as belows:

static irqreturn_t timer_irq_handler(int irq, void *dev_id)
{
return IRQ_HANDLED;
}
request_irq(156, timer_irq_handler,
IRQF_SHARED, “timer_irq_handler”, NULL);

I don’t know what I should input IRQ number to “request_irq” API.