Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Some worthless talk, A request and Need help

Some worthless talk, A request and Need help

2005-12-14 by mahbub1833

Hi,
I am newbie in microcontroller world as well as in great ARM world.

WORTHLESS TALK:
Although I know that ARM microcontrollers are for the professionals; 
but I think we all need a starting point. That will help the newbie 
(like me) to start smoothly from the beginning and the professionals 
to have an overview. 

STUPID EXAMPLE:
I want to draw an example. Not to mention that one of the reasons of 
PIC microcontrollers from "MICROCHIP" to be famous is the resource. 
No other microcontroller has that much project, reference, tutorial 
what it has.

But PIC series can't be compared to the ARM by any hardware features 
as ARM is much richer than any PIC series. Only lack is the 
resource. I found few open projects or university projects with ARM 
microcontroller searching by Google. Why is this? Anybody please 
answer this newbie?    

BLOODY REQUEST:
My request goes to all great professionals of this group. Please 
make a starting point for us (newbie). More examples and projects 
are needed to learn programming LPC series smoothly. Especially step 
by step tutorial with code would be great. (Please give me some link 
if there any). 


NEED HELP:

I have IAR LPC2148 development kit and J-Link adapter. I tried 
example codes using IAR workbench and those run fine. But I couldn't 
understand the coding with my little PC based programming knowledge. 
Now my questions are- 

1. How would I learn C language specified for this particular 
microcontroller? 

2. How is the datasheet helpful to me? (I mean, what chapters do I 
need from datasheet to program in C?) 

3. Is there any good tutorial or book or reference to program 
LPC2148 or other ARM7TDMI step by step? 

4. Where should I start from? 

5. Somebody please upload or link few more codes to learn step by 
step. 

6. Suppose I want to interface a LDR to the circuit and want to show 
the value in the LCD display. Now which pin (AD) would I use to 
connect the LDR? And what would be the program? 

I apologize for my kiddy questions in the professional group. I need 
your help to go ahead in the microcontroller world.

Re: [lpc2000] Some worthless talk, A request and Need help

2005-12-14 by Rob Jansen

Mahbub1833,

feel like Alice in Wonderland ???

>I am newbie in microcontroller world as well as in great ARM world.
>
>WORTHLESS TALK:
>Although I know that ARM microcontrollers are for the professionals; 
>  
>

Welcome in the wonderfull world of ARM microcontrollers, defenitely not 
only for the professionals.
With different not-too-expensive boards and free Gnu C compiler it is a 
real nice target for hobbyists also.

