Hi guys,
I have a 4 thread freeRTOS setup.
- BLE - priority 4
- TWI - priority 3
- LED - priority 2
- Logging - priority 1
After running for some time my code always gets caught in an infinite loop inside the vListInsert function of freeRTOS, or hardfaults @ PC:0x20003188 PSR: 0x4000000e (PendSV). It occurs like a random race-condition. Typically this indicates an issue with interrupt priorities. Looking thru my Stack trace, On the BLE thread (4), I get a SAADC IRQ (IRQ priority 6 in sdk_config.h) which triggers a callback function to write the value to the Log Thread (1). Here I try and grab a Semaphore which calls the following sequence, xSemaphoreTake() -> xQueueGenericReceive() -> vTaskPlaceOnEventList() -> vListInsert().
As an FYI I'm trying to Port FreeRTOS to the nRF52840 which i realize doesn't have an official support from Nordic yet. Just want to double check there is nothing unique about the any vector implementation that might propagate to different behaviour in upper levels of an RTOS. Thanks for your help.