infineon4engi@twitter infineon@linkedin infineon4engineers infineon@youtube
twitter Facebook Linkedin Youtube

+ Reply to Thread
Results 1 to 3 of 3

Thread: XMC 2Go I2C error handling when no device is connected

  1. #1
    New Member New Member kamils is on a distinguished road
    Join Date
    Sep 2017

    XMC 2Go I2C error handling when no device is connected

    Hi, I'm using XMC2Go development board and go I2C working correctly with some external devices. Now I need to make the code reliable when device is disconnected, but I found that I2C channel gets into a state that I can't recover.

    I call
    // init sequence, 
    // and then
    XMC_I2C_CH_MasterStart(channel, address, command);
    // when device is present is present it returns XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED
    // but when it's disconnected it gives XMC_I2C_CH_STATUS_FLAG_START_CONDITION_RECEIVED (!)
    The status code surprised me, but fine, I could treat it as error here, however now the channel is broken, when I call
    XMC_I2C_CH_MasterStart(channel, address, command);
    again (e.g. trying to check if device is now connected) it will hang.

    I'm guessing the first call to XMC_I2C_CH_MasterStart left the transmit buffer full and subsequent calls to this method will hang on XMC_USIC_CH_GetTransmitBufferStatus returning busy.

    Now, the questions are
    - how to properly detect lack of device and
    - (if the above code it approximately what should be done) how to reset the channel in case of detected errors (I tried calling
    , but it didn't help)

  2. #2
    Beginner Beginner persike will become famous soon enough
    Join Date
    Sep 2017
    Hello kamils,

    Are you using DAVE4? In case of using it, could you please provide your code/project?
    I've been trying to use I2C+Sense2Go to read a TLV493D (on DAVE4) but it isn't working as expected. I did it on DAVE3 but I want to move to the newest one.

    Thank you,
    Best regards.

  3. #3
    New Member New Member cinderblock is on a distinguished road
    Join Date
    May 2017
    I think I was facing the same problem.

    XMC_I2C_CH_MasterStart() would hang after a NACK response.

    Turns out this was because I had a XMC_I2C_CH_MasterStop() after receiving the NACK. This would sit in the transmit buffer blocking any future use of the I2C bus.

    Hope this helps someone. I came across this thread from a google search.

+ Reply to Thread

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.

Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.