When using lpi2c, I encountered a situation where the program got stuck in debug mode. However, when I disconnected the PE connection and restarted the program, it worked properly. The program got stuck in debug mode during runtime.
do
{
/* Master send data */
Lpi2c_Ip_MasterSend(Instance);
ElapsedTicks += OsIf_GetElapsed(&CurrentTicks, I2C_TIMEOUT_TYPE);
}while ((Lpi2c_Ip_MasterGetTransferStatus(Instance, NULL_PTR) == LPI2C_IP_BUSY_STATUS) && (ElapsedTicks < TimeoutTicks));
Is there any way to solve this problem?
Hi @zhangyu5454
Could you please check if the I2C Debug Enable option is selected?
When MCR[DBGEN] = 1, the LPI2C module continues to work while the MCU is being debugged.
When MCR[DBGEN] = 0, after programming the application and running the board normally (without a debugger attached), the LPI2C should work as expected.
BR, VaneB
Hi @zhangyu5454
I have included the image below for reference:
VaneB_0-1786396779346.png
Thanks for your reply.I use .mex to configure i2c, how can I set it to control MCR[DBGEN] =1
Hi @zhangyu5454
This option has been added to the latest RTD release and can now be configured directly through the Peripherals Tool.
As you are using an earlier RTD version, configuring MCR[DBGEN] in the application code would be the recommended approach.
zhangyu5454_0-1786418199524.png
I noticed that our pages display differently, I couldn't find this option, note that my version is RTD5.0