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.

  • TI Thinks Resolved

CC3200: I2C communication problem

Prodigy 220 points

Replies: 35

Views: 1311

Part Number: CC3200

Hi 

i currently work on a cc3200 module and i try to use I2C bus to pilot some LEDs

It work perfectly during one or two minutes then the program block in I2C write function. you can see it here :

tank for help

regards

  • In reply to Hnz:

    Hi Hnz

    - How long is your I2C bus?
    SDA : 75,5mm (width : 0,15mm)
    SCL : 77mm

    How many slaves do you have connected?
    2

    What I2C slaves do you use?
    PCA9685PW (LED driver)
    SI7020-A20-GM1 (Temperature Sensor)

    What is a problematic slave?
    I2C freeze with the LED driver (PCA9685)

    - What value of pull-ups do you use? Did you try use stronger pull-ups?
    I’m using 5k pullup resistors, I also tried with 1k resistors, and I still have the bug.

    - Are all your I2C slaves designed to be used at 400kHz I2C?
    Yes

    - Did you try decrease clock to 100kHz?
    Yes, same issue

    - Are you able capture at oscilloscope moment when your slave stuck? Yes, I know that this may to be tricky and you will need to use Ext trigger.
    I recorded with a logic analyzer, (the screenshot is above in the thread), but with my oscilloscope, I'm not sure to succeed, I will try.

    Best Regards

  • Guru 33775 points

    In reply to harizi louison:

    Hi,

    How often communication with PCA9685 stuck? Can you estimate numbers (e.g. one of 1000 requests, etc.).

    I am almost 100% sure that issue causing internal logic in PCA9685 chip whcih stuck from some reasons. Now is question how it is often. In case of problem occurs very often, you will need fix this at hardware side. But in case of occurrence is rarely it make sense change software side. It may to be reasonable to add additional timeouts and tests. In case of SCL stuck in low may to be important error I2C_MASTER_ERR_ARB_LOST.

    My personal opinion. I never used _if abstraction layer at CC3200 SDK. Function in this layer are not much robust and the are usage of them wasting CPU time. It is much more efficient to use interrupts and maybe even DMA.

    Update:

    Just to be sure. In case of stuck it stays forever at while loop in I2CTransact() and did not return? Right?

    Jan


    Please click to "Verify Answer", if your question was answered.

  • Expert 8980 points

    In reply to Hnz:

    Hi everyone,

    Thanks for the help Jan. I would also like to add if software side fix makes sense - you can probably get away with triggering a software reset periodically on the LED driver before the expected failure happens. The PCA9685 has a software reset feature via I2C bus. It would be interesting to see if a periodic software reset prevents the i2c failure.

    Jesu

  • In reply to Jesu:

    Hi guys,

    To Jesu: Yes I tried to use the reset feature of the PCA9685 module but it did nothing, always the same failure happens.

    To Hnz: Right, when stuck it stays in I2CTransact() at the while loop forever and never return.

    The communication with the PCA9685 module stuck absolutely every time and very quickly ( < 1 seconde ).

    Always Thank

    Louison

  • Guru 33775 points

    In reply to harizi louison:

    Hi Louison,

    In case of communication stuck that often, than I think is no way how fix this by software. You need this fix your hardware. But there is a good question what is wrong in your case. Did you tested more PCA9685 chips? Did you tested your PCA9685 chip with another MCU? Maybe we forgot to one of obvious potential reasons of issue - damaged chip or some EMC issue.

    Software solution is not a your case, but if occurrence of issue will be a low (let say 1% of all communications), it may to be reasonable add detection of fault state, like:

    unsigned int err;
    
    while(((err = MAP_I2CMasterIntStatusEx(I2C_BASE, false)) & (I2C_INT_MASTER | I2C_MRIS_CLKTOUT | 0x80)) == 0)
    {
    }
    
    // Arbitration Lost Raw Interrupt Status (0x80 is a ARBLOSTRIS flag in I2CMRIS register)
    if ((err & 0x80) != 0) {
      // 
      // Do I2C restore procedure by generation of SCL impulses.
      // Also I2C peripheral should be restarted after this procedure.
      //
    }

    But I think this code not save you, because your communication with PCA9685 chips is so unreliable.

    Jan


    Please click to "Verify Answer", if your question was answered.

  • In reply to Hnz:

    Hi guys,

    I have news ! We can now affirm this is not an Hardware problem !

    Remember, the projet is based on the Blefi example project.

    The LEDs work very well when the function LoadBleFiCfg() is comented in the GwGenericTask. If this function is called, the issue happens.

    But if this function is comented, things like bluetooth and mqtt don't work. Certainly cause they don't have config.

    I don't know how this function can impact on the I2C communication but it happens.

    Again thank for the help !

    Regards

  • Guru 33775 points

    In reply to harizi louison:

    Hi,

    Sorry, I haven't experience with this reference design. I haven't time to study this design. I am not able to help you with this exact design.

    But how you can be sure that this is not hardware problem? It may to be EM interference between your BLE and I2C. Is your I2C bus near BLE antenna? Issue can be determined using spectrum analyser and EMC probes.

    Jan

    Please click to "Verify Answer", if your question was answered.

  • Expert 8980 points

    In reply to harizi louison:

    Hello,

    What device is the bluetooth running on?

    Jesu
  • In reply to Jesu:

    hi,

    @Hnz you are true, ccan't be sure it's not hardware problem but there are easly 2cm between I2C bus and Ble antenna. And i don't have spectrum analyser to test that.

    @Jesu the Bluetooth run on a CC2650 device

    Regards

  • Guru 34485 points

    In reply to harizi louison:

    Hi,

    Distance 2cm may not be enough depends on your antenna. For 2.4GHz is a reactive near field up to 2 cm.

    Jan


    Please click to "Verify Answer", if your question was answered.

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.