Reply by grahamg227 April 23, 20082008-04-23
--- In l..., "Abdullah R" wrote:
>
> You gave good idea. I changed the code as follows and the LED do turn

Why not try the "Blinky" examples that come with the Keil compiler?
also here :- http://www.keil.com/download/list/arm.htm

An Engineer's Guide to the LPC2100 Series

Reply by Paul Claessen April 23, 20082008-04-23
Not sure how your LEDs are connected, but on my Keil MCB2300 board they are
ON by default.

When I make the pins OUTPUT they turn OFF, when I use FIO2SET they turn ON,
and FIO2CLR turns them OFF.



Writing 0s to FIO2DIR (or IO0DIR in your case), doesnt do anything. See
manual.



Not sure I understand your debug problems, but if youre using Keils
Vision and dont quite following the debug path through your C code then
run to the c statement where you want to start debugging, then turn on the
disassembly window, go to that window, and single step there (singe ARM
instruction at the time)! That usually shows you whats going on. Loops in
higher level languages may be implemented in ways you not always expect,
based on a number of different situations.



~ Paul



From: l... [mailto:l...] On Behalf Of
Abdullah R
Sent: Wednesday, April 23, 2008 1:39 PM
To: l...
Subject: [lpc2000] Re: New user on Olimex LPC-E2129, LED not blinking.
Please help



You gave good idea. I changed the code as follows and the LED do turn
on. What makes me go crazy is when i uncomment the IO0Set line, and
walk through the code in debug mode, the debugger goes to the line
above i.e. IO0CLR and returns as if it was the last line in while
loop. I did build target,download but it only reads what is the on the
first line i.e. IO0CLR.
If i make the first line in while as IO0CLR=0x00000000, light do turn off.

I wish someone can post a working project so that i know my env doesnt
have any problem.

Any thoughts? Thanks

#include
void Delay (unsigned long a) { while (--a!=0); }
int main()
{
//LEDs connected to P0.8, P0.10 and P0.11
PINSEL0 = 0x00; //select GPIO mode for pins
IO0DIR = 0xFFFFFFFF; //set all to outputs
// loop forever
while(1) {
IO0CLR=0xFFFFFFFF; //turn on
//IO0SET=0xFFFFFFFF;
}
}
--- In l... , "Paul
Claessen" wrote:
>
> Looks simple:
>
> You turn them off, then wait a bit, then turn them on, and then ....
DIRECTLY (back to top op loop) off again.
> Place another delay after the Io0SET (but make it MUCH MUCH longer
than only 500000!
> Why not just turn them on.... period.
>
> ~ Paul Claessen
>
>
> ----- Original Message -----
> From: Abdullah R
> To: l...
> Sent: Tuesday, April 22, 2008 5:50 PM
> Subject: [lpc2000] New user on Olimex LPC-E2129, LED not blinking.
Please help
>
>
> I am v new to embedded coming from GUI/C++ background. I have
> connected Keil's ARM-MDK to Olimex LPC-E2129 board through ULINK2 JTAG
> adapter.
>
> I created project in uVision3, selecting LPC2129 as device type, it
> automatically created Startup.s file for me. Then i wrote very simple
> toggle LED program (main.c) as shown below. It builds .axf file and it
> gets downloaded to board (at least thats what the IDE tells me). But
> after resetting the board, the led do not blink.
> I started code in debug mode, it does step into code, sets values
> right but no affect on LEDs.I know the board is fine and LED do work
> when my friend programmed my board using his Eclipse.
>
> 1- Is there anything wrong with my startup.s file?
> 2- Is any of my settings wrong in Keil IDE Target Options?
>
> Any pointer or thing to try/check would help. I just want to cross
> this hurdle. Here is my code
> Thanks
> Paracha
>
>
Reply by Abdullah R April 23, 20082008-04-23
You gave good idea. I changed the code as follows and the LED do turn
on. What makes me go crazy is when i uncomment the IO0Set line, and
walk through the code in debug mode, the debugger goes to the line
above i.e. IO0CLR and returns as if it was the last line in while
loop. I did build target,download but it only reads what is the on the
first line i.e. IO0CLR.
If i make the first line in while as IO0CLR=0x00000000, light do turn off.

I wish someone can post a working project so that i know my env doesnt
have any problem.

Any thoughts? Thanks

#include
void Delay (unsigned long a) { while (--a!=0); }
int main()
{
//LEDs connected to P0.8, P0.10 and P0.11
PINSEL0 = 0x00; //select GPIO mode for pins
IO0DIR = 0xFFFFFFFF; //set all to outputs
// loop forever
while(1) {
IO0CLR=0xFFFFFFFF; //turn on
//IO0SET=0xFFFFFFFF;
}
}
--- In l..., "Paul Claessen" wrote:
>
> Looks simple:
>
> You turn them off, then wait a bit, then turn them on, and then ....
DIRECTLY (back to top op loop) off again.
> Place another delay after the Io0SET (but make it MUCH MUCH longer
than only 500000!
> Why not just turn them on.... period.
>
> ~ Paul Claessen
> ----- Original Message -----
> From: Abdullah R
> To: l...
> Sent: Tuesday, April 22, 2008 5:50 PM
> Subject: [lpc2000] New user on Olimex LPC-E2129, LED not blinking.
Please help
> I am v new to embedded coming from GUI/C++ background. I have
> connected Keil's ARM-MDK to Olimex LPC-E2129 board through ULINK2 JTAG
> adapter.
>
> I created project in uVision3, selecting LPC2129 as device type, it
> automatically created Startup.s file for me. Then i wrote very simple
> toggle LED program (main.c) as shown below. It builds .axf file and it
> gets downloaded to board (at least thats what the IDE tells me). But
> after resetting the board, the led do not blink.
> I started code in debug mode, it does step into code, sets values
> right but no affect on LEDs.I know the board is fine and LED do work
> when my friend programmed my board using his Eclipse.
>
> 1- Is there anything wrong with my startup.s file?
> 2- Is any of my settings wrong in Keil IDE Target Options?
>
> Any pointer or thing to try/check would help. I just want to cross
> this hurdle. Here is my code
> Thanks
> Paracha
>
> =========== main.c ==================> #include
> void Delay (unsigned long a) { while (--a!=0); }
> int main()
> {
> //LEDs connected to P0.8, P0.10 and P0.11
> PINSEL0 = 0x00; //select GPIO mode for pins
> IO0DIR = 0xFFFFFFFF; //set all to outputs
> IO0CLR = 0xFFFFFFFF; //turn all off
>
> // loop forever
> while(1) {
> IO0CLR=0xFFFFFFFF;
> Delay(500000);
> IO0SET=0xFFFFFFFF;
> }
> }
> ==================================>
>
>
>
>

Reply by Paul Claessen April 22, 20082008-04-22
Looks simple:

You turn them off, then wait a bit, then turn them on, and then .... DIRECTLY (back to top op loop) off again.
Place another delay after the Io0SET (but make it MUCH MUCH longer than only 500000!
Why not just turn them on.... period.

~ Paul Claessen
----- Original Message -----
From: Abdullah R
To: l...
Sent: Tuesday, April 22, 2008 5:50 PM
Subject: [lpc2000] New user on Olimex LPC-E2129, LED not blinking. Please help
I am v new to embedded coming from GUI/C++ background. I have
connected Keil's ARM-MDK to Olimex LPC-E2129 board through ULINK2 JTAG
adapter.

I created project in uVision3, selecting LPC2129 as device type, it
automatically created Startup.s file for me. Then i wrote very simple
toggle LED program (main.c) as shown below. It builds .axf file and it
gets downloaded to board (at least thats what the IDE tells me). But
after resetting the board, the led do not blink.
I started code in debug mode, it does step into code, sets values
right but no affect on LEDs.I know the board is fine and LED do work
when my friend programmed my board using his Eclipse.

1- Is there anything wrong with my startup.s file?
2- Is any of my settings wrong in Keil IDE Target Options?

Any pointer or thing to try/check would help. I just want to cross
this hurdle. Here is my code
Thanks
Paracha

=========== main.c ==================#include
void Delay (unsigned long a) { while (--a!=0); }
int main()
{
//LEDs connected to P0.8, P0.10 and P0.11
PINSEL0 = 0x00; //select GPIO mode for pins
IO0DIR = 0xFFFFFFFF; //set all to outputs
IO0CLR = 0xFFFFFFFF; //turn all off

// loop forever
while(1) {
IO0CLR=0xFFFFFFFF;
Delay(500000);
IO0SET=0xFFFFFFFF;
}
}
==================================

Reply by Abdullah R April 22, 20082008-04-22
I am v new to embedded coming from GUI/C++ background. I have
connected Keil's ARM-MDK to Olimex LPC-E2129 board through ULINK2 JTAG
adapter.

I created project in uVision3, selecting LPC2129 as device type, it
automatically created Startup.s file for me. Then i wrote very simple
toggle LED program (main.c) as shown below. It builds .axf file and it
gets downloaded to board (at least thats what the IDE tells me). But
after resetting the board, the led do not blink.
I started code in debug mode, it does step into code, sets values
right but no affect on LEDs.I know the board is fine and LED do work
when my friend programmed my board using his Eclipse.

1- Is there anything wrong with my startup.s file?
2- Is any of my settings wrong in Keil IDE Target Options?

Any pointer or thing to try/check would help. I just want to cross
this hurdle. Here is my code
Thanks
Paracha

=========== main.c ==================#include
void Delay (unsigned long a) { while (--a!=0); }
int main()
{
//LEDs connected to P0.8, P0.10 and P0.11
PINSEL0 = 0x00; //select GPIO mode for pins
IO0DIR = 0xFFFFFFFF; //set all to outputs
IO0CLR = 0xFFFFFFFF; //turn all off

// loop forever
while(1) {
IO0CLR=0xFFFFFFFF;
Delay(500000);
IO0SET=0xFFFFFFFF;
}
}
==================================