Hi Ladies and Gents,
Im near enough ready to go back to Arduino having spent 3 weeks and getting really nowhere with this board other than Blinking the LED and using UART.
So I am trying to use an external I2C RTC DS3231 which i can have working in minutes on Arduino, but on this when working through the terrible example for I2C i am still unable to get anywhere as it is always stuck on I2C_STATUS_BUSY.
I can't believe how difficult this is in LPCOpen, any help would be much appreciated.
Regards
Ray
Could you guide me where to define __USE_LPCOPEN in the project definitions?
Hi Ray,
You can use the LPC1347 lpcopen I2C code, but you must modify the code to meet your I2C slave demand.
Do you test the I2C bus wave? After check the I2C wave, you will know the detail problem, you need to locate the problem at first.
Please check the I2C wave, then also reply it to me.
When the master send the I2C data to the slave, whether the I2C bus data is really the slave needed or not? Is the I2C slave the the ACK?
Anyway, check the I2C wave, compare the I2C data, check the ACK state.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Kerry,
Thank you for your reply.
I have tried using the "periph_i2c" example provided by NXP in LPCOpen. Using the example exactly as it is that also gets stuck in the loop below waiting for the status to change.
void Chip_I2C_EventHandler(I2C_ID_T id, I2C_EVENT_T event)
{
struct i2c_interface *iic = &i2c[id];
volatile I2C_STATUS_T *stat;/* Only WAIT event needs to be handled */
if (event != I2C_EVENT_WAIT) {
return;
}stat = &iic->mXfer->status;
/* Wait for the status to change */
while (*stat == I2C_STATUS_BUSY) {}
}
So i do not believe this is a good example to go by as it has problems.
Regards
Ray
Hi Ray,
Thank you for your updated information.
Give you the code bundle code for LPC1347, this I2C code will be more easy to understand, it is based on the register control directly.
You can try it, if you still have problems, please also give me your I2C bus wave, it's very important to the problem analysis.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------