I know this appears to be a common problem, but we’ve tripple checked and don’t seem to be doing anything that is listed in the FAQ’s regarding this problem.
We get our code up and running, and then anywhere from a few seconds to a few minutes, the program hangs on
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
We’ve monitored our stacks and they have plenty of room. The high watermark doesn’t vary over time and we don’t get close to the end, so we are pretty sure that is not it.
We’ve set our priorities appropriately
// configKERNEL_INTERRUPT_PRIORITY sets the interrupt priority used by the kernel itself.
#define configKERNEL_INTERRUPT_PRIORITY 255 /* equivalent to 0xff, or priority 15. */
// configMAX_SYSCALL_INTERRUPT_PRIORITY sets the highest interrupt priority
//from which interrupt safe FreeRTOS API functions can be called.
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */
All of our ISRs have a priority level of
#define INT_PRI_SPI1 (12 << 4)
#define INT_PRI_SPI2 (12 << 4)
#define INT_PRI_SPI3 (12 << 4)
#define INT_PRI_EXT_SPI1 (15 << 4)
#define INT_PRI_UART1 (13 << 4)
#define INT_PRI_UART2 (12 << 4)
#define INT_PRI_UART3 (13 << 4)
#define INT_PRI_UART4 (13 << 4)
#define INT_PRI_UART5 (13 << 4)
#define INT_PRI_UART6 (13 << 4)
#define INT_PRI_TIMER_1 (14 << 4)
#define INT_PRI_TIMER_2 (14 << 4)
#define INT_PRI_TIMER_3 (14 << 4)
#define INT_PRI_TIMER_4 (14 << 4)
#define INT_PRI_TIMER_5 (14 << 4)
#define INT_PRI_TIMER_6 (14 << 4)
#define INT_PRI_TIMER_7 (14 << 4)
#define INT_PRI_TIMER_8 (14 << 4)
#define INT_PRI_TIMER_9 (14 << 4)
#define INT_PRI_TIMER_10 (14 << 4)
#define INT_PRI_TIMER_11 (14 << 4)
#define INT_PRI_TIMER_12 (14 << 4)
#define INT_PRI_TIMER_13 (14 << 4)
#define INT_PRI_TIMER_14 (14 << 4)
#define INT_PRI_I2C1 (15 << 4)
#define INT_PRI_I2C2 (15 << 4)
#define INT_PRI_I2C3 (15 << 4)
#define INT_PRI_ADC (15 << 4)
I’ve checked through all my code and I do not have any API calls that run during a “critical” period. I never suspend the scheduler.
The code hangs on this code..
xQueueReceive(spi1_que_handle, (void*)&msg_ptr, WAIT_FOREVER);
This code has successfully executed thousands of times before it hangs. I’ve check to see that spi1_que_handle is not corrupted and does not change.
I don’t know where to start….