Sign in

username:

password:



Not a member?

Search lpc2000



Search tips

Subscribe to lpc2000



lpc2000 by Keywords

2106 | ADC | ARM7 | Atmel | Bootloader | CAN | CrossStudio | CrossWorks | DDS | ECos | Ethernet | ETM | FIFO | FLASH | FPGA | GCC | GDB | GNU | GNUARM | GPIO | I2C | IAP | IAR | JTAG | Kickstart | LCD | Linux | LPC | LPC-E2294 | LPC2000 | LPC2100 | LPC2104 | Lpc2106 | Lpc210x | LPC2114 | LPC2119 | LPC2124 | LPC2129 | Lpc2138 | LPC213x | LPC21xx | LPC2210 | LPC2212 | LPC2214 | LPC2292 | LPC2294 | LPC2xxx | LPC3128 | MCB2100 | Olimex | Philips | PWM | Rowley | RTC | RTOS | SPI | SSP | UART | UART0 | UART1 | ULINK | USB | Watchdog | Wiggler

Ads

Discussion Groups

Discussion Groups | LPC2000 | LPC-2148 Demo Code v1.30 now available

Discussion group dedicated to the Philips LPC2000 family of ARM MCUs

LPC-2148 Demo Code v1.30 now available - "J.C. Wren" - Oct 5 23:23:03 2008

After almost a year of being slack, I have updated the LPC-2148 demo code
package. Below are the changes (extracted from the README file). The
latest version is available at http://jcwren.com/arm
The code was compiled with GCC 4.2.4, and newlib 1.16 (please note the CVS
version of newlib has changes which cause breakage. Once 1.17 is formally
released, I will update the code to use it). I've tried to test everything
in the package, but it's quite possible I broke something. If I screwed
something up, please don't hesitate to let me know.

--jc

Updated FreeRTOS to version 5.0.4

The I/O ports are now configured and used in fast I/O port mode, rather
than legacy slow-poke mode. Most people in the real world have no need
of
the slower legacy mode.

Added 'misc ports' command to display the _PIN, _DIR and _MASK registers
of
port 0 and 1.

Added LCD example. There are two files in the lcd directory, lcd_4bit.c
and lcd_8bit.c. The lcd_4bit is suitable for the Olimex LPC-P2148 board
(which this demo code is targeted for). The lcd_8bit.c file is targeted
for an LCD that has a full 8-bit interface. The 8-bit code was
extracted
from a previous project and is untested, but SHOULD either work as-is
(adjusting for the port pin assignments, of course), or be very close.
The
LCD is handled in it's own task, started and stopped with 'lcd start'
and
'lcd stop'. This shows dynamic task creation and destruction, and means
the LCD task won't automatically start for users without LCDs connected.
Use 'lcd msg ""' to display a message, 'lcd clear' to clear screen,
and 'lcd gotoxy <0..1> <0..19>' to position the cursor for writing.

Added PWM example. Unfortunately, this will require an oscilloscope or
logic analyzer to be able to see the results of it. At reset, PWM5 is
set
up for a 20Khz period, and a duty cycle of 50%. The frequency can be
varied with the 'pwm freq' command (between 1 and 48000000Hz), and the
duty
cycle can be varied with the 'pwm duty' command (between 0 and 100%).
This
code was extracted from another project that used it to control a bias
circuit for LCD contrast.

Added an example of using the timer 1 match registers. In a previous
release, I had made the statement that how Olimex drove the speaker was
flawed. Thanks to some code contributed by Dave Madden, it turns out
that
using timer 1 and the match registers, tones between 60 and 20,000 Hertz
can be fairly easily generated. Either Olimex saw this early on, or
they
just got lucky ('beep off', 'beep on <60..20000>').

Using the previous code as the base, the demo code now plays 'Mary Had A
Little Lamb' on the squeaker ('beep mhall'), and a really lousy version
of
'Smoke On The Water' ('beep smotw'). I don't read guitar tablature, and
I
had a heck of time trying to find the notes and duration for the opening
riff.

Interrupt vectors are now in RAM by default. When the system starts,
they
are initially in flash. The FIQ interrupt (which does nothing but count
FIQ events) gets copied to RAM, as do the interrupt vectors. This
allows
the FIQ to run as fast as possible. Note that if 'fiq on' is running,
and
the beep commands are used, the FIQ interrupt counter will stop running,
as
the beep code also uses timer 1.

All the file related command have been moved to the 'file' submenu in
the
monitor. This makes the top level commands cleaner and more topical to
the
section they serve. Use 'file init' if you change the card without
rebooting the system. Remember to use 'file mount' to mount a MMC/SD
card
that's installed at boot or after 'file init'.

Added a prompt to indicate the system is ready for commands ("Demo>").
Thanks to Dave Madden (again) for that code fragment.

