Hi,
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.
Thanks,
Donald
Well I decided to have a go at interfacing with the I2C peripheral directly and ended up just writing my own driver as it turned out to not be that difficult for what I am trying to achieve. It would still be interesting to know why the original problem that I was having occurred but I don't need to find an answer urgently anymore as I'm not going to be using the ROM I2C driver for now.
Donald
Hi,
Another option is using MCUXpresso SDK for the LPC8xx series, I would recommend you look at that option. LPCOpen is a good driver package, but NXP is focusing on MCUXpresso SDK for future development.
You can download it from the following link:
https://mcuxpresso.nxp.com/en/builder
Have a nice day!
Regards
Soledad
Hi,
You can use the LPCOpen examples for reference.
You can download LPCOpen from the following link:
LPCOpen Software for LPC8XX | NXP
I hope this helps, have a nice day!
Regards
Soledad
Hi Soledad,
Thanks for your reply. That LPCOpen example is actually the main example that I have been using all along. I have already looked through it several times to see if I have missed anything but I can't work it out. As I said it works fine for a write from the master to the slave but not for a read from the master to the slave.
Regards,
Donald