lpc1769 i2c is not working

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

lpc1769 i2c is not working

2,674 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Tue Aug 04 04:15:07 MST 2015
Hi all,

I am using LPC1769 REV C.
I have taken the I2C example code, but it is not working.
I am following the procedure given in periph_i2c/example/readme.text file provided in the example source code.
I am using lpcopen.
I have connected AT34C02 EEPROM.
After following the steps given in readme.txt, I am not able to read or write any data.
Even after writing data to device with address 0x5A, it is showing as:
Written 0 bytes of data to slave 0x5A.
If read:
Read 0 bytes of data from slave 0x5A.
Is the EEPROM inbuilt or which one should I use?


Thanks,
KalavathiPR
标签 (1)
0 项奖励
回复
13 回复数

2,502 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Mon Sep 07 01:25:30 MST 2015
Both eeproms have address 50. So my guess is that due to arbitration on the I2C bus the good old 24LC64 looses the arbitration and is no longer visible on the bus.
A0 of the AT34C02 should be pulled up with a 10K (ref. datasheet) and use address 52 
0 项奖励
回复

2,502 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Aug 09 23:57:55 MST 2015

Quote: KalavathiPR
As Option3 (Probe...) is helping to detect I2C devices. 50 is indicating the connection of AT34C02. What about 30?
Probing doesn't show any address for 24LC64(U11), How can I use this?



:quest:

So what did you connect and which I2C address has this device?

Read your I2C device datasheet and check address settings (A0-A2)...

0 项奖励
回复

2,502 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Sun Aug 09 23:39:38 MST 2015
Hi R2D2,

As Option3 (Probe...) is helping to detect I2C devices. 50 is indicating the connection of AT34C02. What about 30?
Probing doesn't show any address for 24LC64(U11), How can I use this?



Thank You...
0 项奖励
回复

2,502 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Aug 05 22:33:09 MST 2015

Quote: KalavathiPR
HOW CAN I READ FROM E2PROM AT34C02?



Obviously you have no clue about reading / writing I2C EEPROMs  :O

So start reading the datasheet of your EEPROM  ;-)

Basics:

This sample is able to perform simple I2C command.

Option3 (Probe...) is helping you to detect I2C devices.

In your case:

If you have connected an I2C EEPROM (grounded A0-A2, I2C0) it should be detected as 0x50:

Quote:

    00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

====================================================

00                           -- -- -- -- -- -- -- --

01   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

02   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

03   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

04   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

05   50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

06   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

07   -- -- -- -- -- -- -- -- --    




