Is there some interaction between semihost and the i2c bus?
If I run the evkmimxrt1020_lpi2c_interrupt demo out of the box, it works fine.
If I add a PRINTF after the first call to LPI2C_MasterStart in main(), it still works fine and the message is printed to the UART ok.
/* Master start and send address to slave. */
reVal = LPI2C_MasterStart(EXAMPLE_LPI2C_MASTER_BASEADDR, LPI2C_MASTER_SLAVE_ADDR_7BIT, kLPI2C_Write);
if (reVal != kStatus_Success)
PRINTF("THIS CAUSES DEMO TO HANG IN SEMIHOST MODE"); // Line 266
However if I convert the demo to be semihost (so the output goes to the MCUXpresso console window), this PRINTF is printed ok, but causes the demo to hang in the next while loop.
The changes I made to convert it to semihost:
The demo justs sits in the following while loop:
/* Wait slave receive finished. */
while (g_slaveRxIndex < LPI2C_DATA_LENGTH)
The variable g_slaveRxIndex is never incremented, stays at 0.
Why is this please?
And how can I fix it?