This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf51422 ANT interrupts and WS2812b

I am having an issue implementing a WS2812b driver for the nrf51422 using the 210 softdevice. We currently have ANT enabled with a tx master only channel setup. The WS2812b driver uses bit-banging to transmit the bit pattern to a strand of LEDs. Due to the nature of the one wire WS2812b protocol, this bit banging has very sensitive timing tolerances. By adding this bit pattern transmission to the tx event handler (ran in main context off of ant_event_process), the bit stream is interrupted mid-transmission by an ISR exceeding 50us causing the bit stream to be corrupted.

Doing some digging it seems that this issue only occurs with ant enabled and a channel opened. By disabling ANT and putting the LED code on a separate, periodic signal, the issue goes away. It appears that there is an ANT related interrupt that causes the bit transmission to be corrupted. If I add a delay in my driver code the LED pattern is not corrupted as the interrupt occurs during the delay. That being said, the delay is not ideal as it holds up all main context events.

Does anyone have an idea of what is causing this issue? What is it about ANT that I get this periodic interrupt (following the tx event) that holds up the processor for more than 50 us? If anyone has suggestions on how to get around this issue I would greatly appreciate it.

Cheers,

Braden

  • Awesome. I tried your suggestion and with a few modifications it worked. That being said I had to call my led bit banging function inside the radio notification event handler else the bit stream would get corrupted. I hypothesize that decoupling the bit banging from the radio notification event handler results in scenarios where the bit banging starts when the radio is inactive but changes to active a short while later. We are using ANT with a very small period which likely causes issues on the bit banging (which occurs at a different frequency).

    All in all it appears to be stable now. Thank you for all your help Kenneth!

Related