Improved USB performance, thanks to code from Jan Topolski. This fixes
the
issue where the system performs very poorly under Windows when connected
via USB. Windows apparently is sending a constant stream of NAKs, with
each NAK generating an interrupt. The effect of this could be seen when
running the MMC/SD card performance tests. When connected to a Windows
box, the performance was about 10% of that when connected to a Linux
box.

Jan also optimized the code that checks for the USB interrupt source.
In
the original code, all 32 possible interrupts were checked each time in
a
loop. The modified code aborts the loop early when it sees that all
interrupts have been handled.

The MMC/SD code should be more tolerant of various cards at the SPI
level.
David Johnson contributed an improved SPI I/O routine and reports that
Sandisk cards now work for him. Note that only cards which have 512
byte
sectors are supported.

The MMC/SD code now checks the card present (P1.25) and write protect
(P1.24) switches on the MMC/SD card socket. File operations will fail
if
the card is not present, or an attempt to write to a protected card is
made.

The MMC and SPI drivers have been factored out of the FatFS code so they
can be shared with the USB mass storage code (usbmass). This should
also
make it easier to port to other LPC2xxx family parts, such as the
LPC2468,
which has an improved MMC/SD interface.

The lpc210x.h header file has been updated with addition definitions,
primarily in the fast GPIO and the PWM modules.

Removed some unused files from the I2C code. Those files should have
been
deleted prior to the final release package.

Added -Wno-strict-aliasing to the FreeRTOS/Makefile to eliminate some
warnings. Also added -Wno-cast-align to FreeRTOS/Makefile and
usbmass/Makefile to eliminate some casting warnings.

The usbmass storage driver seems to work, although it is abysmally slow.
It's very inadvisable to use the 'file' commands while the MMC/SD card
is
mounted under Windows (and probably Linux), due to common buffers. The
driver is enabled in top-level Makefile, with the -D CFG_USB_MSC option.

Please note that the terminal window of Flash Magic is squirrely. I
thought there was a bug when copying large files to the console ('file
cp
'), and this sent me on a short wild goose
chase.
Garbage was being emitted after roughly 16K bytes. Turns out that the
Flash Magic terminal window is just plain slow, and it's getting stupid
when it can no longer keep up. Also, 'file cpcon ' expects
control-D to stop copying the file, and the terminal window does not
pass
control characters. ProComm (and others, but never, ever, EVER
HyperTerm)
is a much better choice for straight serial work.
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )


Re: LPC-2148 Demo Code v1.30 now available - Marcos Lucas - Oct 6 8:55:07 2008

Hi J.C!

I liked much your lpc2148_demo, and i would like to know what IDE and
compiler was used to develop.
Big Hug!
Thanks!
Marcos S. Lucas
Indaial/SC - Brazil
2008/10/6 J.C. Wren

