How to handle interrupts using the sdk

I’m pretty new to programming and I need to use one of the timers on the Duo. The timer throws an interrupt but I don’t know how to handle the interrupt in my C code. The spec sheet says the interrupt for timer1 is 80. From what I’ve read, the way to handle interrupts depends on the SDK and the hardware. I don’t know where to look for a duo specific answer.

Is this on the big core (Linux) or the little core (FreeRTOS)?

I’m using the big core with Linux. I haven’t dove into RTOS yet.

I would think that getting timer code to work on the Duo would be the same as any larger Linux machine. Have you tried any examples online on any Linux machine (e.g. Duo, VM, PC)?

Thanks. This pointed me in a better direction.

There are lots of different options you can take. Please share your progress here.

I decied to use PWM for my project after I got lost in timers.

I’d be very curious to know how to use interrupts in FreeRTOS. It looks like the SDK currently has no routines for that.

POSIX signal, sigaction, sigevent and timer_t (interval timer) work well on the big core. It’s a bit of a learning curve digesting signal handling, but not bad. There are also several RTOS examples around on the net that can be adapted. I’m currently making friends with the interval timer on the big-core, but works just like on any other Linux box, even though it is just busybox running on the duo.

I’ll post a link once a get an implementation I’m happy with worked out. Until then simply searching “POSIX interval timer” will get you a number of examples you can adapt.

1 Like