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.

CC2650: CC2650 register setting for I2C slave

Part Number: CC2650

Dear TI members.

I am developing communication between F28069 and CC2650 via I2C for delivering status information.

F28069 is I2C master and only send status data

CC2650 is I2C salve and only receive status data and store as BLE information.

I have tested F28069 as I2C master with other device, and worked fine.

when I try to send data from F28069 to C2650, I2C SCL, SDA waveform is as follows.

channel 3 is SDA, channel 2 is SCL.

As you may see, there seems to be some collision, it looks like both F28069 and CC2650 send some data.

My only configuration for CC2650 I2C is 

  I2CSlaveInit(I2C0_BASE, 0x74); // 7bit address

I guess that CC2650 operated as slave transmit mode, I'd like to set it as slave receiver

but I cannot find any relevant register for this.

would you please let me know how to set CC2650 as slave receiver ?

Best Regards,

Hae Ryong

  • Hi Hae,

    Have you configured the IO pins for I2C operation as well? Could you maybe provide some code snippets on what you are doing or even better, a small example project that I can run?
  • Thanks for your response,

    please refer to following code snippets

    for main.c

    /*******************************************************************************
     * LOCAL VARIABLES
     */
    PIN_Handle i2cPinHandle;
    PIN_State  i2cPinState;
    /*******************************************************************************
     * GLOBAL VARIABLES
     */
    PIN_Config i2cPinTable[] = {
        Board_I2C0_SDA | PIN_INPUT_EN | PIN_PULLUP | PIN_OPENDRAIN,
        Board_I2C0_SCL | PIN_INPUT_EN | PIN_PULLUP | PIN_OPENDRAIN,
        PIN_TERMINATE
    };
    
    int main()
    {
      /* Register Application callback to trap asserts raised in the Stack */
      RegisterAssertCback(AssertHandler);
    
      Board_initGeneral();
    
      PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
    
      Power_setDependency(PowerCC26XX_PERIPH_I2C0);
      // Set Power dependecies & constraints
      Power_setDependency(PowerCC26XX_PERIPH_GPIO);
    
      /* Set constraints for Standby, powerdown and idle mode */
      Power_setConstraint(PowerCC26XX_SB_DISALLOW);
      Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
    
      PRCMLoadSet();
      PRCMPeripheralRunEnable(PRCM_PERIPH_I2C0); // Enable I2C module
      PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO);
      PRCMLoadSet();
    
      PINCC26XX_setMux(i2cPinHandle, Board_I2C0_SDA, IOC_PORT_MCU_I2C_MSSDA);
      PINCC26XX_setMux(i2cPinHandle, Board_I2C0_SCL, IOC_PORT_MCU_I2C_MSSCL);
    
    #ifndef POWER_SAVING
      /* Set constraints for Standby, powerdown and idle mode */
      Power_setConstraint(PowerCC26XX_SB_DISALLOW);
      Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
    #endif // POWER_SAVING
    
      /* Initialize ICall module */
      ICall_init();
    
      /* Start tasks of external images - Priority 5 */
      ICall_createRemoteTasks();
    
      /* Kick off profile - Priority 3 */
      GAPRole_createTask();
    
      SimpleBLEPeripheral_createTask();
    
      i2cPinHandle = PIN_open(&i2cPinState, i2cPinTable);
      if(!i2cPinHandle) {
          System_abort("Error initializing board LED pins\n");
      }
    
      /* enable interrupts and start SYS/BIOS */
      BIOS_start();
    
      return 0;
    }
    

    add slave init at task init function

      I2CSlaveInit(I2C0_BASE, 0x74); // 7bit address

    add I2C receive function at TaskFxn

        // read Slave status register
        if(I2CSlaveStatus(I2C0_BASE) == I2C_SLAVE_ACT_RREQ_FBR)
        {
      	  int i;
      	  uint8_t b_char[4];
      	  uint32_t reg_addr=10;
    
      	  reg_addr = I2CSlaveDataGet(I2C0_BASE);
      	  for(i=0; i<4; i++)
      	  {
      		  while(I2CSlaveStatus(I2C0_BASE) == I2C_SLAVE_ACT_RREQ);
      		  i2cRecvData[i] = I2CSlaveDataGet(I2C0_BASE);
      		  b_char[i] = (uint8_t)(i2cRecvData[i]&0x000000FF);
      	  }
         }

    I think this is all that I have added for I2C slave feature.

    if you need anything else, just let me know.

    Best Regards,

    Hae Ryong

  • Hi Hae,

    Your code seems OK to me, as you use the internal pull-up resistors, have you made sure there is no external pull-ups in play as well? What I2C speed are you running at?
  • Hi M-W,

    I have external pull-ups in F28069 board, CC2650 board is connected via 5 lines cable, since F28069 and CC2650 are in different boards.
    cable length is just around 10 cm.
    What is the setting for external pull-ups for SCL and SDA ? I'd like to try to change it.

    I have tried I2C speed as 400k and 100k, both are same situation.

    Best Regards,
    Hae Ryong
  • To disable the internal pull-ups you need to include the I2CCC26XX.c driver file to the project and make changes to the internal PIN setup. Look for I2CCC26XX_initIO, in that function change from "PIN_PULLUP" to "PIN_NOPULL".
  • Hi M-W,

    sorry for late response.

    I have tried pin setup as follows

    PIN_Config i2cPinTable[] = {
    Board_I2C0_SDA | PIN_INPUT_EN | PIN_NOPULL | PIN_OPENDRAIN,
    Board_I2C0_SCL | PIN_INPUT_EN | PIN_NOPULL | PIN_OPENDRAIN,
    PIN_TERMINATE
    };

    I got still same waveform as before, seems nothing changed.

    however, I'm not sure I am using I2CCC26XX.c, since I cannot find I2CCC26XX_init() called in my files.
    I think I am using only i2c.h in C:\ti\tirtos_cc13xx_cc26xx_2_18_00_03\products\cc26xxware_2_23_03_17162\driverlib

    what could be the problem ?

    Best Regards,
    Hae Ryong
  • HI Hae,

    You are completely right, I must have slipped and thought we were talking about the I2C Master driver again. Do you have another device you could use as a master to try with (another launchpad for example)? If you can reproduce it with two launchpads then I can try it out as well.
  • Hi Hae,

    Have you been able to try this out and reproduce it on two launchpads?
  • Hi M-W

    Thanks for your concern.

    I'm working on this issue with local FAE.
    I think he could handle this issue.

    Thanks for your kind support.

    Best Regards,
    Hae Ryong
  • Hi Hae,

    Ok, let me know if there is anything else to help with. I'm going to mark this as "Think Resolved" for now to close it. Feel free to update with the solution when you have one.