Hi,
When you use FreeRtos to transfer data, there are semaphore or event mechanism to synchronize, so you will take a long time.
For example, this is the code, the line /* Wait for transfer to finish */
(void)xSemaphoreTake(handle->semaphore, portMAX_DELAY);
you need a longer time to transfer than that of without FreeRtos.
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 */
(void)xSemaphoreTake(handle->semaphore, portMAX_DELAY);
/* Unlock resource mutex */
xSemaphoreGive(handle->mutex);
/* Return status captured by callback function */
return handle->async_status;
}
Hope it can help you
BR
XiangJun Rong