Announcements

Equip yourself to optimize AURIX™ MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

DLinH
Level 1
Level 1
First reply posted 5 sign-ins First question asked

TC275作为主芯片,通过I2C读取EEPROM芯片数据,在调用iLLD库的IfxI2c_I2c_read函数时,偶发程序卡在以下while循环中无法退出。

DLinH_0-1673508187046.png

发现是PIRQSS寄存器的RX位一直保持为1,无法退出循环。然后修改了此段代码,增加了超时退出while循环的操作,修改后发现退出while循环后,进入了下面的ERRIRQSS分支,RXF_OFL位被置为1。并且在下一次操作I2C,把数据写入TXD寄存器时,触发了SPB总线故障。

触发SPB总线故障的原因应该是手册里写的,FIFO还处于接收状态时写入TXD寄存器。

DLinH_1-1673508548560.jpeg

最终排查发现,由于在操作I2C时已经使能了CPU中断,当I2C以下红框内的操作被中断函数打断超过一个字节数据时间时,就会引起while循环无法退出、触发RXF_OFL置位、FIFO处于接收状态无法退出等问题。

DLinH_2-1673508721903.jpeg

很显然这应该是iLLD的代码问题。目前我能做的临时解决方案就是在进行这段操作前临时关闭中断,完成操作后再恢复中断,以保证底层操作的时序正确。

DLinH_3-1673509142653.png

 

希望能对以上方案进行评估,或者提出一个理想的解决方案,能够在以上I2C操作被打断一段时间后,避免发生一系列的异常问题。谢谢!

 

0 Likes
3 Replies
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

DlinH,

Thank you for your kind advice, this will be reported internally.

dw

0 Likes
DLinH
Level 1
Level 1
First reply posted 5 sign-ins First question asked

thanks for your reply! I want to know that whether my solution is feasible? Or there is a better solution to the problem?

0 Likes
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

From above description, when you call  IfxI2c_I2c_read(), if there is any interrupt to occupy too much time, the function will be stuck. So you add disable interrupt and enable interrupt again in the function. I think it's fine but you should test if the function will be stuck if read nothing from I2C. The ILLD is an evaluation free software which can be modified or enhanced by the user.

0 Likes