This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: Problem receiving string over I2C

Part Number: MSP432P401R

Hi! I'm using two MSP432 Launchpads (Rev. 2.1) to transmit/receive a string over I2C. My code is based on the driverlib examples i2c_master_rw_repeated_start. One Launchpad is master and the other is slave. I want the master to read the slave and end the reading when the string terminator is received ('\0').

My projects are attached to this message. Basically, the master sends Hello\0 and the slave responds with Hello\0. I've implemented reading using polling and interrupts and I would like to use the interrupts version.

The problem is that I have to add a delay in the slave ISR (right after it receives the command from the master) in order to correctly receive the response (although even this does not work all the time). So:

1. In polling mode:

- with delay it works OK (I would like to use interrupts instead);

- without delay, the master hangs in I2C_masterReceiveMultiByteFinish() waiting for RX interrupt.

2. In interrupt mode:

- with delay, it works OK, although when using this code inside a more complex project the master reads OK only the first time, then it reads 0x00 followed by the response (I would expect it to read only the response);

- without delay, the master reads OK only first time, then it does not read the first byte of the response (but it reads the following bytes), then it hangs when transmitting the command to the slave. If I place a breakpoint in the slave while loop (in if (rxFlag)), and if I click Run every time it is hit then it works OK all the time.

What am I doing wrong? Why is the delay necessary? How can I make the code work as intended?

i2c_test_master_rw_repeated_start-master_code_MSP_EXP432P401R_nortos_ccs.zip

i2c_test_master_rw_repeated_start-slave_code_MSP_EXP432P401R_nortos_ccs.zip

**Attention** This is a public forum