Part Number: MSP430FR5964
Dear Sir/Madam,
I am currently testing the UsciB in I2C mode, it seems that the peripheral does not behave as described in the manual.
Nor as described by others in this thread:
I deliberately used the wrong address to test how the peripheral would respond.
As can be seen there is no ack on the 9th clock pulse, just some minor cross talk:
Looking at the code, it looks like this:
static bool i2cUsciB_startTransmit(I2cUsciBHardwareRegisters_t* pHardwareRegisters, uint8_t slaveAddress)
{
pHardwareRegisters->InterruptFlags = 0;
pHardwareRegisters->SlaveAddress = slaveAddress;
pHardwareRegisters->ControlWord0 |= UCTR_1; /* Transmitter mode */
pHardwareRegisters->ControlWord0 |= UCTXSTT_1; /* Generate START condition */
// Wait for the start condition to disappear
while (pHardwareRegisters->ControlWord0 & UCTXSTT_1)
{
}
uint16_t interruptFlags = pHardwareRegisters->InterruptFlags;
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WORKAROUND
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
uint16_t interruptFlagsFirstPass = interruptFlags;
// If a slave has acknowledged UCNACKIFG_1 would be low
for (int i = 0 ; i < 4 ; i++)
{
interruptFlags = pHardwareRegisters->InterruptFlags;
}
return (interruptFlags & UCNACKIFG_1) == 0;
}
The yellow area was added to debug what I have noticed...
According to the manual, at least my interpretation of it, the UCNACKIFG should be high directly after UCTXSTT has gone low:
However when running the code I see that interruptFlagsFirstPass has the value 0x0002 and interruptFlags gets the value 0x0022 after going through the loop (at least) 4 times....
The NACK signal seems to be delayed...
I would prefer to solve this without using the loop, since I don't like the dependency between the speed of the cpu and the speed of the peripheral...
Hope that someone can help me further.
Thanks in advance,
Best regards,
Martin


