I've started working on a project with the LPC824 where it will act as an I2C slave. I have decided to have a go at using the I2C ROM drivers in the hope that this might speed up the development process and save me a bit of code space. So far I have managed to get the I2C ROM driver working fine for slave writes (R/W bit = 0 in address byte) in both polling and interrupt mode, however I can't get it to work properly for slave reads (R/W bit = 1 in address byte) in either polling or interrupt mode. When I send a slave read to the LPC824 it always responds with a NACK.
I have set a breakpoint in the I2C interrupt and when I send a slave read to the LPC824 I can see that the I2C peripheral has received the address byte since it hits the interrupt and the I2C slave data register shows the address byte correctly. However, after stepping past the i2c_isr_handler() ROM function I can see that the slave control register for the I2C peripheral is flagged to send a NACK. So it seems like the I2C ROM driver is actively refusing slave reads. Also when I send a slave read my I2C callback function is never called so I can't check the error code from the I2C ROM driver.
Does the I2C ROM driver not support slave reads? What could I be doing wrong that would cause slave writes to work fine but not slave reads? I can't seem to find any documentation or examples that would help with this. If I can't find a solution to this soon I'll have to start working with the I2C peripherals directly.