EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2124 help needed

Started by MAYURESH M March 31, 2010
Hello all.
I am working with microcontroller board based on LPC2124. To test the board i made a test code using KEIL uVision 3 and programmed the board using RS232 and flash magic. The prgramming process is completed but the code doesn't run.

Here is the code and the basic overview of the schematic.

#include
int main()
{
IO0DIR = 0x00000000;
while(1)
{
IO0CLR = 0x00000000;
}
}

I have LEDs connected to p0.8,p0.10 and p0.11 of the LPC2124 in common anode connection. That is when these pins would go low, only then the LEDs will turn ON. So i wrote this program to see if all these LEDs glow on reset. I have written another code but configured those 3 pins as outputs. Below is the code.

#include
int main()
{
IO0DIR = 0x00000D00;
while(1)
{
IO0CLR = 0x00000000;
}
}

Both codes worked when simulated on KEIL. but they dont work when programmed into the controller. Please help me out!

Regards
Mayuresh M

An Engineer's Guide to the LPC2100 Series

--- In l..., "MAYURESH M" wrote:
>
> Hello all.
> I am working with microcontroller board based on LPC2124. To test the board i made a test code using KEIL uVision 3 and programmed the board using RS232 and flash magic. The prgramming process is completed but the code doesn't run.
>
> Here is the code and the basic overview of the schematic.
>
> #include
> int main()
> {
> IO0DIR = 0x00000000;
> while(1)
> {
> IO0CLR = 0x00000000;
> }
> }
>
> I have LEDs connected to p0.8,p0.10 and p0.11 of the LPC2124 in common anode connection. That is when these pins would go low, only then the LEDs will turn ON. So i wrote this program to see if all these LEDs glow on reset. I have written another code but configured those 3 pins as outputs. Below is the code.
>
> #include
> int main()
> {
> IO0DIR = 0x00000D00;
> while(1)
> {
> IO0CLR = 0x00000000;
> }
> }
>
> Both codes worked when simulated on KEIL. but they dont work when programmed into the controller. Please help me out!
>
> Regards
> Mayuresh M
>

you need set each bit in IO0CLR of the port pin that you wish to bring low ie in your case
IO0CLR = 0x00000D00;

--- In l..., "MAYURESH M" wrote:
>
> Hello all.
> I am working with microcontroller board based on LPC2124. To test the board i made a test code using KEIL uVision 3 and programmed the board using RS232 and flash magic. The prgramming process is completed but the code doesn't run.
>
> Here is the code and the basic overview of the schematic.
>
> #include
> int main()
> {
> IO0DIR = 0x00000000;
> while(1)
> {
> IO0CLR = 0x00000000;
> }
> }
>
> I have LEDs connected to p0.8,p0.10 and p0.11 of the LPC2124 in common anode connection. That is when these pins would go low, only then the LEDs will turn ON. So i wrote this program to see if all these LEDs glow on reset. I have written another code but configured those 3 pins as outputs. Below is the code.
>
> #include
> int main()
> {
> IO0DIR = 0x00000D00;
> while(1)
> {
> IO0CLR = 0x00000000;
> }
> }
>
> Both codes worked when simulated on KEIL. but they dont work when programmed into the controller. Please help me out!
>
> Regards
> Mayuresh M
>

IO0CLR = 0x00000D00;

Read the manual about the differences between IOPIN, IOSET and IOCLR.

Richard

>>you need set each bit in IO0CLR of the port pin that you wish to ??>>bring low ie in
>>your case
>>IO0CLR = 0x00000D00;

Oh yes. thank you for pointing that out. but unfortunately that did not work too. I suppose the problem must be in the header file. Does the header file provided with keil uvision 3 work with all circuits of LPC2124? The board which i am working on is a home-made board and loosely based on the olimex's LPC2124 header board.
I am not able to figure out whether it is a software related or a hardware related problem.

--- In l..., "MAYURESH M" wrote:
> >>you need set each bit in IO0CLR of the port pin that you wish to ??>>bring low ie in
> >>your case
> >>IO0CLR = 0x00000D00;
>
> Oh yes. thank you for pointing that out. but unfortunately that did not work too. I suppose the problem must be in the header file. Does the header file provided with keil uvision 3 work with all circuits of LPC2124? The board which i am working on is a home-made board and loosely based on the olimex's LPC2124 header board.
> I am not able to figure out whether it is a software related or a hardware related problem.
>

--- In l..., "MAYURESH M" wrote:
> >>you need set each bit in IO0CLR of the port pin that you wish to ??>>bring low ie in
> >>your case
> >>IO0CLR = 0x00000D00;
>
> Oh yes. thank you for pointing that out. but unfortunately that did not work too. I suppose the problem must be in the header file. Does the header file provided with keil uvision 3 work with all circuits of LPC2124? The board which i am working on is a home-made board and loosely based on the olimex's LPC2124 header board.
> I am not able to figure out whether it is a software related or a hardware related problem.
>

I am new to arm also so I can't be certain... but I don't see why there should be a problem with the header.

I presume you've also set IO0DIR = 0x000000D0 ?

Have you configured the PLL in your startup file. I had the same problem (I forgot to...) but I switched to using the GNU Compiler in Keil before I found that out.

Try using one of the exemples from the nxp website:
http://ics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc213x.lpc214x.uvision.zip

It is for keil's compiler.

Att.

2010/3/31 voltz56

> --- In l... , "MAYURESH M"
> wrote:
> >
> >
> > >>you need set each bit in IO0CLR of the port pin that you wish to
> ??>>bring low ie in
> > >>your case
> > >>IO0CLR = 0x00000D00;
> >
> > Oh yes. thank you for pointing that out. but unfortunately that did not
> work too. I suppose the problem must be in the header file. Does the header
> file provided with keil uvision 3 work with all circuits of LPC2124? The
> board which i am working on is a home-made board and loosely based on the
> olimex's LPC2124 header board.
> > I am not able to figure out whether it is a software related or a
> hardware related problem.
> > --- In l... , "MAYURESH M"
> wrote:
> >
> >
> > >>you need set each bit in IO0CLR of the port pin that you wish to
> ??>>bring low ie in
> > >>your case
> > >>IO0CLR = 0x00000D00;
> >
> > Oh yes. thank you for pointing that out. but unfortunately that did not
> work too. I suppose the problem must be in the header file. Does the header
> file provided with keil uvision 3 work with all circuits of LPC2124? The
> board which i am working on is a home-made board and loosely based on the
> olimex's LPC2124 header board.
> > I am not able to figure out whether it is a software related or a
> hardware related problem.
> > I am new to arm also so I can't be certain... but I don't see why there
> should be a problem with the header.
>
> I presume you've also set IO0DIR = 0x000000D0 ?
>
> Have you configured the PLL in your startup file. I had the same problem (I
> forgot to...) but I switched to using the GNU Compiler in Keil before I
> found that out.
>
>
>

The 2024 Embedded Online Conference