I have an issue with LPIC2 driver on MCU S32K358. The problem is that there is no change on lines SDA , SCLK at all. I was trying none blocking and blocking master send functions without succeess. I am configuring LPI2C pins as io with enabled pullup (some posts suggested this), I have configured interrupts controller for lpi2c irq handler. What I have checked code is never reaching irq handler as well as has always status busy at master sender. My code attached below. If You have any suggestions to the code or to the mex configuration let me know in advance.
The low power peripheral of I2c working fine now but only when debug enable pin is turned on at its MCR. I am working with sd32 ide based on eclipse in debug mode using flashed elf file to the MCU. Whenever MCR register bit is cleared the interrupts did not called and transmision not starting et all, the i2c bus is idle state forever and all transmit functions returned transmission status no ok then. Do you know the reason for that?
I am using the following inline function to enable debug mode for this peripheral:
static inline void LPI2C_Set_DebugEnable(LPI2C_Type *BaseAddr, boolean Enable)
{
uint32 RegValue = (uint32)BaseAddr->MCR;
RegValue &= (~(LPI2C_MCR_DBGEN_MASK));
RegValue |= LPI2C_MCR_DBGEN(ENABLE_BIT(Enable));
BaseAddr->MCR = (uint32)RegValue;
}
Sorry, I may not understand your question.
If MCR[DBGEN] = 1, can continue operating in debug mode.
When MCR[DBGEN] = 1, can LPI2C work when debugging the project in S32DS?
When MCR[DBGEN] = 0, after program the project to S32K358, power off and power on without debugging. Will LPI2C work?
When MCR[DBGEN] = 1, lpi2c is working and sending frames, interrupts are called,
when When MCR[DBGEN] = 0, lpi2c stop operation and not sending frames, interrupts are not called any more, transmitter sending status bus busy, i have checked with the scope both lines high means bus idle, after board power cycle still not working
Hi
Where did you enable the MCR[DBGEN] = 1?
Your code use LPIT to send I2C data periodically. Have you tried software delay to send I2C data periodically? I don't have S32K358EVB, so test the modified I2c_IP_FLEXIO_Transfer_S32K344 example on S32K344EVB-Q257. I am able to observe the I2C data after power off and then power on.
Also have you tried Lpi2c_Ip_MasterSendData?
Status = Lpi2c_Ip_MasterSendData(LPI2C0_INST, txBuffer, 3u, TRUE);
while((Lpi2c_Ip_MasterGetTransferStatus(LPI2C0_INST, NULL_PTR)) == STATUS_LPI2C_IP_BUSY){};
Best Regards,
Robin
I have set the debug enable bit in mcr of lpi2c and can see start condition on sda and scl lines but afterwards transmission is back to idle state and fifo tx error event or master bus arbitration error event are triggered independently or even both one by one. The waveform from the issue is in the attachment. The yellow waveform is sda and blue waveform is scl. The question is why debug enable bit is starting transmission and when the bit is disabled the transmision even not start. I have tried different i2c clock configuration even taking the values from reference manual for 100kHz standard, fast and fast plus and was not able to generate the full i2c waveform. Just after start comming back to idle.
Hi
I don't have the S32K358 development board so I can't test it. But it seems that your LPI2C Master configurations do not comply with Table 426. LPI2C Timing Parameter Restrictions of S32K3XXRM Rev.7
Try the configuration in the picture, and then test whether you can see the I2C waveform.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------