>BLOODY REQUEST:
>My request goes to all great professionals of this group. Please 
>make a starting point for us (newbie). More examples and projects 
>are needed to learn programming LPC series smoothly. Especially step 
>by step tutorial with code would be great. (Please give me some link 
>if there any). 
>  
>
It should not be that hard if you start from the IAR examples - I guess 
they have a "Hello World" in the form of a flashing LED or something 
similar. These are always nice examples to start from.
There is also a good book from Hitex (called something like "The 
insiders guide to the ARM7") to start with.

>NEED HELP:
>
>I have IAR LPC2148 development kit and J-Link adapter. I tried 
>example codes using IAR workbench and those run fine. But I couldn't 
>understand the coding with my little PC based programming knowledge. 
>Now my questions are- 
>
>1. How would I learn C language specified for this particular 
>microcontroller? 
>  
>
There is nothing special or magical about C for the lpc21xx series. It 
is just standard (ANSI compliant) C.
You just have to remember that you do not have all resources as you have 
on a PC. For printf() you need a console - most development environments 
will support this.
For file I/O you need a storage device - not standard available so 
forget this for the time being.
Accessing stuff like the LEDs and other I/O on the board need the 
different peripheral blocks in the chip. Check out the Philips website 
(www.semiconductors.philips.com) and get the datasheet and - more 
important - the user manual for your chip.
This user manual contains detailed information on the meaning of all the 
bits in the I/O registers.

Note: all I/O is memory mapped an can be read and written using a 
standard C pointer, but it has to be declared volatile - otherwise the 
compiler may optimize this out ...

Okay, you got all this ...
Take your simplest Keil example and try to add code to light an LED on 
the board.

Now you need some hardware knowledge of the board:
    When is the LED lit? when the output port is tied to ground or to 3.3V ?
    What is the output bit ?

Assume the LED is lit when tied to ground, you need to program a 0 level 
in the output bit.
Assume the output bit is P0.20.

Start reading the user manual of the 2148.
Chapter 8.4.1 shows the meaning and content of the IODIR register, this 
register determines if a bit is an input or output bit. You have to set 
bit 20 to make P0.20 an output port:

    IO0DIR |= (1<<20);  // Perform a logical OR of IODIR to set bit 20 to 1

(note: IO0DIR can also be called IODIR0, it is defined in the lpc21xx.h 
- or similar - include file)

Now all you have to do is set the P0.20 bit to 0, there are two ways to 
do this. See 8.4.3, 8.4.4 and 8.4.5
You can write all bits using the IO0PIN register (you need to apply a 
mask to set or reset the bits you want), use IO0SET to set any bits to 1 
or IO0CLR to clear any bits (set bits to 0).
Read the manual: "Writing a 1 produces a low level at the corresponding 
port pins"

    IO0CLR = (1<<20);

You don't need any mask or whatever, just writing a 1 is enough - as is 
stated in the manual.

Now compile the program and download it to your board.
You may want to check that you compile and download into RAM, not in Flash.
Flash has a limited number of write cycles - do not worry too much about 
this, it's a large number but for these simple tests it is just a waste 
to program flash.
Then download and run using the IAR debugger.

Please check the IAR / J-Link manuals on this.

>5. Somebody please upload or link few more codes to learn step by 
>step. 
>  
>
The problem is that we all have our favorite environment.
I use a board from Embedded Artists and they have their own make 
environment, farily well documented in the manual.
That manual is available via their web page and an example can be found 
somewhere on my ARM page (http://www.myvoice.nl/electronics/)
Check out "Timing your programs" that one contains a simple piece of 
code to read a timer and print data on the serial port (UART0).


>6. Suppose I want to interface a LDR to the circuit and want to show 
>the value in the LCD display. Now which pin (AD) would I use to 
>connect the LDR? And what would be the program? 
>  
>
Read the manual, as far as I know all AD ports are the same. It just 
depends on which pin is still available on your board for your own I/O.

The program is simple:

    1) initialize A/D (and UART)
    2) start A/D conversion
    3) wait for A/D conversion to be complete
    4) print out value of the UART
    5) repeat ...

Just start reading the user manual carefully. It's all there - Best is 
to read and then drop your detailed questions in this group again.

>I apologize for my kiddy questions in the professional group. I need 
>your help to go ahead in the microcontroller world.
>
we all have to start somewhere. I started about 25 years ago with a home 
built 6502 kit from Elektor, meanwhile I have no problems reading 
datasheets and user manuals for chips like the lpc2148.
But I do have problems with standard Windows programming and that kind 
of things. Programming web tablets, telephones and telephone exchanges 
is what I did, but do not ask me to write a Visual C (or Basic) version 
of a calculator ...

Oh, this group is mixed with professionals and hobbyists on all sorts of 
levels. So all levels of Questions are welcome!
In time you will be able to tell other how to ...

Good Luck,

    Rob

Re: [lpc2000] Some worthless talk, A request and Need help

2005-12-14 by George M. Gallant, Jr.

I think you have missed the point. We "PROFESSIONALS" often had the
advantage of corporate
resources, existing projects, professional tools, and access to complete
and accurate documentation.

As a person who is returning the the ARM world as a hobby,  I find the
LPC seriously lacking in
fundamental startup resources. Oodles of references alluding to "just do
this" and it works for
me, but almost zip in concrete working examples.

Just my two cents as I try to build a tool chain, port an OS, get JTAG
working on Linux, understand
the memory organization, get the FLASH burn specs, etc.....

George

 

On Wed, 2005-12-14 at 09:18 -0500, mfrazier@... wrote:

> Here' a starting point...make the effort and learn C and processor 
> operations...we "PROFESSIONALS" had to.
> 
> [Non-text portions of this message have been removed]
> 
> 
> 
> 
> ______________________________________________________________________
> YAHOO! GROUPS LINKS
> 
> 
>      1.  Visit your group "lpc2000" on the web.
>           
>      2.  To unsubscribe from this group, send an email to:
>          lpc2000-unsubscribe@yahoogroups.com
>           
>      3.  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>         Service.
> 
> 
> 
> ______________________________________________________________________
> 
> 


[Non-text portions of this message have been removed]

Re: Some worthless talk, A request and Need help

2005-12-14 by mahbub1833

Hi,
Thank you very much for your suggestions. Those are really worthy 
me. Especially your tease helped me to breathe normally and feel 
that microcontroller world is not that magical what I thought. 
 
"Feel like Alice in Wonderland???"

==>In fact my position is just opposite; because I got nobody beside 
me here. So, mentally I was depressed. Only help I have is the 
internet groups and forums. So, I am little bit nervous.

I am trying to understand datasheets and started reading the 
helpfiles came with the IAR workbench compiler.

Thank you. 
 
--- In lpc2000@yahoogroups.com, Rob Jansen <rob@m...> wrote:
>
> Mahbub1833,
> 
> feel like Alice in Wonderland ???
> 
> >I am newbie in microcontroller world as well as in great ARM 
world.
> >
> >WORTHLESS TALK:
> >Although I know that ARM microcontrollers are for the 
professionals; 
> >  
> >
> 
> Welcome in the wonderfull world of ARM microcontrollers, 
defenitely not 
> only for the professionals.
> With different not-too-expensive boards and free Gnu C compiler it 
is a 
> real nice target for hobbyists also.
> 
> >BLOODY REQUEST:
> >My request goes to all great professionals of this group. Please 
> >make a starting point for us (newbie). More examples and projects 
> >are needed to learn programming LPC series smoothly. Especially 
step 
> >by step tutorial with code would be great. (Please give me some 
link 
> >if there any). 
> >  
> >
> It should not be that hard if you start from the IAR examples - I 
guess 
> they have a "Hello World" in the form of a flashing LED or 
something 
> similar. These are always nice examples to start from.
> There is also a good book from Hitex (called something like "The 
> insiders guide to the ARM7") to start with.
> 
> >NEED HELP:
> >
> >I have IAR LPC2148 development kit and J-Link adapter. I tried 
> >example codes using IAR workbench and those run fine. But I 
couldn't 
> >understand the coding with my little PC based programming 
knowledge. 
> >Now my questions are- 
> >
> >1. How would I learn C language specified for this particular 
> >microcontroller? 
> >  
> >
> There is nothing special or magical about C for the lpc21xx 
series. It 
> is just standard (ANSI compliant) C.
> You just have to remember that you do not have all resources as 
you have 
> on a PC. For printf() you need a console - most development 
environments 
> will support this.
> For file I/O you need a storage device - not standard available so 
> forget this for the time being.
> Accessing stuff like the LEDs and other I/O on the board need the 
> different peripheral blocks in the chip. Check out the Philips 
website 
> (www.semiconductors.philips.com) and get the datasheet and - more 
> important - the user manual for your chip.
> This user manual contains detailed information on the meaning of 
all the 
> bits in the I/O registers.
> 
> Note: all I/O is memory mapped an can be read and written using a 
> standard C pointer, but it has to be declared volatile - otherwise 
the 
> compiler may optimize this out ...
> 
> Okay, you got all this ...
> Take your simplest Keil example and try to add code to light an 
LED on 
> the board.
> 
> Now you need some hardware knowledge of the board:
>     When is the LED lit? when the output port is tied to ground or 
to 3.3V ?
>     What is the output bit ?
> 
> Assume the LED is lit when tied to ground, you need to program a 0 
level 
> in the output bit.
> Assume the output bit is P0.20.
> 
> Start reading the user manual of the 2148.
> Chapter 8.4.1 shows the meaning and content of the IODIR register, 
this 
> register determines if a bit is an input or output bit. You have 
to set 
> bit 20 to make P0.20 an output port:
> 
>     IO0DIR |= (1<<20);  // Perform a logical OR of IODIR to set 
bit 20 to 1
> 
> (note: IO0DIR can also be called IODIR0, it is defined in the 
lpc21xx.h 
> - or similar - include file)
> 
> Now all you have to do is set the P0.20 bit to 0, there are two 
ways to 
> do this. See 8.4.3, 8.4.4 and 8.4.5
> You can write all bits using the IO0PIN register (you need to 
apply a 
> mask to set or reset the bits you want), use IO0SET to set any 
bits to 1 
> or IO0CLR to clear any bits (set bits to 0).
> Read the manual: "Writing a 1 produces a low level at the 
corresponding 
> port pins"
> 
>     IO0CLR = (1<<20);
> 
> You don't need any mask or whatever, just writing a 1 is enough - 
as is 
> stated in the manual.
> 
> Now compile the program and download it to your board.
> You may want to check that you compile and download into RAM, not 
in Flash.
> Flash has a limited number of write cycles - do not worry too much 
about 
> this, it's a large number but for these simple tests it is just a 
waste 
> to program flash.
> Then download and run using the IAR debugger.
> 
> Please check the IAR / J-Link manuals on this.
> 
> >5. Somebody please upload or link few more codes to learn step by 
> >step. 
> >  
> >
> The problem is that we all have our favorite environment.
> I use a board from Embedded Artists and they have their own make 
> environment, farily well documented in the manual.
> That manual is available via their web page and an example can be 
found 
> somewhere on my ARM page (http://www.myvoice.nl/electronics/)
> Check out "Timing your programs" that one contains a simple piece 
of 
> code to read a timer and print data on the serial port (UART0).
> 
> 
> >6. Suppose I want to interface a LDR to the circuit and want to 
show 
> >the value in the LCD display. Now which pin (AD) would I use to 
> >connect the LDR? And what would be the program? 
> >  
> >
> Read the manual, as far as I know all AD ports are the same. It 
just 
> depends on which pin is still available on your board for your own 
I/O.
> 
> The program is simple:
> 
>     1) initialize A/D (and UART)
>     2) start A/D conversion
>     3) wait for A/D conversion to be complete
>     4) print out value of the UART
>     5) repeat ...
> 
> Just start reading the user manual carefully. It's all there - 
Best is 
> to read and then drop your detailed questions in this group again.
> 
> >I apologize for my kiddy questions in the professional group. I 
need 
> >your help to go ahead in the microcontroller world.
> >
> we all have to start somewhere. I started about 25 years ago with 
a home 
> built 6502 kit from Elektor, meanwhile I have no problems reading 
> datasheets and user manuals for chips like the lpc2148.
> But I do have problems with standard Windows programming and that 
kind 
> of things. Programming web tablets, telephones and telephone 
exchanges 
> is what I did, but do not ask me to write a Visual C (or Basic) 
version 
> of a calculator ...
> 
> Oh, this group is mixed with professionals and hobbyists on all 
sorts of 
Show quoted textHide quoted text
> levels. So all levels of Questions are welcome!
> In time you will be able to tell other how to ...
> 
> Good Luck,
> 
>     Rob
>

