This library enables you to use Interrupt from Hardware Timers on an NRF52-based board using mbed-RTOS such as Nano-33-BLE. These nRF52 Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's mandatory if you need to measure some data requiring better accuracy. It now supports 16 ISR-based Timers, while consuming only 1 Hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based Timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks.
Hi Khoi,
Thanks for writing and sharing this timer interrupt library.
I am trying to implement consistently spaced sampling on a Nano33BLE, but the board seems to crash whenever I have a call to analogRead within the ISR.
Arduino IDE version: 1.8.13
Arduino mbed Nano Core Version 2.4.1
OS: Windows 10
Minimal code is below. I have also tried with an Adafruit nrf52 board and your other version of the library. This seems to work, but only if interrupts are halted before the analogRead call and enabled afterwards.
Working on native Nordic SDK firmware, but it would be great to accelerate prototyping with your library!
volatile int idx;
volatile unsigned long times[20] = {};
volatile int readings[20] = {};
volatile int fm_output = 0;
unsigned long t_now; // start time for current loop
unsigned long t_last_sample = 0;
unsigned long sample_delay = 5000;
unsigned long t_last_print = 0;
unsigned long print_delay = 500E3;
void setup() {
// put your setup code here, to run once:
Hi Khoi, Thanks for writing and sharing this timer interrupt library. I am trying to implement consistently spaced sampling on a Nano33BLE, but the board seems to crash whenever I have a call to analogRead within the ISR.
Arduino IDE version: 1.8.13 Arduino mbed Nano Core Version 2.4.1 OS: Windows 10
Minimal code is below. I have also tried with an Adafruit nrf52 board and your other version of the library. This seems to work, but only if interrupts are halted before the analogRead call and enabled afterwards.
Working on native Nordic SDK firmware, but it would be great to accelerate prototyping with your library!
// test of timer ADC functionality