EmbeddedRelated.com
Forums

RTOS + Scripting + Ethernet + Web + FAT + ... + N

Started by Boris Estudiez March 25, 2007
25/Mar/2007 - 02:31 PM

Hi All,

I'm planning to use the following software
modules in my LPC2138 microcontroller:

* Real Time Operating System (uCOS-II or FreeRTOS).
* Ethernet (ENC28J60, drivers, protocol ...).
* TCP/IP Stack + Web Server (lwIP).
* Scripting (Virtual Machine -> Pawn Language).
* Secure Digital Card (FAT16/32 -> EFSL).

The LPC2138 has 512KB Flash / 32KB RAM
and 60 MIPS of processor speed.

I want to know how much processor speed and
memory would be required approximately ?.

The LPC2138 is able to run those modules properly ?.

Thanks in advance.

Regards,
Boris Estudiez.-

PS: The project will be used to control
industrial machines.

--

Contacteme en:
* Mail(1): stk freeshell.org
* Mail(2): 43824 electronica.frc.utn.edu.ar
* Mail(3): slicetex hotpop.com
* Website: http://stk.freeshell.org
EOF

An Engineer's Guide to the LPC2100 Series

Boris Estudiez wrote:
>
> 25/Mar/2007 - 02:31 PM
>
> Hi All,
>
> I'm planning to use the following software
> modules in my LPC2138 microcontroller:
>
> * Real Time Operating System (uCOS-II or FreeRTOS).
> * Ethernet (ENC28J60, drivers, protocol ...).
> * TCP/IP Stack + Web Server (lwIP).
> * Scripting (Virtual Machine -> Pawn Language).
> * Secure Digital Card (FAT16/32 -> EFSL).
>
> The LPC2138 has 512KB Flash / 32KB RAM
> and 60 MIPS of processor speed.
>
> I want to know how much processor speed and
> memory would be required approximately ?.
>
> The LPC2138 is able to run those modules properly ?.
>

IMHO, you are taking a huge byte (sic) out of the LPC2138. The
processor has so little RAM that it is practically useless for serious
work such as you outlined. Sure, it has tons of Flash, but the SRAM is
such a limiting factor...

I switched a design from the LPC2138 over to the LPC2214 to take
advantage of the external RAM interface. That design does have an
ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.

The LPC2138 only has 32K of SRAM. When you create a file stream buffer
(FILE * someFile) and use it (fopen) that consumes 1K of RAM for just
the file stream itself. The FAT filesystem library will need some
amount of RAM for an I/O buffer (at least 512 bytes) for each opened
file. So, at a minimum, each opened file consumes 1.5K. When you close
a file (fclose), the file stream buffer is not recovered (there is no
free() that is done). True, you can reuse the FILE to open another
file, but how useful is that to be constantly tracking the state of one
or two file buffers use / availability?

However, depending on what other work the unit has to do other than run
the SD card, Ethernet and IP stack, you might cram it all in there...

I switched my design to use the SD card to store the program binaries
and they are loaded-on-demand into the external SRAM, then executed from
there. I have enough problems getting all the features that I need for
the application working without constantly worrying if I have enough RAM
to store data.

Regards,

TomW

--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------
--- In l..., Tom Walsh wrote:
>
> Boris Estudiez wrote:
> >
> > 25/Mar/2007 - 02:31 PM
> >
> > Hi All,
> >
> > I'm planning to use the following software
> > modules in my LPC2138 microcontroller:
> >
> > * Real Time Operating System (uCOS-II or FreeRTOS).
> > * Ethernet (ENC28J60, drivers, protocol ...).
> > * TCP/IP Stack + Web Server (lwIP).
> > * Scripting (Virtual Machine -> Pawn Language).
> > * Secure Digital Card (FAT16/32 -> EFSL).
> >
> > The LPC2138 has 512KB Flash / 32KB RAM
> > and 60 MIPS of processor speed.
> >
> > I want to know how much processor speed and
> > memory would be required approximately ?.
> >

> IMHO, you are taking a huge byte (sic) out of the LPC2138. The
> processor has so little RAM that it is practically useless for
serious
> work such as you outlined. Sure, it has tons of Flash, but the
SRAM is
> such a limiting factor...
>

I'd tend to agree.

Unless you're trying to push through huge amounts of data and/or do
signifcant procssing on it (as in DSP-type number crunching), the CPU
will not be a limiting factor.

The code should fit as well.

The biggest issue you'll face is RAM capacity, as Tom pointed out.

Whilst you can certainly put together a very useful system that
supports your requirements using the on-board RAM, you will be
continuously fighting against the SRAM limit. For example, you could
avoid using standard APIs such as sockets for networking and
interface directly with TCP directly, do all your own memory
management etc. etc. It can be done, but takes time, effort and you
tend to up with a fairly customised system.

Unless you're building a high-volume product (in the tens of thusands
or above) the additional unit cost and complexity of using external
RAM is easily juistified given the above: you'll find everything a
whole lot easier.

Brendan.
--- In l..., Tom Walsh wrote:

> I switched a design from the LPC2138 over to the LPC2214 to take
> advantage of the external RAM interface. That design does have an
> ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.

External memory on LPC many times slower than SRAM -- so performance
takes a hit?

Jaya
jayasooriah wrote:
>
> --- In lpc2000@yahoogroups .com ,
> Tom Walsh wrote:
>
> > I switched a design from the LPC2138 over to the LPC2214 to take
> > advantage of the external RAM interface. That design does have an
> > ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.
>
> External memory on LPC many times slower than SRAM -- so performance
> takes a hit?
>

As always, the question remains "how real do you need your realtime to be?".

TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------
--- In l..., Tom Walsh wrote:
>
> jayasooriah wrote:
> >
> > --- In lpc2000@yahoogroups .com
40yahoogroups.com>,
> > Tom Walsh wrote:
> >
> > > I switched a design from the LPC2138 over to the LPC2214 to take
> > > advantage of the external RAM interface. That design does have
an
> > > ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.
> >
> > External memory on LPC many times slower than SRAM -- so
performance
> > takes a hit?
> > As always, the question remains "how real do you need your realtime
to be?".
>
> TomW

The other point I'd note is that the efficiency of the network and
file system (if required) software becomes important, particularly
that it avoids copyiny data around memory as much as possible.

If data structures and state variables are held in local SRAM, with
external memory being used just as buffer space for data, and data is
not copied, it's likely the system will not be bound by external
memory access speed.

Brendan
On 26/03/2007 at 08:19:29 -0000 Brendan Murphy Wrote:
> --- In l..., Tom Walsh wrote:
> >
> > jayasooriah wrote:
> > >
> > > --- In lpc2000@yahoogroups .com ,
> > > Tom Walsh wrote:
> > >
> > > > I switched a design from the LPC2138 over to the LPC2214 to take
> > > > advantage of the external RAM interface. That design does have an
> > > > ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.
> > >
> > > External memory on LPC many times slower than SRAM -- so performance
> > > takes a hit?
> > >
> >
> > As always, the question remains "how real do you need your realtime to be?".
> >
> > TomW
>
> The other point I'd note is that the efficiency of the network and
> file system (if required) software becomes important, particularly
> that it avoids copyiny data around memory as much as possible.
>
> If data structures and state variables are held in local SRAM, with
> external memory being used just as buffer space for data, and data is
> not copied, it's likely the system will not be bound by external
> memory access speed.
>
> Brendan
>

Thanks very much to everybody.

I think that scripting speed for basic control operations (such as
turn on/off power outputs, get signal voltages, etc required
for my project) is not critical, so external RAM will work fine
as you pointed out.

Network (Embedded Web Server) will be used to select which script
stored into the SD Card will loaded for execution. Also the Web
Server will be used for show data and basic remote configuration.

Thanks again.

Regards,
Boris Estudiez.-

--

Contacteme en:
* Mail(1): stk freeshell.org
* Mail(2): 43824 electronica.frc.utn.edu.ar
* Mail(3): slicetex hotpop.com
* Website: http://stk.freeshell.org
EOF
> On 26/03/2007 at 08:19:29 -0000 Brendan Murphy Wrote:
>> --- In l..., Tom Walsh wrote:
>> >
>> > jayasooriah wrote:
>> > >
>> > > --- In lpc2000@yahoogroups .com ,
>> > > Tom Walsh wrote:
>> > >
>> > > > I switched a design from the LPC2138 over to the LPC2214 to take
>> > > > advantage of the external RAM interface. That design does have an
>> > > > ENC28J60 and FAT16 filesystem on it, and, 512K of SRAM.
>> > >
>> > > External memory on LPC many times slower than SRAM -- so performance
>> > > takes a hit?
>> > >
>> >
>> > As always, the question remains "how real do you need your realtime to
>> > be?".
>> >
>> > TomW
>>
>> The other point I'd note is that the efficiency of the network and
>> file system (if required) software becomes important, particularly
>> that it avoids copyiny data around memory as much as possible.
>>
>> If data structures and state variables are held in local SRAM, with
>> external memory being used just as buffer space for data, and data is
>> not copied, it's likely the system will not be bound by external
>> memory access speed.
>>
>> Brendan
>> Thanks very much to everybody.
>
> I think that scripting speed for basic control operations (such as
> turn on/off power outputs, get signal voltages, etc required
> for my project) is not critical, so external RAM will work fine
> as you pointed out.
>
> Network (Embedded Web Server) will be used to select which script
> stored into the SD Card will loaded for execution. Also the Web
> Server will be used for show data and basic remote configuration.
>
> Thanks again.
>
> Regards,
> Boris Estudiez.-
>
> --
>
> Contacteme en:
> * Mail(1): stk freeshell.org
> * Mail(2): 43824 electronica.frc.utn.edu.ar
> * Mail(3): slicetex hotpop.com
> * Website: http://stk.freeshell.org
> EOF
>
Hi,

I've been elsewhere for a few days so have not read all of this thread - so
please ignore if I am repeating anything or my comments are irrelevant.

If you are not requiring a high network throughput then you could consider
using uIP in place of lwIP. uIP is very memory and processing time
efficient. Its main drawback is that it can only have one ack outstanding
at any time, which makes talking to Windoze slow if you want to send lots of
small packets. If you have control of both ends of the connection, or can
transfer all your data in a single large packet, then the limitation is very
much minimised.

FYI I have just compiled using GCC with -Os an lwIP WEB server demo that
uses EFSL to read HTML pages from an SD card. Here are the basic figures
(SAM7X ARM7 target):

text data bss dec hex filename
82732 2148 60720 145600 238c0 rtosdemo.elf

although they are somewhat limited in their applicability as the memory used
by the kernel and stack are configurable in any case. Also this build
includes FreeRTOS demo files unrelated to the stack or WEB server.
I also have a demo running that uses lwIP on an LPC2368 building with Rowley
CrossWorks. This is not tidy enough to release yet but I could send you a
map file from the build if you are interested. It does not include EFSL.

Regards,
Richard.

+ http://www.FreeRTOS.org
A free real time kernel for 8, 16 and 32bit systems.

+ http://www.SafeRTOS.com
An IEC 61508 compliant real time kernel for safety related systems.