lpc1769 i2c drivers

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

lpc1769 i2c drivers

1,195 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 04:17:04 MST 2011
Hi,

I'm using LPC1769 and I'm trying to set communication between two LPC1769 boards as one is mater and one is slave. However, i2c drivers in examples are just for master device.

And I tried also cmsis library drivers for i2s but these drivers are so complicated.

Are there any easy to use i2c driver which includes complete operations of both master and slave.

Best Regards,

Furkan
0 Kudos
15 Replies

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bob_walker on Wed Jan 20 12:28:35 MST 2016
I believe the 'fully spec compliant' note refers to the 5V capable pins. Initially, the I2C spec was for 5V open drain buses. Nowadays, we are using lower voltage (2V5, 3V3) processors. The issue is with the protection diodes on the I/O port lines - they will be clamped to GND and the VCC of the chip to provide under/over-voltage limiting. That means that, for a chip running off of 3.3V and utilizing a 5V I2C bus, I/O's without the clamp diodes (fully spec compliant),will swing the full 5V. The non compliant drivers will clamp the I2C bus to 3.3V+Vfd, limiting the 5V swing. I'm *guessing* that the fully spec compliant I/Os are truly open drain devices with no protection diodes. So you're safe using I2C on the non-compliant buses. However, do not exceed your micro's VCC. I use 3.3V I2C buses all over the place....no problems.
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Fri Jul 08 06:30:35 MST 2011
Oops:eek:,

Until today i never used more than one I2C interface so ...
But i will remember now if i ever need more than one I2C interface.:p
Anyway it souds weard to me too (I am 52 years old and thus also a bit ol'school) and like you i would never think of using internal pullups. They are just way too important.

Thanks Zero.
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Jul 08 01:13:57 MST 2011
@Serge:


Quote:
...did i misread the UM...

No, you didn't misread the manual :) You're reading the wrong chapter :mad:

Chapter 19 describes I2C and also that only I2C[COLOR=Red]0[/COLOR] is 'fully spec compliant'. So the other two I2C can really use internal pullups. That, of course, sounds a little bit strange for 'old dogs' (like me) and so I never use them....
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Fri Jul 08 00:36:03 MST 2011
Ok, it works now =) I did not know that these pullup resistors are that important.
Thank you Zero, you saved me from spending much more time with this mistake=)
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Thu Jul 07 23:52:24 MST 2011
Zero, did i misread the UM once more? I thought that the I2C standard said that the used pins should be open drain to allow for multiple masters and that an external pull-up resistor is mandatory (I also use 10K for short connections which is working fine)?
Chapter 9.4 of the LPC1769 user manual says:

Quote:
Some pins may be limited by requirements of the alternate functions of
the pin. For example, the pins containing the I2C0 functions are
open-drain for any function selected on that pin. Details may be found
in Section 7.1.1.


So why thinking of using internal pull-ups when there are none?
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jul 07 08:14:36 MST 2011
I'm always using external pullups, because internals are too weak.

I'm using 10k :) without problems. But everything between 1k and 10k should work.

How to calculate the correct value you can read in Chapter 17.2 of  'I2C-BUS SPECIFICATION'
[FONT=GillSans,Bold][SIZE=4]
[/SIZE][/FONT]http://www.nxp.com/acrobat_download2...8/39340011.pdf
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 07:59:44 MST 2011
yes I'm using ope drain for both master and slave bu I did not aware I need to pullup :-S

will it be enough to set pins of one of them as pullup for configuration. Or do I need external pullup resistors ?
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jul 07 07:55:04 MST 2011
Sorry, can't follow you :confused:

Are you using open drain at master and slave ?

What does your scope show ?

Are you aware that you need a pullup somewhere like 'Fig 84. I2C-bus configuration' in user manual ?
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 07:48:45 MST 2011
no I left them open drain. I did not change the initializations but the slave adr0 on the slave side.
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jul 07 07:37:40 MST 2011
I2C1Init sets open drain, so did you change that :confused:

  LPC_PINCON->PINMODE0 |= ((0x2<<0)|(0x2<<2));        /* No pull-up no pull-down */
  LPC_PINCON->PINMODE_OD0 |= ((0x01<<0)|(0x1<<1));    /* [COLOR=Red]Open drain[/COLOR] */    
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 07:28:47 MST 2011
No I didn't add/set pull-up.

I'm checking my master constantly and I'm taking irregular status information mostly "0x08 & 0x20" and additionally "0x00,0x10,0x30".

and my slave is sometimes get in irq and shows its status as 0x60, 0x80, 0xA0.

It seems there is no connecton between them cos all status are related with not ack.
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jul 07 07:13:04 MST 2011
Did you add pullups ?

Did you scope your master ?
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 06:44:38 MST 2011
I still could not make my devices communicate :(

I'm using master i2c drivers for my first device and using the code below :

I2C1Init( );            /* initialize I2c1 */

I2CWriteLength[1] = 2;
I2CReadLength[1] = 0;
I2CMasterBuffer[1][0] = 0x14;          /* audio çipinin write adresi */
I2CMasterBuffer[1][1] = 99;        /* Register de&#287;erinin MSB'&#305; */
I2CEngine( 1 );

And for the slave device I'm using i2c slave driver and setting LPC_I2C->ADR0=0x14;

However, I'm not able to get communication between them. my slave device didn't evet get in irqhandler.

What am I doing wrong here? what should I do for having basic communication?
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by furkan.yuksel on Thu Jul 07 05:03:58 MST 2011
Ohh thanks, I didn't see that example, I must have been focused on just existence of i2c example:-S
0 Kudos

977 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Jul 07 04:55:58 MST 2011
Isn't there a slave sample in NXP_LPCXpresso1769_MCB1700_2011-02-11.zip ?
0 Kudos