k60n512 mqx I2C demo problem

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

k60n512 mqx I2C demo problem

Jump to solution
916 Views
il_mix
Contributor II

Hi everyone.

 

I got a TWR-K60N512 a while ago and I'm making some experiments using CodeWarrior 10.2.

I'm trying to let the I2C demo working, and then modify it to work with an external device (led driver).

The base project write and read from the EEPROM, with I2C address 0x50 (defined in the eeprom.h file).

Everything compiles fine (BSPCFG_ENABLE_I2C0 and BSPCFG_ENABLE_II2C0 are both set to 1 in user_config.h, and the bsp library was recompiled with these settings).

Loaded on RAM, everything seems to work, but nothing will be written/read.

You can find the serial output attached.

 

I used an ocilloscope to analyze the SDA, SCL signals, and what I get is that:

- instead of address 0x50 I see 0xA0

- I don't get the ack from the eeprom

- the communication terminates after a long gap ( > 3 ms)

You can see a time diagram attached.

 

I tried to define the EEPROM address as 0x50 >> 1, so I see 0x50 on the SDA, but I still get no ack.

Analyzing the main board demo (accelerometer, memory game, ...), I've seen that in Accel_Task.c the accelerometer address is defined as 0x4C but on the SDA I get 0x98, that is 0x4C >> 1. So I suppose that EEPROM has I2C address 0xA0, and it's correct to define it as 0x50 (==0xA0>>1) in my program. By the way, EEPROM isn't responding... The accelerometer demo work fine, instead.

 

 

Any hint?

Thanks

MIX

 

 

P.S.: psudo-related. Is there a BOM of TWR-K60N512 board? I need to get some connectors for TWRPI pins, but I can't get the type/dimensions.

0 Kudos
1 Solution
363 Views
Mohsin455
Contributor IV

 

I dont think TWR-K60N512 has an EEPROM ?

View solution in original post

0 Kudos
5 Replies
363 Views
PetrM
Senior Contributor I

Hello,

 

the EEPROM has address 0x50 and that address must be given to the I2C driver. The address is sent over the bus in following format:

 

7 6 5 4 3 2 1 0       ACK

1 0 1 0 0 0 0 R/W 1

 

It's always shifted to the left by 1 bit and the bit0 is used as read/write flag.

What happened is correct - the application didn't get ACK over I2C, so it terminated the transfer.

EEPROMs have usually configurable I2C address, I suggest to check its corresponding pins. Maybe you don't have it connected properly or it's broken.

 

Regards,

PetrM

0 Kudos
364 Views
Mohsin455
Contributor IV

 

I dont think TWR-K60N512 has an EEPROM ?

0 Kudos
363 Views
il_mix
Contributor II

Nuts... that's exactly the problem. I supposed that the program read/write an EEPROM on board, not an external on.

My fault. That's what happens when you don't read the README file...

Once I get the TWRPI conncetors I'll try to speak with an external module and I let you know if everything is ok.

 

Thanks!

MIX

0 Kudos
363 Views
il_mix
Contributor II

Just to let everyone know, everything works fine using the demo with an external I2C device.

0 Kudos
363 Views
DavidS
NXP Employee
NXP Employee

You can get the BOM from the PWB (TWR-K60N512-PWB:smileyhappy: for the TWR-K60 at:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=TWR-K60N512&nodeId=0152106740B1ECDBC2...

 

211-78839CON 2X10 PLUG SHRD SMT 50MIL CTR 230H AU2J4,J5 SAMTECTFC-110-02-L-D-A-KActiveCON 2X10 PLUG SHRD SMT 50MIL CTR 230H AU

Hope this helps.

Regards,

David

0 Kudos