LPCXpresso LPC1347 I2C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPCXpresso LPC1347 I2C

2,279 Views
rayroutledge
Contributor I

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

Labels (3)
6 Replies

1,832 Views
Magnetron
Contributor III

I was have the same problem.

The problem was in missing __USE_LPCOPEN define i project definitions.

0 Kudos

1,832 Views
rocketbot27
Contributor I

Could you guide me where to define __USE_LPCOPEN in the project definitions?

0 Kudos

1,832 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Madhukar Arora

 If you have any issues, you can create your own question post, then the LPC engineer will help you directly in your own question post.

Best Regards,

Kerry

0 Kudos

1,832 Views
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,832 Views
rayroutledge
Contributor I

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

0 Kudos

1,830 Views
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos