AnsweredAssumed Answered

KSDK I2C FreeRTOS Driver Bug?

Question asked by RYAN BRYNGELSON on Sep 15, 2016
Latest reply on Sep 23, 2016 by Daniel Chen

Hello,

 

I'm working on a project that makes use of KSDK 2.0 and FreeRTOS on a KW41 using I2C.  I noticed I was receiving a valid response (return value of 0) from I2C_RTOS_Transfer when the device wasn't connected (which ultimately resulted in a NAK as far as the KW41 was concerned).  I traced the issue down to I2C_RTOS_Callback located in KSDK_2.0/devices/MKW41Z4/drivers/fsl_i2c_freertos.c.  The status variable passed into the callback is correctly reflecting the NAK on the bus, however, it's not copied to handle->async_status, which is what is returned from I2C_RTOS_Transfer.  Here's the method in question with my addition in red...

 

static void I2C_RTOS_Callback(I2C_Type *base, i2c_master_handle_t *drv_handle, status_t status, void *userData)
{
    i2c_rtos_handle_t *handle = (i2c_rtos_handle_t *)userData;
    BaseType_t reschedule;

 

    handle->async_status = status;

 

    xSemaphoreGiveFromISR(handle->sem, &reschedule);
    portYIELD_FROM_ISR(reschedule);
}

 

Thoughts?

 

Ryan

Outcomes