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.

CC2640R2F: Continuous UART Read Callback affects I2C LIS3DH Accelerometer Self Test.

Part Number: CC2640R2F


Hi,

   At our CC2640R2F based product we have a "Test Mode". At "Test Mode" we test peripherals like leds, buzzer, and I2C Accelerometer. After entering "Test Mode" we enter command example "acce" through UART to test our accelerometer.  At our "Test Mode" only the TestApp__Accelerometer() fails. If I call this TestApp__Accelerometer() in main TI-RTOS task and not in "Test Mode" it works all the time. 

Here are my observations after going to Test Mode.

1. If I call TestApp__Accelerometer() at Test Mode initialization, it passes.

                /* Configure UART */
                UartApp__Init();
                UartApp__WriteString("TEST STARTED\r\n");
                TestApp__Accelerometer();

Note: After this UART is set to repeated read callback for accepting commands example "acce".

2. After repeated UART read callback is initialized, it fails TestApp__Accelerometer(), specifically reading the Device Identification Register of the Accelerometer.

status_t LIS3DH_GetWHO_AM_I(uint8_t* val)
{
    if(!LIS3DH_ReadReg(LIS3DH_WHO_AM_I_ADDR, val))
    {
        return MEMS_ERROR;
    }
    else
    {
        return MEMS_SUCCESS;
    }
}

I debug the TestApp__Accelerometer, specifically the I2C part, and it is able to SENSOR_SELECT() and return I2C handle.

My conclusion is that the UART Repeated Read Callback is affecting the I2C. Shouldn't this be handled by TI-RTOS drivers? What is the proper solution to this problem?

- kel

  • Hi,

       Anyway, I already made this to work.

       I call TestApp__Accelerometer() at main TI-RTOS task. The TestApp__Accelerometer() pass 2x and on the 3rd time it fails. Supposedly the main TI-RTOS task should be executing repeatedly. But, I have come to conclusion that the main TI-RTOS task entered “Standby Mode” or “Idle Mode”. So, it seems that when the Application enter “Standby Mode” or “Idle Mode”, it affects the I2C. To solve the problem I posted an Event to “Wake Up” the Application. 

       After typing to Tera Term "acce", the program will call TestApp_AccEventPost() to post an Event.

    void TestApp_AccEventPost(void)
    {
        Event_post(syncEvent, SBP_ACC_TEST_EVT); 
    }  

       Then at main TI-RTOS task, it will handle the event and call TestApp__Accelerometer().

                  if (events & SBP_ACC_TEST_EVT)
                  {
                    TestApp__Accelerometer();
                  }

    Problem is solved.

    But, I would like to know where in the CC2640R2F related documentations says that the I2C is affected when the Application enters “Standby Mode” or “Idle Mode”.

    - kel

  • I'm not sure what the issue is here, but if you are doing any driver operations, it may be recommended to disable/prevent standby.

    Best wishes
  • Hi JXS,

    How do I disable/prevent standby mode?

    - kel
  • Hi kel,

    You can call
    Power_setConstraint(PowerCC26XX_SB_DISALLOW);
    Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);

    Best wishes