> After almost a year of being slack, I have updated the LPC-2148 demo
> code
> package. Below are the changes (extracted from the README file). The
> latest version is available at http://jcwren.com/arm
> The code was compiled with GCC 4.2.4, and newlib 1.16 (please note the CVS
> version of newlib has changes which cause breakage. Once 1.17 is formally
> released, I will update the code to use it). I've tried to test everything
> in the package, but it's quite possible I broke something. If I screwed
> something up, please don't hesitate to let me know.
>
> --jc
>
> Updated FreeRTOS to version 5.0.4
>
> The I/O ports are now configured and used in fast I/O port mode, rather
> than legacy slow-poke mode. Most people in the real world have no need
> of
> the slower legacy mode.
>
> Added 'misc ports' command to display the _PIN, _DIR and _MASK registers
> of
> port 0 and 1.
>
> Added LCD example. There are two files in the lcd directory, lcd_4bit.c
> and lcd_8bit.c. The lcd_4bit is suitable for the Olimex LPC-P2148 board
> (which this demo code is targeted for). The lcd_8bit.c file is targeted
> for an LCD that has a full 8-bit interface. The 8-bit code was
> extracted
> from a previous project and is untested, but SHOULD either work as-is
> (adjusting for the port pin assignments, of course), or be very close.
> The
> LCD is handled in it's own task, started and stopped with 'lcd start'
> and
> 'lcd stop'. This shows dynamic task creation and destruction, and means
> the LCD task won't automatically start for users without LCDs connected.
> Use 'lcd msg ""' to display a message, 'lcd clear' to clear screen,
> and 'lcd gotoxy <0..1> <0..19>' to position the cursor for writing.
>
> Added PWM example. Unfortunately, this will require an oscilloscope or
> logic analyzer to be able to see the results of it. At reset, PWM5 is
> set
> up for a 20Khz period, and a duty cycle of 50%. The frequency can be
> varied with the 'pwm freq' command (between 1 and 48000000Hz), and the
> duty
> cycle can be varied with the 'pwm duty' command (between 0 and 100%).
> This
> code was extracted from another project that used it to control a bias
> circuit for LCD contrast.
>
> Added an example of using the timer 1 match registers. In a previous
> release, I had made the statement that how Olimex drove the speaker was
> flawed. Thanks to some code contributed by Dave Madden, it turns out
> that
> using timer 1 and the match registers, tones between 60 and 20,000 Hertz
> can be fairly easily generated. Either Olimex saw this early on, or
> they
> just got lucky ('beep off', 'beep on <60..20000>').
>
> Using the previous code as the base, the demo code now plays 'Mary Had A
> Little Lamb' on the squeaker ('beep mhall'), and a really lousy version
> of
> 'Smoke On The Water' ('beep smotw'). I don't read guitar tablature, and
> I
> had a heck of time trying to find the notes and duration for the opening
> riff.
>
> Interrupt vectors are now in RAM by default. When the system starts,
> they
> are initially in flash. The FIQ interrupt (which does nothing but count
> FIQ events) gets copied to RAM, as do the interrupt vectors. This
> allows
> the FIQ to run as fast as possible. Note that if 'fiq on' is running,
> and
> the beep commands are used, the FIQ interrupt counter will stop running,
> as
> the beep code also uses timer 1.
>
> All the file related command have been moved to the 'file' submenu in
> the
> monitor. This makes the top level commands cleaner and more topical to
> the
> section they serve. Use 'file init' if you change the card without
> rebooting the system. Remember to use 'file mount' to mount a MMC/SD
> card
> that's installed at boot or after 'file init'.
>
> Added a prompt to indicate the system is ready for commands ("Demo>").
> Thanks to Dave Madden (again) for that code fragment.
>
> Improved USB performance, thanks to code from Jan Topolski. This fixes
> the
> issue where the system performs very poorly under Windows when connected
> via USB. Windows apparently is sending a constant stream of NAKs, with
> each NAK generating an interrupt. The effect of this could be seen when
> running the MMC/SD card performance tests. When connected to a Windows
> box, the performance was about 10% of that when connected to a Linux
> box.
>
> Jan also optimized the code that checks for the USB interrupt source.
> In
> the original code, all 32 possible interrupts were checked each time in
> a
> loop. The modified code aborts the loop early when it sees that all
> interrupts have been handled.
>
> The MMC/SD code should be more tolerant of various cards at the SPI
> level.
> David Johnson contributed an improved SPI I/O routine and reports that
> Sandisk cards now work for him. Note that only cards which have 512
> byte
> sectors are supported.
>
> The MMC/SD code now checks the card present (P1.25) and write protect
> (P1.24) switches on the MMC/SD card socket. File operations will fail
> if
> the card is not present, or an attempt to write to a protected card is
> made.
>
> The MMC and SPI drivers have been factored out of the FatFS code so they
> can be shared with the USB mass storage code (usbmass). This should
> also
> make it easier to port to other LPC2xxx family parts, such as the
> LPC2468,
> which has an improved MMC/SD interface.
>
> The lpc210x.h header file has been updated with addition definitions,
> primarily in the fast GPIO and the PWM modules.
>
> Removed some unused files from the I2C code. Those files should have
> been
> deleted prior to the final release package.
>
> Added -Wno-strict-aliasing to the FreeRTOS/Makefile to eliminate some
> warnings. Also added -Wno-cast-align to FreeRTOS/Makefile and
> usbmass/Makefile to eliminate some casting warnings.
>
> The usbmass storage driver seems to work, although it is abysmally slow.
> It's very inadvisable to use the 'file' commands while the MMC/SD card
> is
> mounted under Windows (and probably Linux), due to common buffers. The
> driver is enabled in top-level Makefile, with the -D CFG_USB_MSC option.
>
> Please note that the terminal window of Flash Magic is squirrely. I
> thought there was a bug when copying large files to the console ('file
> cp
> '), and this sent me on a short wild goose
> chase.
> Garbage was being emitted after roughly 16K bytes. Turns out that the
> Flash Magic terminal window is just plain slow, and it's getting stupid
> when it can no longer keep up. Also, 'file cpcon ' expects
> control-D to stop copying the file, and the terminal window does not
> pass
> control characters. ProComm (and others, but never, ever, EVER
> HyperTerm)
> is a much better choice for straight serial work.
>
> [Non-text portions of this message have been removed]
>

--
Marcos S. Lucas
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC-2148 Demo Code v1.30 now available - "J.C. Wren" - Oct 6 9:16:48 2008

IDE? Pfffft. vi and the bash shell is the 'IDE' of choice :) And
arm-elf-gcc 4.2.4 under Gentoo Linux. Flash Magic on a Windoze box for
programming.

