PSoC4 I2C ACK and NAK | Cypress Semiconductor
PSoC4 I2C ACK and NAK
It took me more than a day to find a bug in my (yes, my!!) program, although I was already hinted to, but I've forgotten.
I took an old PSoC5 working I2C-program and adapted it to PSoC4 and I couldn't get it to work!!!
So to prevent you from falling into the same trap:
SCB_I2CMasterReadByte(acknNak) needsd an ACK for every red byte and a NAK for the last byte.
Datasheet says about acknNak: Nonzero sends ACK, zero sends NAK (as the name suggests) and reflects the same behaveour as for PSoC3 and 5.
THIS IS WRONG!
acknNak = 0 sends an ACK, otherwise a NAK.
The internally #defined SCB_I2C_ACK_DATA and SCB_I2C_NAK_DATA are correct, but not mentioned in the datasheet.
So there are two problems:
1st the documentation is wrong
2nd the module's parameter value differs from PSoC4 to other modules,
A good target fo some corrections.