Timer Interrupt in Arduino Due in assembly level

Since no standard library exists for timers of Arduino Due, I would like to implement timers in my code in assembly level language. But the datasheet is so long, and I hardly can understand a thing. Please help me with this.

I have to generate an internal interrupt at every 50 microseconds, which will then trigger some analogRead functions. I have a fair idea of how to proceed after getting analogRead values, but how do I generate such an internal interrupt in assembly level language?

Thanks :slight_smile:

Hardly anyone programs ARMs in assembly language...

That's true, sadly :frowning:

Why do you want to program in assembler?
Are you wishing to write the timer-manipulating code in assembler, or the Timer ISR in assembler, or both?
Even if you want to do this in assembler, it probably makes sense to do an initial implementation in C, so that you can separate assembler programming mistakes from algorithmic mistakes (what values to write to what registers.)
You might look at GitHub - WestfW/Minimal-ARM: Minimalist ARM Cortex Microcontroller development, in assembler. and some of the links therein, since it talks some about assembly programming of ARM, but it was for STM32 and doesn't cover timers (It does have a serial ISR program written entirely in assembler...)

Hi there @adijsr2012,

I have recently announced a library for using the TC modules (Timer Modules) channels of DUE's Atmel ATSAM3X8E micro-controller. You have the announce in this post:

https://forum.arduino.cc/index.php?topic=144446.msg2562995#msg2562995

The name of the library is tc_lib, and is available at: GitHub - antodom/tc_lib: This is a library to take advantage of different functionalities available on Timer Counter (TC) modules in Arduino Due's Atmel ATSAM3X8E microcontrollers

For doing what you want you have to use tc_lib action objects which abstract the use of ATSAM3X8E's TC module channels. Just have a look to the example action_test.ino that comes with the library.

If in any doubt, just tell me.
I hope it helps.