Not applicable
Sep 27, 2017
11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 27, 2017
11:19 AM
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
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
I call
// init sequence,
// and then
XMC_I2C_CH_MasterStart(channel, address, command);
XMC_I2C_CH_GetStatusFlag(channel);
// 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
XMC_I2C_CH_Stop(CHANNEL); XMC_I2C_CH_Start(CHANNEL);, but it didn't help)
- Tags:
- IFX
2 Replies
Sep 28, 2017
12:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 28, 2017
12:17 AM
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.
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.
Jul 15, 2019
01:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 15, 2019
01:14 AM
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.
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.