Hello team,
Mobis is using the LPI2C module as a slave mode, and recently faced an I2C fault during the vehicle test. So they asked how to re-initialize the LPI2C module only in this failing case. Please let me know if the sequence below is enough or it needs further sequence.
1. Execute the LPI2C_DRV_SlaveDeinit() function
2. After then, execute the LPI2C_DRV_SlaveInit() function.
Can all error flags be cleared by those sequence?
Please let me know if you have another solution to clear the error and to recover from the LPI2C error state.
Best regards,
James
Solved! Go to Solution.
Hello James,
It depends on what the error is.
Because the bus can be kept low by another device on the bus.
But if the issue is in the S32K146 LPI2C module, the procedure you described clears it.
Because the LPI2C_DRV_SlaveInit() function calls LPI2C_Init() that resets the LPI2C logic.
Regards,
Daniel
Hello James,
It depends on what the error is.
Because the bus can be kept low by another device on the bus.
But if the issue is in the S32K146 LPI2C module, the procedure you described clears it.
Because the LPI2C_DRV_SlaveInit() function calls LPI2C_Init() that resets the LPI2C logic.
Regards,
Daniel
Hi Daniel,
Thank you for your answer.
May I ask one more thing? In the S32SDK S32K146 user manual, I found the description below at the page 648.
Would you please explain the reason of description marked as yellow? Because the LPI2C_DRV_SlaveInit() function can be executed during the transfer from the master in customer's application, they requested us to make sure it.
Best regards,
James
Hi James,
Without the init function the LPI2C module can't be used.
It is the customer responsibility to make sure the module is initialized before the master starts the transfer.
Best regards,
Daniel
Hi Daniel,
If the I2C slave init function is executed during the master transfer, the S32K146 would receive the frame from a middle of it. So customer plans to clear the interrupt flags for the 1st frame after the slave init function. Do you think it can be a solution?
If not, please let me know what they need to do further.
Best regards,
James
Hi James,
This is really application-dependent.
If they can lose the first transfer, then, I guess it can be done like that.
Or they can either delay the master or somehow notify the master that the slave is initialized and ready to receive the transfer.
Best regards,
Daniel