How to use Timer Interrupt

Posts: 10
Joined: Thu Mar 22, 2018 2:46 pm

How to use Timer Interrupt

Tue Apr 10, 2018 2:06 pm

Dear all,

I need a configurable timer for VoCore IoT device, e.g. with 10 ms to debounce buttons or with 100 ms to blink an LED. According to MT7628 datasheet, there are 2 hardware timer available: timer0 and timer1. I did some testings with timer0 and I was able to configure and start it (by using registers T0CTL_REG, T0LMT_REG and T0_REG).

1. Why are IRQ INTC-24 (timer0) and INTC-25 (timer1) not showing up in /proc/interrupts?
2. How can I use the interrupts from my application, which is written in ANSI C and running in user space?

About question 2: I guess I have to write a kernel module, right? If so, does anybody know or have some examples or tutorials, how to write and compile those modules for VoCore / OpenWrt? This because I have no experience with kernel modules and I guess at some point I won't be able to avoid them anymore in my VoCore project.

Many thanks and regards,

Code: Select all
> cat /proc/interrupts
  5:       6212      MIPS   5  10100000.ethernet
  6:     406049      MIPS   6  ra0
  7:    1730803      MIPS   7  timer
 15:          0      INTC   7  10002800.gdma
 25:          1      INTC  17  esw
 26:          1      INTC  18  ehci_hcd:usb1, ohci_hcd:usb2
 30:       1049      INTC  22  serial
ERR:          0

Posts: 10
Joined: Thu Mar 22, 2018 2:46 pm

Re: How to use Timer Interrupt

Wed Apr 11, 2018 2:08 pm

btw: This is the test script I've been using to test timer0:

Code: Select all

echo "Init timer0: PSC = 1000, T0EN/T0AL = 1, Limit = 10'000 -> Clock = 1 ms, Period = 10 s"
mem 0x10000110 0x03E80090
mem 0x10000114 0x00002710

sleep 1
echo "Timer is not showing up in interrupts... Why??"
cat /proc/interrupts

while true; do

echo "Timer counter: "
mem 0x10000118
sleep 1


Posts: 721
Joined: Sun Oct 19, 2014 6:00 am

Re: How to use Timer Interrupt

Tue Apr 17, 2018 2:42 am

I am afraid they are already taken by Linux kernel, you have to use linux kernel api.

Return to VoCore2/Lite/Ultimate

Who is online

Users browsing this forum: No registered users and 1 guest