LPC82x I2C Error

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

LPC82x I2C Error

1,081 Views
tiagofernandes
Contributor III

Hello,

I'm trying to use the I2C in the LPC82x but I have some troubles. I configure the micro as shown below, however when I'm trying to the the signal with osciloscope (read mode:digital signals) the signals (SDA and SCL) are always high. What I'm doing wrong?

/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
/* Connect the I2C_SDA and I2C_SCL signals to port pins(P0.10, P0.11) */
Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SDA);
Chip_SWM_EnableFixedPin(SWM_FIXED_I2C0_SCL);
/* Enable standard mode/Fast mode for I2C pins */
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO10, PIN_I2CMODE_STDFAST);
Chip_IOCON_PinSetI2CMode(LPC_IOCON, IOCON_PIO11, PIN_I2CMODE_STDFAST);

/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);

Chip_I2C_Init(LPC_I2C0);
Chip_I2C_SetClockDiv(LPC_I2C0, 2);
Chip_I2CM_SetBusSpeed(LPC_I2C0, I2C_BITRATE);      //I2C_BITRATE=100kHz
Chip_I2CM_Enable(LPC_I2C0);

After this configurations I call a function to write to a slave device. Which configurations I'm doing worng or are missing?

Best Regards,

Tiago

Labels (2)
Tags (2)
0 Kudos
4 Replies

682 Views
tiagofernandes
Contributor III

Hello,

I think I resolve the problem with the resolution that I presented in I2C on LPC810/LPC812 . Now my problem is, after send the slave address I receive always Not Ack (supposed to receive Ack because the slave is connected and that's your address). I verify the slave's address (+RW bit) and it's correct, the slave is also connected. Anyone can help me?

Best regards,

Tiago

0 Kudos

682 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Tiago,

Your configuration in the code snippets above is correct, have you tried using the I2C LPCOpen examples as base for your application? Maybe you could take a look to the periph_i2cm_polling example.

Also, have you tried using a logic analyzer to make sure the correct address is being sent?


Thanks in advance for your response!

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos

682 Views
tiagofernandes
Contributor III

Hello Carlos,

First of all thanks for the answer.
I not use the examples because they use functions of the ROM.
I think I could already solve the problem but I don't know how I do that, because I comment my code, test other part of the I2C, comment this part and uncommented the previous part and start work. Like you said I always have in my tests a logic analyzer to see the address and always its correct. 

Best Regards,

Tiago

0 Kudos

682 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Tiago,

 

Thanks for your response, is good to hear the problem was solved. Let us know if you have any other issue.

 

Best Regards!
Carlos Mendoza
Technical Support Engineer

0 Kudos