Re: Some worthless talk, A request and Need help

2005-12-14 by rtstofer

The process is known as 'stepwise refinement' and I'll credit it to 
Niklaus Wirth because I first saw it described in his 
book "Algorithms + Data Structures = Programs".

First you get a development board with some type of development tool 
chain.  It doesn't much matter which one.

Next you run the simple examples.  For an embedded platform this is 
usually a blinking LED.  For a computer platform this is "Hello 
World!".  Both are sufficient to show that the tool chain and 
development board are working.

Then you study all of the files that make up the example.  The 
startup code, the main program, etc.  You look at every statement 
and, using the device datasheet and board schematic, try to learn 
exactly what it does.

In the embedded world there will be some startup code you just take 
on faith because it will be a long time before you need to worry 
about it.  But, things like setting up the IODIR register and then 
using IOSET and IOCLR to turn things on and off are fundamental to 
microcontrollers.

Now that the blinking LED is understood, the next step is to get the 
serial port working and create the "Hello World!" example.  This may 
be included with the software.  Nevertheless, it is the second step 
and it is important because, while JTAG debugging is glamorous, 
printf debugging is also useful.

Then it is time to move on to I2C or SPI.  Perhaps hang an MMC/SD 
card on the bus and implement a file system.  Maybe hang an MP3 
CODEC on the SPI bus and build a complete MP3 player.  That ought to 
do it:  there is a little bit of everything in a project like that.

One step at a time...

Re: [lpc2000] Some worthless talk, A request and Need help

2005-12-14 by Bill Knight

George
  Have a look at UT050418A.zip in the files section of this group
on Yahoo.  It contains the full source and Makefile for a complete
operational program - "Hello World" on UART0 with a Blinky Light,
an elapsed system timer, and optional interrupts.  A number of the
include files have since been upgraded but what is there works and
should provide a (somewhat reasonable) starting point.

Regards
-Bill Knight
R O SoftWare
Show quoted textHide quoted text
On Wed, 14 Dec 2005 09:56:12 -0500, George M. Gallant, Jr. wrote:

>I think you have missed the point. We "PROFESSIONALS" often had the
>advantage of corporate
>resources, existing projects, professional tools, and access to complete
>and accurate documentation.

>As a person who is returning the the ARM world as a hobby,  I find the
>LPC seriously lacking in
>fundamental startup resources. Oodles of references alluding to "just do
>this" and it works for
>me, but almost zip in concrete working examples.