--jc

On Mon, Oct 6, 2008 at 8:11 AM, Marcos Lucas wrote:

> Hi J.C!
>
> I liked much your lpc2148_demo, and i would like to know what IDE and
> compiler was used to develop.
> Big Hug!
> Thanks!
> Marcos S. Lucas
> Indaial/SC - Brazil
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC-2148 Demo Code v1.30 now available - Marcos Lucas - Oct 6 9:29:10 2008

ahuahauhu
really??? hahaha
Very Cool =)
You also is Hamradio??
My callsign is ZZ5DSL :D

Marcos S. Lucas

2008/10/6 J.C. Wren

> IDE? Pfffft. vi and the bash shell is the 'IDE' of choice :) And
> arm-elf-gcc 4.2.4 under Gentoo Linux. Flash Magic on a Windoze box for
> programming.
>
> --jc
>
> On Mon, Oct 6, 2008 at 8:11 AM, Marcos Lucas >
> wrote:
>
> > Hi J.C!
> >
> > I liked much your lpc2148_demo, and i would like to know what IDE and
> > compiler was used to develop.
> > Big Hug!
> > Thanks!
> > Marcos S. Lucas
> > Indaial/SC - Brazil
> >
> > [Non-text portions of this message have been removed]
>

--
Marcos S. Lucas
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC-2148 Demo Code v1.30 now available - Harald Kubota - Oct 19 7:54:57 2008

J.C. Wren wrote:
> After almost a year of being slack, I have updated the LPC-2148 demo code
> package. Below are the changes (extracted from the README file). The
> latest version is available at http://jcwren.com/arm
>
I wanted to ask for version 1.20 already: in cpu/cpu.c, what is this
supposed to be?

GPIO0_FIODIR = ~(GPIO_IO_P14 | GPIO_IO_P15 | GPIO_IO_P15);

I guess the extra GPIO_IO_P15 can be removed, which is what I did,
but possibly it's supposed to be another GPIO port beside 14 and 15.

And in lpc210x.h there is no PCB_PINSEL1_P019_MASK defined.

Thanks a lot for the update as it includes some examples of stuff I
wanted to
use (e.g. PWM). And without testing the code (no time yet): if the PWM
frequency
is low enough (<10Hz), then you should be able to see PWM working with
a simple LED connected to the PWM output pin, so an oscilloscope is not
strictly needed to see the result of the PWM example. I'll visually verify
my claim later though.

Harald
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )

Re: LPC-2148 Demo Code v1.30 now available - "J.C. Wren" - Oct 19 8:32:29 2008

The last P15 was supposed to be P16 (P0.15 and P0.16 are the LEDs on the
Olimex board. I've reworked that where each module is responsible for
setting the I/O pin direction and states, rather than some of it being in
cpu/cpu.c Originally all I/Os were configured as outputs except P0.14,
P0.15, and P0.16. That was a mistake, as it's generally a poor practice to
change an input to an output without knowing what it does. By letting the
module initializations handle it, if a module is deleted, it's safer.
Consider a pin connected to a switch that's closed, and the pin is
configured as an output. Odds are fair of blowing the pin.

You're right, I missed adding the _MASK for P019. I've updated that in the
release I hope to have this week, which includes uIP + httpd using the
SPI-based ENC28J60 (it works, but it needs some cleanup and documentation).

That's correct about the LED, although you'd only be able to see really
gross changes, probably on the order of 10 to 20%. It's probably true that
more people have LEDs laying around than 'scopes or logic analyzers.

--jc

On Sun, Oct 19, 2008 at 7:54 AM, Harald Kubota wrote:

> J.C. Wren wrote:
> > After almost a year of being slack, I have updated the LPC-2148 demo code
> > package. Below are the changes (extracted from the README file). The
> > latest version is available at http://jcwren.com/arm
> >
> I wanted to ask for version 1.20 already: in cpu/cpu.c, what is this
> supposed to be?
>
> GPIO0_FIODIR = ~(GPIO_IO_P14 | GPIO_IO_P15 | GPIO_IO_P15);
>
> I guess the extra GPIO_IO_P15 can be removed, which is what I did,
> but possibly it's supposed to be another GPIO port beside 14 and 15.
>
> And in lpc210x.h there is no PCB_PINSEL1_P019_MASK defined.
>
> Thanks a lot for the update as it includes some examples of stuff I
> wanted to
> use (e.g. PWM). And without testing the code (no time yet): if the PWM
> frequency
> is low enough (<10Hz), then you should be able to see PWM working with
> a simple LED connected to the PWM output pin, so an oscilloscope is not
> strictly needed to see the result of the PWM example. I'll visually verify
> my claim later though.
>
> Harald
>
>
>
[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )