Skip to content

nRF2840 crashing using adafruit arduino framework #1509

Closed

Description

@someburner

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.

Activity

  1. someburner commented on Jun 3, 2023

    @someburner
    Author

    Made a little progress tracking down the issue:

    • 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.

  2. someburner commented on Jun 4, 2023

    @someburner
    Author

    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.

  3. someburner commented on Jun 4, 2023

    @someburner
    Author

    Yeah it is getting optimized out. I will close and comment if I find a clean solution for platformio to not do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions