This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: I2C TRANSFER IN A TIMER CALLBACK FUNCTION (CC1350STK)

Other Parts Discussed in Thread: CC1350

Tool/software: TI-RTOS

Hello everyone,

I'm trying to read sensor (acc/gyro) data from my sensortag CC1350 using I2C every 10 ms, therefore i'm using a timer. 

In the timer callback function im calling  SensorMpu9250_accRead(accData); which uses the I2C_transfer function.

the function returns zero data, mostly because of the callback context, because it's called from timer callback function (however the transfer works in the task context)

what do you think the solution for this problem?

I read that i could change I2C_transfer to callback mode in the I2C_open like:

params.transferCallbackFxn = someI2CCallbackFunction;

but what is "someI2CCallbackFunction" in this case ?? is it the same callback function of the TIMER ?

What should i put inside "someI2CCallbackFunction" if its not the same as the callback function of the timer ?

Best regards

  • Hello Majd,

    The best course of action here is to take advantage of resource handling of TI RTOS. You can post a semaphore, event, or msg to msg queue inside the callback, while an another task pends on it (the I2C task).

    Regards,
    AB