[color=#f00]Following the description in EEPROM datasheet an EEPROM WRITE sequence is:
1. Write 2 byte EEPROM Start Address
2. Write Data
[/color]
In your case:

Writing 2 bytes (0x11,0x22), starting with address 0x0008...


Quote:
Select an option [0 - 6] :5
5

Enter 7-Bit Slave address : 0x50
0x50

Enter number of bytes to write : 4
4

1:Enter Data: 0
0

2:Enter Data: 8
8

3:Enter Data: 0x11
0x11

4:Enter Data: 0x22
0x22

Written 4 bytes of data to slave 0x50.



[color=#f00]Following the description in EEPROM datasheet an EEPROM READ sequence is:
1. Write 2 byte EEPROM Start Address 
2. Read Data[/color]

In your case:

Reading 2 bytes, starting with address 0x0008...


Quote:

Select an option [0 - 6] :6
6

Enter 7-Bit Slave address : 0x50
0x50

Enter number of bytes to read : 2
2

Enter number of bytes to write : 2
2

1:Enter Data: 0
0

2:Enter Data: 8
8

Master transfer : SUCCESS

Received 2 bytes from slave 0x50

00:  11 22




0 项奖励
回复

2,501 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Wed Aug 05 21:52:51 MST 2015
Hi R2D2,

If I use the onboard E2PROM AT34C02 without connecting external E2PROM then probing devices doesn't show any device address as in 24LC64.txt file. What does it mean? Why can't I use this E2PROM? How can I use this E2PROM?

After connecting AT34C02 and selecting 3rd option, I see 2 addresses i.e., 30 and 50 in the log file 24LC64.txt, . Does it mean 0x50 is for E2PROM and 0x30 for IO Extension slave device? How to use IO Extension device using this example?
As seen in the log file-24LC64.txt, I am able to write to the E2PROM slave device with the change of address from 0x5A to 0x50.
But I am not able to read. I wrote 5 bytes of data to E2PROM. Then
1: I read 5 bytes,
2: I read 64 bytes,
3: I read 32 bytes,
4: I changed 0x50(to write) to 0x51( to read). i.e., I wrote to 0x50 and read from 0x51.
But all the above 4 options didn't work( Result in AT34C02.txt)


HOW CAN I READ FROM E2PROM AT34C02?
HOW CAN I WRITE AND READ FROM E2PROM 24LC64(U11)?
HOW TO USE IO EXTENSION DEVICE?
PLEASE HELP ME!

0 项奖励
回复

2,501 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Aug 05 03:08:54 MST 2015
:quest:

As already asked yesterday, this log is showing device 0x50, so your device is connected and working...

As you can read in the datasheet of your EEPROM the upper 4 bits of the device address are “1010”...

With grounding A0-A2 you should get a 7bit I2C address of 0b0101 0000 = 0x50  :O

0 项奖励
回复

2,501 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Wed Aug 05 03:04:45 MST 2015
Hi mc,

1. I have connected AT34C02's A0, A1 and A2 to Gnd. But, didn't work.
2. The on-board's E2PROM 24LC64's A0, A1 and A2 are already connected to 0 or Gnd. Any other connections required to make it work?
0 项奖励
回复

2,501 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Wed Aug 05 02:59:14 MST 2015
Hi dariush_abbasi868,

main() starts from line number 391 of the application file i2c.c.
If I want to check with the E2PROM which is on the LPC1769 board, how should I make the connections to the 24LC64(U11).
As per the schematics of LPC1769 the SDA and SCL lines of E2PROM are already connected to PAD17 and PAD18 of LPC1769.
A0, A1 and A2 are connected to GND or 0. With this also, I am not able to write and read any data.
Which are the LEDs glowing using IO Extension device? Should I connect any external LEDs? If so, how?
If I use external E2PROM i.e., AT34C02 or on board E2PROM i.e., 24LC64, the result is same as that of i2clog.txt
0 项奖励
回复

2,501 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 04 23:58:31 MST 2015
Hi  KalavathiPR

Please attach the part of your main file (maybe in main) that you do this sequence  .
I mean in readme.txt you have to follow something , How you did it ?

0 项奖励
回复

2,500 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KalavathiPR on Tue Aug 04 20:45:21 MST 2015
Hi All,

Where should I connect A0, A1 & A2 of AT34C02 EEPROM to the LPC1769 board? (i.e., to which pins on LPC1769?)
I have connected pin no 8 of AT34C02 to J6.28 of LPC1769 (Vcc),
                            pin no 4 of AT34C02 to J6.54 of LPC1769(Gnd),
                            pin no 5 of AT34C02 to J6.25 of LPC1769(SDA),
                            pin no 6 of AT34C02 to J6.26 of LPC1769(SCL),
                            2 pull up resistors of 10k ohms from pin no 5 and 6 of AT34C02 to Vcc.
How to do hardware connections for IO Expansion?
I have changed only 2 lines from board.c file from the example source code, which is as follows:
#if 0
Chip_IOCON_PinMux(LPC_IOCON, 0, 19, IOCON_MODE_INACT, IOCON_FUNC2);
                Chip_IOCON_PinMux(LPC_IOCON, 0, 20, IOCON_MODE_INACT, IOCON_FUNC2);
#endif
                Chip_IOCON_PinMux(LPC_IOCON, 0, 19, IOCON_MODE_INACT, IOCON_FUNC3);
                Chip_IOCON_PinMux(LPC_IOCON, 0, 20, IOCON_MODE_INACT, IOCON_FUNC3);

How to make it work?


Thanks,
KalavathiPR

0 项奖励
回复

2,500 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Aug 04 11:18:22 MST 2015
Hi KalavathiPR,
Where are you connecting A0,A1 and A2 pins? The i2c slave address also depends on these pins.
0 项奖励
回复

2,500 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dariush_abbasi868 on Tue Aug 04 04:57:18 MST 2015
I have taken the I2C example code, but it is not working.
I am following the procedure given in periph_i2c/example/readme.text file provided in the example source code. 

I can't find it.
copy your code here to see.
0 项奖励
回复

2,500 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue Aug 04 04:47:05 MST 2015

Quote: KalavathiPR
I have connected AT34C02 EEPROM.



:quest:

And option:

3: Probe for Slave devices

is showing it ?
0 项奖励
回复