You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nRF2840 crashing using adafruit arduino framework #1509
I've gotten FastLED to compile on 2 adafruit nRF2840 boards using Adafruit_nRF52_Arduino, but in both cases the boards immediately lock up after calling FastLED.show().
I haven't had time to really dig in, but I'd wager it's related to how FastLED accesses/performs PWM on the nRF platform and there is some sort of conflict with the Adafruit Arduino framework. I was hoping Adafruit might have some tips but they suggested asking around here first. See here for more details: adafruit/Adafruit_nRF52_Arduino#770
Using the same pins, the Adafruit Neopixel library works fine, and they also use PWM.
For reference I am using platformio, and have tried various versions of FastLED and their Arduino framework.
Can anyone else reproduce this problem using Adafruit Arduino framework? If so then I can spend some time to help track down the issue.
In my experience with cortex processors these lockups can happen when a register is written to or accessed when it shouldn't be, but I'm not super familiar with PWM on cortex.
appears all the PWM setup stuff in startPwmPlayback is OK, except for interrupts
if I comment out stuff pertaining to interrupts, e.g. nrf_pwm_int_set, and the spin lock acquire/release stuff like spinAcquireSequenceBuffer, then it doesnt crash and LEDs do get updated
Once you enable certain interrupts, the crash occurs. However it doesn't even appear the ISR handler is ever being entered. Altho I gotta double check that with an LED / probe
I've seen on reddit other people got nRF52840 boards working fine with FastLED, but mostly comments from 6+ months ago, so I'm wondering if a toolchain or Adafruit Arduino update broke the impl.
Appears with platformio, PWM0_IRQHandler is getting optimized out. I need to double check but in case anyone else comes across this, it seems just adding an extern uint32_t isrCount; in main and printing out the value somewhere causes the linker to not remote the handler.
Activity
someburner commentedon Jun 3, 2023
Made a little progress tracking down the issue:
startPwmPlaybackis OK, except for interruptsnrf_pwm_int_set, and the spin lock acquire/release stuff likespinAcquireSequenceBuffer, then it doesnt crash and LEDs do get updatedI've seen on reddit other people got nRF52840 boards working fine with FastLED, but mostly comments from 6+ months ago, so I'm wondering if a toolchain or Adafruit Arduino update broke the impl.
someburner commentedon Jun 4, 2023
Appears with platformio,
PWM0_IRQHandleris getting optimized out. I need to double check but in case anyone else comes across this, it seems just adding anextern uint32_t isrCount;in main and printing out the value somewhere causes the linker to not remote the handler.someburner commentedon Jun 4, 2023
Yeah it is getting optimized out. I will close and comment if I find a clean solution for platformio to not do that.