This library enables you to use Interrupt from Hardware Timers on RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO. These MBED_RPI_PICO_TimerInterrupt 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.
MIT License
11
stars
1
forks
source link
[Nano_RP2040_Connect] Using built-in RGB LED in an interrupt? #1
Good morning! I tried to make the built-in RGB LEDs of the Nano RP2040 Connect blink with interrupts (both hardware and ISR_based). It results in the board crashing.
Rather than with your (awesome!) library, I suspect it might be a problem with the digitalWrite/analogWrite functions defined by the WiFiNINA library to write to the RGB LED... they seem to communicate via SPI to the WiFi module (https://github.com/arduino-libraries/WiFiNINA/blob/master/src/utility/wifi_drv.cpp). Would that be too "time-consuming" for an ISR? I only have a basic knowledge of interrupts...
(And I have a blocking task in the main program, so a pure software timer would not work, that's why I thought of using interrupts.)
Steps to Reproduce
From the "50ms_HWTimer.ino", I added #include <WiFiNINA.h> to use the RGB LED.
Then I replaced LED_BUILTIN with LEDR. In TimerHandler0 function, I also replaced the digitalWrite call with:
Describe the bug
Good morning! I tried to make the built-in RGB LEDs of the Nano RP2040 Connect blink with interrupts (both hardware and ISR_based). It results in the board crashing.
Rather than with your (awesome!) library, I suspect it might be a problem with the digitalWrite/analogWrite functions defined by the WiFiNINA library to write to the RGB LED... they seem to communicate via SPI to the WiFi module (https://github.com/arduino-libraries/WiFiNINA/blob/master/src/utility/wifi_drv.cpp). Would that be too "time-consuming" for an ISR? I only have a basic knowledge of interrupts...
(And I have a blocking task in the main program, so a pure software timer would not work, that's why I thought of using interrupts.)
Steps to Reproduce
From the "50ms_HWTimer.ino", I added
#include <WiFiNINA.h>
to use the RGB LED.Then I replaced
LED_BUILTIN
withLEDR
. InTimerHandler0
function, I also replaced the digitalWrite call with:Expected behavior
The RGB LED blinks.
Actual behavior
The board crashes. (LED_BUILTIN flashes 4x short and 4x long)