Running FreeRTOS Kernel V10.4.1 with CMSIS interfaces.
We have added a mutex to our I2C driver wrapper in order to avoid concurrent access to the peripheral. prvProcessExpiredTimer in timers.c is calling a our registered timer callback, which eventually grabs the mutex to send some I2C traffic.
I am seeing an assert give → xQueueGenericSend() where it checks for a NULL pointer (line 777):
BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
const void * const pvItemToQueue,
TickType_t xTicksToWait,
const BaseType_t xCopyPosition )
{
BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired;
TimeOut_t xTimeOut;
Queue_t * const pxQueue = xQueue;
configASSERT( pxQueue );
Given that the function accessing the mutex was able to Get it, I am not sure how this is happening. Any thoughts on what we could be doing wrong?
void uC_I2C_MasterTx(mxc_i2c_regs_t * p_I2C, uint8_t slave_addr, uint8_t * p_tx_data, uint8_t num_bytes)
{
i2c_flag = 1;
osMutexWait(UC_I2C_Mutex_ID, osWaitForever);
if(I2C_MasterWrite(p_I2C, slave_addr, p_tx_data, num_bytes, 0) != num_bytes)
{
RTE_LOG(RTE_LOG_CATEGORY_ERR, EVENT_ID_I2C_TX_FAIL,
RTE_GetSlaveNameFromAddress(slave_addr));
}
osMutexRelease(UC_I2C_Mutex_ID);
}
Here is the call stack: