Cannot Compile any I2C for LPC1112/102

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

Cannot Compile any I2C for LPC1112/102

899 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 03:57:22 MST 2015
Hello, I am trying to port my code from LPCxpresso 4.x to the most recent 7.x. for MCPU LPC1112/102, and I am getting errors that make no sense to me.


I found the post here and followed instructions to install the missing header files for LPC11xx

I have enabled the #define CHIP_LPC110X (and disabled the rest and also undefined the define BOARD_NXP_XPRESSO_11C24) and enabled Chip_SystemInit();

Most of the examples compile,
Most of my code compiles, using various LCopen libraries .. UART, SPP, GPIO etc but NOT the i2c example or code.

I just don,t get it ....

If I compile the example peripheral I2C, error as follows :-

#define DEFAULT_I2C             I2CO


!!!error reported by little red cross is
Quote:
"I2C0" undeclared here (not in a function)



Its a #define how is the example code in error ....

In my code I have ......

NVIC_EnableIRQ(TIMER_32_0_IRQN);
NVIC_EnableIRQ(IC20_IRQN);


before compile the parameters are in blue italic ...  hovering over the 1st I get the number 18, over the second I get the number 15.

after compile, the error reported for the second line is
Quote:
"Multiple markers at this line
- each undeclared identifier is reported only once for each function it
appears in"



and hovering over the STILL blue IC20_IRQN says 'I2C0_IRQn' undeclared (first use in this function) despite the editor reporting its value as 15 a moment before.

I tried looking for the declarations for those parameters and eventually I found ..  RESERVED15_IRQn = 15 in cmsis110x.h !


Questions...
1) Why is there NO I2C0_IRQn in the enumeration ...  it is in my OLD Xpresso v4.0 LPC111c.h ...  The peripheral is usable ? or not ?
2) Why does the example code fall over on a simple define .... #define DEFAULT_I2C             I2CO

3) All the I2C example code is greyed by lines like
#if !defined(CHIP_LPC110X)
Does this mean that NONE of the LCOPEN example code may be used for LPC1112, or that LPC1112 I2C should not be used ?

Thank you for your considerations, and assistances,
Dave









Labels (1)
0 Kudos
12 Replies

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 09:05:01 MST 2015
Thank you R2D2.

Yes, I get a better result.

How would I know logically to use LPC11CXX, I don't have CAN bus ......
Dave.
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 08:59:34 MST 2015

Quote: Lumen
Which chip define SHOULD I be using ??



[color=#f00]CHIP_LPC11CXX[/color]
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 08:53:27 MST 2015
I have a LPC1112FDN33/102

Which chip define SHOULD I be using ??

Thank you,
Dave
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 08:51:53 MST 2015

Quote: Lumen
Which chip define SHOULD be be using ??



#define CHIP_LPC11CXX

0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 08:49:27 MST 2015
I have a LPC1112FDN33/102

Which chip define SHOULD be be using ??

Thank you,
Dave
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 08:30:15 MST 2015

Quote: Lumen
I am doing exactly that.. 



Nope...

That's the original file:


Quote:
#ifndef __SYS_CONFIG_H_
#define __SYS_CONFIG_H_

/* Pick only one. Build for LPC11CXX family */
// #define CHIP_LPC110X
// #define CHIP_LPC11XXLV
// #define CHIP_LPC1125
// #define CHIP_LPC11AXX
[color=#f00]#define CHIP_LPC11CXX[/color]
// #define CHIP_LPC11EXX
// #define CHIP_LPC11UXX

#endif /* __SYS_CONFIG_H_ */

0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 08:20:24 MST 2015
Thank you. I am doing exactly that..  


Quote:
Just change the cpu



Yes the cpu is set as LPC1112/102 as I can see in the BLUE test bottom right of IDE

so the other place to set a CPU is in sys_config.h

#ifndef __SYS_CONFIG_H_
#define __SYS_CONFIG_H_

/* Pick only one. Build for LPC11CXX family */
define CHIP_LPC110X
// #define CHIP_LPC11XXLV
// #define CHIP_LPC1125
// #define CHIP_LPC11AXX
//#define CHIP_LPC11CXX
// #define CHIP_LPC11EXX
// #define CHIP_LPC11UXX

#endif /* __SYS_CONFIG_H_ */

I still get error: unknown type name 'I2C_ID_T' which I expect cos I am using the incorrect CHIP define for the I2Cxx.h headers ....

WHICH CHIP define should I use ?

The CHIP is labelled LPC1112F   102   there is no A,C or U between the LPC11 and the 12 ?

Thank you.
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 07:59:58 MST 2015

Quote: Lumen
The UM indicates I2C is present.



Good news  :)

I'm not sure how LPC1112 I2C differs from LPC1114 I2C, so I would use the original LPC11C24 I2C sample (including Board library) and just change the MCU...
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 07:41:00 MST 2015
Thank you R2D2,
I am using a LPC1112FHN33/102. The UM indicates I2C is present. So I must have the incorrect CHIP define :-(

Which CHIP define should I be using ???

Dave.
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 07:18:45 MST 2015

Quote: Lumen
Yes, But does that mean this code cannot, OR should not be used ?



:D

AFAIK there's no I2C in LPC110X  :O

So which MCU are you trying to use and what's happening if you use this LPCOpen library  :quest: 
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Lumen on Sun Jun 21 07:07:25 MST 2015
Yes, But does that mean this code cannot, OR should not be used ? or that the peripheral cannot be used ?
ie am I expected to implement the full I2C myself  ?

Please be plain as the I2C functions are all available in LPCxpresso 4.x

Thank you
Dave
0 Kudos

863 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Jun 21 04:32:38 MST 2015

Quote: Lumen

I have enabled the #define CHIP_LPC110X
...

I just don,t get it ....





i2c_11xx.h:

/** @defgroup I2C_11XX CHIP: LPC11xx I2C driver
 * @ingroup CHIP_11XX_Drivers
 * @{
 */

#if [color=#f00]!defined(CHIP_LPC110X)[/color]
....
0 Kudos