I2C problem

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

I2C problem

1,254 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nagaraj.baddi on Mon Dec 27 06:47:31 MST 2010
The problem is when i load the program(i.e i2c) in master mode it writes the data but when i read the data from slave, the values are not matching  with masterbuffer...
0 Kudos
Reply
4 Replies

1,220 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ktownsend on Thu Dec 30 08:20:03 MST 2010

Quote: Zero
And now the problem is that no one knows which program writes what data to which device in whatever buffer and reads back something somehow :confused::confused:



Ya ... I found most of the examples really helpful and I'm glad NXP is putting them out, but the I2C code really jumped out at me in a WTF kind of way :-)  I really need to write my own I2C drivers with something a bit easier to debug when you are using more than one I2C device at a time.
0 Kudos
Reply

1,220 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nagaraj.baddi on Tue Dec 28 00:27:21 MST 2010
Hi Wenzu,
        I worked on Rob65 code. but the result is still same, the content masterbuffer data and after reading the the content of slavebuffer not matched, i.e after debugging  masterbuffer[]={-96,0,U,-86,18,4} and slavebuffer[]={-1,-1,-1,-1,0,0} i am not understanding..

Thank you for replying..

-Nagaraj:confused:
0 Kudos
Reply

1,220 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wenzu on Mon Dec 27 17:04:22 MST 2010
Hi Nagaraj,

I managed to get the I2C finally working well after 4 days banging my head.( I am a total Noob to ARM and Cortex )

Here , Rob65 kindly posted a working I2C driver.
Note: I am using an LPC1343, and not an LPC11xx for which the above driver was written.

For installing it, You need to delete the present I2C from your list, and install this new one v1.10
In my case, certain devices worked, but others not. Especially on long reads after a re-start.

If using 1343, you need to replace the timing values in i2C.h with the following:

#define I2SCLH_SCLH            120 //58  /* I2C SCL Duty Cycle High Reg */
#define I2SCLL_SCLL            120 //57  /* I2C SCL Duty Cycle Low Reg */

Now.. works like a Charm.

BTW.. the data is found in I2CSlaveBuffer[0] etc etc.. and not in the Master.

Thanks for all who helped.
Best wishes for 2011.
Happy coding.

Wenzu.
0 Kudos
Reply

1,220 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Dec 27 07:23:25 MST 2010
And now the problem is that no one knows which program writes what data to which device in whatever buffer and reads back something somehow :confused::confused:
0 Kudos
Reply