Hello All,
I am working on KW41 microcontroller and using KDS for development. I have to do i2c communication, for that I am using FreeRTOS library. I am calling I2C_RTOS_Transfer to read a register in my I2C device. Please have a look on below defination of I2C_RTOS_Transfer :
status_t I2C_RTOS_Transfer(i2c_rtos_handle_t *handle, i2c_master_transfer_t *transfer)
{
status_t status;
/* Lock resource mutex */
if (xSemaphoreTake(handle->mutex, portMAX_DELAY) != pdTRUE)
{
return kStatus_I2C_Busy;
}
status = I2C_MasterTransferNonBlocking(handle->base, &handle->drv_handle, transfer);
if (status != kStatus_Success)
{
xSemaphoreGive(handle->mutex);
return status;
}
/* Wait for transfer to finish */
xSemaphoreTake(handle->sem, portMAX_DELAY);
/* Unlock resource mutex */
xSemaphoreGive(handle->mutex);
/* Return status captured by callback function */
return handle->async_status;
}
This program is hanging while executing the xSemaphoreTake command highlighted with red color.
while looking in code with debugger, the program is going to hang while executing portYIELD_WITHIN_API(); in queue.h library.
Can somebody help me to resolve this problem.
Thanks,
Saurabh