Debug I2C

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

Debug I2C

1,331 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by l3fos on Thu May 17 08:03:49 MST 2012
Hi folks,

it is my first time trying to work with this architecture and the LPCXpresso environment. I used to work with a more classical Code Warrior and the Freescale µCs. Long story short, I am trying to us an LPC11C24 to read a CAN interface and send the signal values to an eDIP 160 using the I2C interface. Sadly I do not have an oscilloscope or logic analyzer handy right now so I am hoping some of you out there who have experience with using the serial interrupts on these boards can help me. I started out simply just modifying the I2C example to see if I can communicate with the display at all. The display uses its own "small" protocoll which an be found here:
http://www.lcd-module.de/fileadmin/eng/pdf/grafik/edip160-7e.pdf

I changed the source code as follows:
/* Write SLA(W), address and one data byte */
  I2CWriteLength = 7;
  I2CReadLength = 0;
  I2CMasterBuffer[0] = 0x00;/* address */
  bcc = 0;
  I2CMasterBuffer[1]=0x11; //DC1
  I2CMasterBuffer[2]=0x03; //length
  I2CMasterBuffer[3]=0x1B; //ESC
  I2CMasterBuffer[4]=0x44; //D
  I2CMasterBuffer[5]=0x4C; //L
  bcc = 0xBF;
  I2CMasterBuffer[6]=bcc;
  I2CEngine();

which should simply clear the screen for me. The dev board of the display has indicator LEDs for the I2C communication so I know that something is being sent on the bus. I set a break point in the debugger right before the I2CEngine() command to see what the Buffer variable looked like, and it seems strange.
When I hover over the variable i get:
I2CMasterBuffer="\000\021\003\033DL\277"
I see that it changes hex to oct apparently for debugging, but what is up with the D and the L. Is that correct? I cannot for the life of me figure out why the display isn't accepting my commands. I never had these problems using SPI on the freescales, maybe I should try SPI here, but I figured if any of you have any insights of what I might be doing wrong, I might as well learn something new =)

Thanks in advance for your help.

Cheers,

L3FOS
0 Kudos
Reply
2 Replies

1,301 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by l3fos on Thu May 17 09:08:23 MST 2012
Hi Fred,

I actually had the pins set so the slave was at 0x10, but that was the mistake, I guess I was just looking at the wrong line. Thank you for the quick response, it always helps to have a second set of eyes =)

Cheers,

L3FOS
0 Kudos
Reply

1,301 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Superfred on Thu May 17 08:53:22 MST 2012
Hi l3fos,

I found one problem:
In your code you set the I2C slave address to 0x00(I2CMasterBuffer[0]).
The eDIP 160 I2C address depends on the BA and SA pins, and 00 is invalid, check datasheet page 7.
If all pins are open, 0xDE is the correct address

Fred
0 Kudos
Reply