so using KSDK 1.1 and KDS 2.0.0. I also use Processor Expert for module configuration.
I was testin how well behave my code when something bad happens to the external I2C module (it's a Adafruit 10DOF) connected with a long cable.
So when I shorted SCL to ground the program just got stuck. CPU was still working but I2C communication stopped.
I2C is configured to use interrupts.
It seems that the program got stuck here (in ../SDK/platform/hal/src/i2c/fsl_i2c_hal.c)
bool I2C_HAL_WriteByteBlocking(uint32_t baseAddr, uint8_t byte)
/* Write byte into I2C data register. */
/* Wait till byte transfer complete. */
while (!BR_I2C_S_IICIF(baseAddr) ) <<<<<<<< STUCK HERE!!!!!!
/* Clear interrupt flag */
/* Return 0 if no acknowledge is detected. */
I also tried to put a timeout in the while, but then the program crashed with a failed assertion:
"assertion "BR_I2C_C1_MST(baseAddr) == 1" failed: file "../SDK/platform/hal/src/i2c/fsl_i2c_hal.c", line 253, function: I2C_HAL_SendStop"
Any ideas how to improve this? The program should be able to fucntion even if the I2C bus is not working
Thanks Best Regards
Edit: same thing happens if I short to ground the SDA line.