Jan 09, 2019
09:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 09, 2019
09:29 AM
Hi,
I have an XMC-1404 running the I2C_MASTER app connected to a LCD screen with an I2C expander.
If the LCD is not connected or there is an error in the transmission the APP gets stuck at line 1519 in i2c_master.c:
I am using this command to send data to the LCD:
Is there any way to prevent this?
Thanks,
Nico
I have an XMC-1404 running the I2C_MASTER app connected to a LCD screen with an I2C expander.
If the LCD is not connected or there is an error in the transmission the APP gets stuck at line 1519 in i2c_master.c:
while (I2C_MASTER_GetFlagStatus(handle, (uint32_t)XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED) == 0U)
{
/* wait for ACK */
}
I am using this command to send data to the LCD:
I2C_MASTER_Transmit(&I2C_MASTER_0,true,I2C_SLAVE_ADDR,lcd_data,6,true);
Is there any way to prevent this?
Thanks,
Nico
6 Replies
Jan 10, 2019
06:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 10, 2019
06:39 AM
Hi,
This is actually a shortcoming of the current version of the APP in polling mode
The APP should check also for the non acknowledge case.
In the interrupt mode you could enable the error handling of NACK. In the callback you should call the I2C_MASTER_AbortTransmit()
Regards,
Jesus
This is actually a shortcoming of the current version of the APP in polling mode
The APP should check also for the non acknowledge case.
if (send_start == true)
{
if (handle->runtime->bus_acquired == false)
{
I2C_MASTER_lSendStart_Or_RepeatedStart(handle, slave_address, XMC_I2C_CH_CMD_WRITE);
while (I2C_MASTER_GetFlagStatus(handle, XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED | XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED) == 0U);
if (I2C_MASTER_GetFlagStatus(handle, XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED))
{
I2C_MASTER_ClearFlag(handle, (uint32_t)XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED);
I2C_MASTER_AbortTransmit(handle);
return I2C_MASTER_STATUS_FAILURE;
}
else
{
I2C_MASTER_ClearFlag(handle, (uint32_t)XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED);
}
}
}
In the interrupt mode you could enable the error handling of NACK. In the callback you should call the I2C_MASTER_AbortTransmit()
Regards,
Jesus
Jan 16, 2019
03:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 16, 2019
03:50 AM
Thanks for that Jesus, I'll give it a go this week and let you know how I get on.
Nico
Nico
Jan 28, 2019
02:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 28, 2019
02:59 AM
Hi Jesus,
I have now managed to get it to work successfully, however it wasn't as easy as you described!
I enabled the I2C interrupt mode and the code now got stuck with TDV bit enabled - XMC_USIC_CH_TBUF_STATUS_BUSY but no transmission occurring.
I my code detects that this occurs I have to write 10b to the MTDV bits and then restart the transmission.
Why is this not carried out with the Dave app with the I2C_MASTER_AbortTrasmit function as this procedure is described in the datasheet "17.5.3.5 Not Acknowledge and Error Conditions"?
Thanks,
Nico
I have now managed to get it to work successfully, however it wasn't as easy as you described!
I enabled the I2C interrupt mode and the code now got stuck with TDV bit enabled - XMC_USIC_CH_TBUF_STATUS_BUSY but no transmission occurring.
I my code detects that this occurs I have to write 10b to the MTDV bits and then restart the transmission.
Why is this not carried out with the Dave app with the I2C_MASTER_AbortTrasmit function as this procedure is described in the datasheet "17.5.3.5 Not Acknowledge and Error Conditions"?
Thanks,
Nico
Jan 28, 2019
04:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 28, 2019
04:55 AM
Hi Nico,
Thanks for the feedback. We will fix it in the next release.
Regards,
Jesus
Thanks for the feedback. We will fix it in the next release.
Regards,
Jesus
May 02, 2019
12:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 02, 2019
12:32 AM
Hi there!
I have managed the issue with I2C-Bus by reinitializing the bus if there is a problem with bus devices
Take account on example code for XMC4500 with DAVE 4 CE at
https://github.com/haselb/ISOT
regards
I have managed the issue with I2C-Bus by reinitializing the bus if there is a problem with bus devices
Take account on example code for XMC4500 with DAVE 4 CE at
https://github.com/haselb/ISOT
regards
Nov 03, 2022
05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 03, 2022
05:22 AM
Thanks for that, I solved a similar issue using your code as below, the init routine wasn't enough on it's own, needed the abort transmit / receive first.
I2C_MASTER_AbortTransmit(&I2C_MASTER_0);
I2C_MASTER_AbortReceive(&I2C_MASTER_0);
I2C_MASTER_Init(&I2C_MASTER_0);
Brendan