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

Exact pulse timing

Hi,

With the S132 SoftDevice running, is there a way I can ask it to temporarily pause interrupts for a small segment of time so that I can execute extremely time critical code?

Alternatively, is there a hardware assist way to time exact highs and lows out a digital pin in order to drive a WS2812C RGB LED string? The timing for the bits need to be exact and this device requires timing NRZ output pulses.

Thanks,

Kevin

  • Hi Kevin,

    With the S132 SoftDevice running, is there a way I can ask it to temporarily pause interrupts for a small segment of time so that I can execute extremely time critical code?

    You can achieve this with timeslot api.

    Alternatively, is there a hardware assist way to time exact highs and lows out a digital pin in order to drive a WS2812C RGB LED string? The timing for the bits need to be exact and this device requires timing NRZ output pulses.

    The simplest way is to use UARTE - you can configure it for about 800 kbps, that gives 1.25 usec for one-bit cycle, then program TX buffer with a pattern of 0x7's as 0 / 0x3f's as 1 (that's for 2812B, I don't know whether 2812C has the same timings).

  • Thanks Dmitry. In case anyone wants to do the same, I was able to get SPIM2 to output the correct pulse widths using 0x01 for a 0-bit and 0x0F for a 1-bit with the speed set to 4MHz.

Related