My Cortex-M4 project uses a bank of WS2812 LEDs that require precise delays
in the nanosecond range when modulating a data pin. The typical approach
when using this part is to suspend all interrupts, pull the pin high, issue
a certain number of NOP instructions depending on the value to display,
then pull the pin low and issue another set of NOP instructions, repeating
the process until all values are displayed and finally re-enabling
There are several options available in FreeRTOS for exclusive access:
vTaskSuspendScheduler, taskDISABLE_INTERRUPTS and taskENTER_CRITICAL.
Considering my requirement is to have exclusive use of the chip for timing
(not access to a shared resource), which is the preferred approach? If I
use critical sections, will I need to set the priority of all interrupts to
be at least BASEPRI so they are masked? Will the PendSV and SysTick
interrupts still run, possibly throwing the timing out of whack?