EEPROM not working on LPC1788

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

EEPROM not working on LPC1788

3,206 次查看
ankitvats
Contributor I

hi 

I have three peripheral on THREE different I2C0, I2C1,I2C2.

One EEPROM is connected to IC21 and another one on i2C2 with same chip number and Slave address.

Same API are used . but for I2C2 EEPROM " Write/Read Api " get stuck but I2C1 EEPROM works fine ??

0 项奖励
回复
9 回复数

3,136 次查看
ankitvats
Contributor I

Clock is not comming on SCL pin .

0 项奖励
回复

3,190 次查看
frank_m
Senior Contributor III

> Same API are used . but for I2C2 EEPROM " Write/Read Api " get stuck but I2C1 EEPROM works fine ??

Impossible to see from your short description.

Take a scope and check the waveform.

> One EEPROM is connected to IC21 and another one on i2C2 with same chip number and Slave address.

Most I2C EEPROMs have address pins. For <n> address pins, you can operate 2^n such EEPROM devices on the same bus, provided you set their address pins correctly.

Which would be a much more economic solution than separate busses.

0 项奖励
回复

3,184 次查看
ankitvats
Contributor I

Now , Read/Write api for i2c2 EEPROM not getting stuck by Enable Interrupt "I2C2_IRQn".

but the I2CRegRead()  / I2CWrite() api return Status is 1 . that mean unable to transmit / receive the data?

what to do next?

Debug are print on  this refrence::

* Any of #I2C_STATUS_T values, xfer->txSz will have number of bytes
* not sent due to error, xfer->rxSz will have the number of bytes yet
* to be received.

screenshot of Read Api output

read_eeprom.JPG

 screenshot of Write Api output

write_eeprom.JPG

 

0 项奖励
回复

3,178 次查看
frank_m
Senior Contributor III

And what do you see on the bus ?

0 项奖励
回复

3,125 次查看
ankitvats
Contributor I

No transition on SDA and SCL line. 

but I able to toggle  SDA and SCL pin mux as Gpio.

What to do next ??

toggleI2C.JPG

 Toggling the pin.

 

and this for I2c muxed

I2Cpin_mux.JPG

 

0 项奖励
回复

3,120 次查看
frank_m
Senior Contributor III

I don't have a LPC1788 to try anything.

Did you check the pin initialisation code for the I2C1 and I2C2 pins is correct, and consistent with the datasheet/manual ?

Did you enable the clock to the I2C1 and I2C2 peripherals ?

0 项奖励
回复

3,091 次查看
ankitvats
Contributor I

>>Yes , I check the Pins and Consistent with dataSheet.

I notice One thing That I2C2 is a peripheral of "APB 1 peripheral group"

Is there is Dependance to use these peripherals .??

 >> this function is used to enable clock for ALL 3 i2c.

STATIC INLINE void enableClk(I2C_ID_T id)
{
Chip_Clock_EnablePeriphClock(i2c[id].clk);
}

0 项奖励
回复

3,083 次查看
frank_m
Senior Contributor III

> I notice One thing That I2C2 is a peripheral of "APB 1 peripheral group"

> Is there is Dependance to use these peripherals .??

Usually, each peripheral bus has it's own RCC register to enable/disable the clock to attached peripherals. And, each bus has it's own clock setup.

As said, I do not have a LPC1788. 

> Chip_Clock_EnablePeriphClock(i2c[id].clk);

I would check if this routine does enable the proper SYSCON flags, comparing with the MCU datasheet.

By the way, I would recommend to spend some time studying the datasheet in general.

Almost all IO pins in MCUs are multiplexed. You need not only to configure the GPIO pin and select the appropriate function, but also enable and configure the peripheral unit, which is I2C2 in your case. 

This is highly specific for the vendor and the MCU family. I had dealt with a PLC546xx, were I2C functionality is provided by the Flexcomm peripherals.

 

0 项奖励
回复

3,029 次查看
ankitvats
Contributor I

Hi 

 Peripheral EEPROM on I2c 2 bus is working Now.

Enable the peripheral Clock by Adding clk Selection register   "LPC_SYSCTL->PCLKSEL2 |= (1 << 20);" in the API  "Chip_Clock_EnablePeriphClock(i2c[id].clk);"

 Note :- __IO uint32_t PCLKSEL2;    /*!< Offset: 0x1AC (R/W) Peripheral Clock Selection Register2 */

 according  to manual.

0 项奖励
回复