>Just my two cents as I try to build a tool chain, port an OS, get JTAG
>working on Linux, understand
>the memory organization, get the FLASH burn specs, etc.....

>George

Re: Some worthless talk, A request and Need help

2005-12-14 by Ken Wada

--- In lpc2000@yahoogroups.com, "mahbub1833" <fireball003@g...> wrote:
> "Feel like Alice in Wonderland???"
> 
> ==>In fact my position is just opposite; because I got nobody beside 
> me here. So, mentally I was depressed. Only help I have is the 
> internet groups and forums. So, I am little bit nervous.
heh...
Where I am currently consulting; I recommended using the LPC2214 part.
..AND; have never even used it AND...> My clients expect to have 
device drivers and OS and hardware fully operational so the 
application coders can go full bore without having to worry about 
hardware/driver/OS details!

I am pleased to say:
When the director asked me, do you need that MCB board from Keil? I 
told him...nah! I believe we can just spin this thing up and get it 
operational with our own hardware design!

so...
I am also very pleased to say: (much kudos to Philips, Keil, and this 
wonderful forum); I got the system operational in the afternoon I got 
the boards back (complete with a console-based TTY diagnotic interface 
no less)! I got the rest of the device drivers and most of the OS 
operational shortly, (2-3 days) thereafter!

AND....
I am also very glad to say...there are no cuts and jumps on the board!
!!none!!

The project we were working on is a broad-band (2.125 gigabit 
multi-channel optical network/Ethernet managed switch)....> and 
needless to say, my client is very happy with the results, and has 
just now started the release to manufacturing, and will ship the 1st 
10 units to an overseas customer next week!

Ken Wada, (glad we made the choice to go with the LPC2214 and Keil, 
and very glad this forum exists!)

Re: Some worthless talk, A request and Need help

2005-12-14 by Ken Wada

I agree 100%!
Baby steps...baby steps...

In my case, what I did was that Keil "Hello World" example with their 
polled UART device driver.

Then, I quickly dropped in my interrupt-driven driver.

On the hardware front...basically, the director and I deemed that we 
could 'take the risk' and just go straight to our own hardware...

schedules vs. risk and all...
Turns out that we made the correct decision, since I was able to get 
that "Hello World" example with our custom hardware fully operational 
in a couple of hours of receipt of the boards!

oh...
Actually, we had one cut that we had to do on the board. It turned out 
that our hardware engineer felt that we had no use for the JTAG port, 
so he disabled it! (this...after we expressly told him not to...sigh!) 
so....we wound up having to cut a trace on the JTAG header to the 
processor in order to get the JTAG operational on our board...(sheesh! 
he gave us the JTAG header/connector, and wound up disabling the JTAG 
port! go figure!)

Ken Wada

--- In lpc2000@yahoogroups.com, "rtstofer" <rstofer@p...> wrote:
Show quoted textHide quoted text
>
> The process is known as 'stepwise refinement' and I'll credit it to 
> Niklaus Wirth because I first saw it described in his 
> book "Algorithms + Data Structures = Programs".
> 
> First you get a development board with some type of development tool 
> chain.  It doesn't much matter which one.
> 
> Next you run the simple examples.  For an embedded platform this is 
> usually a blinking LED.  For a computer platform this is "Hello 
> World!".  Both are sufficient to show that the tool chain and 
> development board are working.
> 
> Then you study all of the files that make up the example.  The 
> startup code, the main program, etc.  You look at every statement 
> and, using the device datasheet and board schematic, try to learn 
> exactly what it does.
> 
> In the embedded world there will be some startup code you just take 
> on faith because it will be a long time before you need to worry 
> about it.  But, things like setting up the IODIR register and then 
> using IOSET and IOCLR to turn things on and off are fundamental to 
> microcontrollers.
> 
> Now that the blinking LED is understood, the next step is to get the 
> serial port working and create the "Hello World!" example.  This may 
> be included with the software.  Nevertheless, it is the second step 
> and it is important because, while JTAG debugging is glamorous, 
> printf debugging is also useful.
> 
> Then it is time to move on to I2C or SPI.  Perhaps hang an MMC/SD 
> card on the bus and implement a file system.  Maybe hang an MP3 
> CODEC on the SPI bus and build a complete MP3 player.  That ought to 
> do it:  there is a little bit of everything in a project like that.
> 
> One step at a time...
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.