Hi MSP Team,
I am using the MSPM0G launch pad as a peripheral I2C device. I want the M0 to send a NACK when the controller device reads/writes an "out of bounds" register address. Below is the timing structure for a read operation sent to the M0.
The register address, sent by the controller, can be any value, but the M0 must parse whether that value is a valid address, and send an ACK or NACK. I think the only way to achieve this is enabling TargetACKOverride.
Because this condition is rare, I only want to enable the override, when the address is invalid. I am doing this with the following code:
DL_I2C_enableTargetACKOverride(I2C_target_INST); //Override ACK
DL_I2C_setTargetACKOverrideValue(I2C_target_INST, DL_I2C_TARGET_RESPONSE_OVERRIDE_VALUE_NACK); // set the ACK value to 0 (NACK)
DL_I2C_disableTargetACKOverride(I2C_target_INST);
However, when I implement this, the bus line hangs.
Below is an the Controller writing valid Reg Address 0x00 and then reading 1 bytes:
However, reading an invalid address, such as 0x21 causes still sends an ACK, but causes the bus line to hang low forever.
Then, the bus line continuously hangs low and the M0 must be power cycled.
Is there a preferred way to implement manual ACK/NACK, or is there any example code?
Thanks!