Part Number: MSP430I2041
Tool/software:
To migrate from UART to I2C, changes were made to code generated by EMDC as outlined in this thread:
The issue is that sometimes, the I2C master transactions work fine and other times, the slave device issues NAK. It can happen anywhere - on the address byte itself, or midway into a master write, or even anywhere in a master read phase.
Example of successful I2C Master Read transaction with command 0x04 to read the "mode" of the HMI state machine is in waveform below.

Example of failed I2C master read transaction for command 0x04 to read the HMI state is in the waveform below.

When same read command 0x04 is issued in a loop, then the I2C slave give NAK for 15 read/write transactions, and then works for four read/write transactions. And this pattern continues consistently, for as long as the master issues the I2C commands. In this test, there is no signal given on SD24 interfaces, which are configured in EMDC generated code to measure a single phase (one voltage, one current channel).

The double bars in the waveform above are shown with more detail in the waveform below.

Each 0x04 write command has 0x0A, 0x55, 0xAA, 0x06, 0x04, 0x01, 0x00, 0x00, 0x05, 0x00 on I2C sent by master. For read, master sends 0x0A (I2C address + Read) followed by enough SCL cycles to read 15 bytes from I2C slave.
Can you please help understand what could cause the NAKs generated by the MSP430I2041 I2C slave on the I2C bus?
Some possibilities that are likely:
1. I2C (eUSCI-B) is disabled when I2041 is busy with other things. And the I2C / eUSCI is just telling master it can't be served.
2. Some tight loop in EMDC code takes too long and I2C is disabled during that busy time.
3. Interrupts are not configured right..
There is little to no change made to EMDC output - only changes are as outlined in the other E2E thread referred to above. Please see if you can offer any insights.