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: I2C Driver cannot work correctly with UART activated

Part Number: CC2640R2F

Tool/software:

We are using CC2640R2F Bluetooth Chipset with a ATECC608 which is a I2C security chip connected to I2C0 bus VIA IOID_4 and IOID_5.

The I2C driver work correctly with UART0 closed. But if I open the UART0 port, The I2C_transfer always return false and the I2C register DATAACK_N ADRACK_N ERR all set to 1. I connect a LA to the SDA and SCL, and found there is a Clock signal lost.

We are using simplelink_cc2640r2_sdk_5_30_01_11 SDK.

Below is configuration code:

if (bus >= 0 && bus < MAX_I2C_BUSES)
  {
    I2C_BitRate frequency;   
    
    I2C_Params_init(&i2cParams);
    //change to baudrate
    if(cfg->atcai2c.baud == 1000000){
      frequency = I2C_1000kHz;
    }else if(cfg->atcai2c.baud == 400000){
      frequency = I2C_400kHz;   
    }else{
      frequency = I2C_100kHz;
    }
    
    i2cParams.bitRate = frequency;
    
#if I2C_USING_CALLBACK_MODE  
    
    i2cParams.transferCallbackFxn = hal_i2c_callback;
    i2cParams.transferMode = I2C_MODE_CALLBACK;
    
#endif
    
    i2c = I2C_open(Board_I2C0, &i2cParams);
    
    
    phal->hal_data = NULL;          //TODO: not use temporay
    
    return ATCA_SUCCESS;
  }

  UART_Params uartParams;
  
  /* Create a UART with data processing off. */
  UART_Params_init(&uartParams);
  
  uartParams.writeMode        = UART_MODE_BLOCKING;
  uartParams.readMode         = UART_MODE_BLOCKING;
  uartParams.readReturnMode   = UART_RETURN_FULL; /*UART_RETURN_NEWLINE*/
  uartParams.writeDataMode    = UART_DATA_BINARY;
  uartParams.readDataMode     = UART_DATA_BINARY;
  uartParams.baudRate         = BaudRate;
  uartParams.dataLength       = UART_LEN_8;
  uartParams.stopBits         = UART_STOP_ONE;
  uartParams.parityType       = UART_PAR_NONE;
  
  /* open Uart port */
  uartHandler  = UART_open(Board_UART0, &uartParams);

Below is some screenshot

Below is the normal I2C signal with UART disabled:

Regards

  • Hello Ziqi Zuo,

    Looking at some other threads could we try:

    "When this error occurs, is the SDA held by the slave and stuck low? Perhaps you need to toggle the SCL line a few times. After you cancel and close the I2C instance, try configuring the SCL pin as a GPIO and toggle it a few times. Then initialize the I2C driver and reopen your I2C istance"

    Here is a thread which discusses common i2c problem/solutions

    https://e2e.ti.com/f/1/t/1027303/

    I also wanted to ask if we had the display enabled/used in your project on top of the UART? If so maybe remove the display functions as it might conflict with UART.

    Thanks,
    Alex F

  • No, we do not use the Display driver and never call the Display_init function. I try to modify both the Swi and Hwi priority but make no effect. Seem like the I2C hardware stop working after received the first byte from slave and sent out the ACK to slave. I will try to tongle the SCL line a few time and see if there are some changes or not.