[En-Nut-Discussion] Ethernut newbie with a lot of questions

Harald Kipp harald.kipp at egnite.de
Sat Apr 22 12:05:05 CEST 2006


Hello Greg,

At 22:39 21.04.2006 -0600, you wrote:
>The work I have done has left me with more questions than
>when I started.

Obviously. The reply will result in a kind of FAQ. :-)


>
>Assuming the ethernut board is run behind a switch and not a hub how
>much processor load does the stack and OS exert?  Suppose that a simple
>web server and maybe a telnet session are running.  Is there a time
>limit that should be observed when a thread is blocking?  What is
>reasonable number of simultaneous connected sockets?

As long as no packet arrives or has to be sent, the
processor load is 0%. When a packet is handled, incoming
or outgoing, the load is 100%. Sorry, I didn't want to
make fun of this. But the question can't be answered easily,
because it depends on the application code. The CPU is running
at 100% all the time, either in idle thread, system or application
code.

Most Ethernet Drivers use a timeout while waiting for incoming
data. This is a safety feature to detect crashed Ethernet
Controllers. The load is probably far below 1%.

If you want a time limit while waiting, you can set the
read timeout socket option.

The number of simultaneous connections is limited by available
RAM, which again depends on your application code.

>
>What are the consequences if ethernut is run behind a hub and not a
>switch?

When connected to a HUB, Ethernut has to handle all broadcasts
of that segment. Depending on the number of connected nodes
and the type of services, this may indeed put a noticeable
load on Ethernut. Let me say it the other way. If 200 kBytes
are broadcasted every second, then Ethernut 1 will become
quite busy.

There had been several reports during the last weeks, that
Nut/OS fails when connected to large networks. But there is
no logged incident and all test to simulate this were negative.


>
>What is the best way to implement ISRs?  I'm done a lot of programming
>with WINAVR, can I still use SIGNAL functions?  Are there any special
>considerations when doing this?  Is there any new delays created in
>responding to an ISR from the OS/stack?

You can use native interrupts without limitation, except Nut/OS
for AVR uses timer 0 as it's system timer.

There are several delays caused by critical sections, where
Nut/OS disables interrupts. This topic has been discussed in
this group to some extends. There is still potential for minimizing
these sections.


>
>Are the streaming functions, specifically printf, interrupt based when
>used with the uart?

Depends on the UART driver you use. devDebug is a polling driver,
which allows you to use streaming functions in interrupt context.
devUsartAvr is fully interrupt driven, including hardware handshake
and half duplex control.


>
>I'm somewhat new to real time OSes.  Can someone point me to a good
>source if information about programming with Nut/OS?  I've read the
>ethernut software manual and it left me wanting more.  The nut/API
>reference does not have sufficient explanation for some things to make
>sense to me.  I'd like to see some example programs that take advantage
>of some of the features availabe in Nut/Os.  In the past I've used
>global variables to pass info in and out of ISRs, what is the prefered
>method to do this in Nut/Os?

The app directory contains a number of examples. Most developers
study the Nut/OS source code to see how things are done. There is
also book, but this requires that you can ready Chinese. :-)
Seriously, we are constantly working on this matter.



>
>I've got an application in mind in which several ethernet devices will
>exist on a robot and be connected via an ethernet radio to a LAN.  I'd
>like to have the oem radio module mounted atop my electronics which will
>likely be an ethernut compatible setup.  I want to avoid having to go
>radio->magnetics->switch<-magenets<-ethernut.  It seems to me that if
>everything will be build onto a PCB there is no need for magnetics.  Is
>there a chipset that implements a simple 4 or 5 port 10mbps switch that
>would allow me to avoid the magnetics for the devices that are on the
>pcb together, and also build the switch onto the PCB?

On a local segment like this there is no need to worry about
the load caused by broadcasts. Thus a HUB will be just fine.
May be someone else can answer the electrical part, but the
transformer build into Ethernut 1.3 also contains the filter.
On some other controller chips this filter is build in.



>
>Is there some software out there that will allow me to send information
>to specific IPs/ports via TCP and/or UDP?  Basically the equivalent of a
>serial terminal program that supports binary data.  For serial
>applications I've used windmill and brays terminal.

For TCP there probably are, for UDP probably not. I prefer
to write my own, adapted to the specific application. There's
nothing magic.



>
>Is it possible to port ethernut over to other members of the AVR family
>such as the new fangled 100 pin devices?

If you know a compiler which can generate code for these devices.
The main problem with Nut/OS is, that function pointers are
2 bytes, while the ATmega2560 requires 3 bytes. Similar problems
with the stack.


>
>Is there a way to manually read/send files from urom.c?  I wrote a
>simple CGI and it seems to me like it would be nice if you could just
>send out a file to fill in parts of a CGI page.

No, UROM is read-only. PNUT is volatile and PHAT is only
available for Ethernut 3 right now.


>
>I'd like to see some ethernut applications.  If someone could post some
>links to ethernut based projects that would be great.

http://www.ethernut.de/en/community/appliances.html
but mostly commercial.

A few others published some code, you may google for it.

For example:
http://www.usbdip.de/


>
>Anyone written a DNP3 driver for ethernut?

Not that I know of.


>
>Anyone interfaced an ethernut 1.3 board to a SD/MMC card?  How about
>other storage devices?

I've heard about MMC, but nothing had been finally documented.

Again Michael's page might be interesting
http://www.usbdip.de/

http://www.ethernut.de/en/medianut/index.html
The picture at the end of the page shows Datanut with
CF and IDE.


>
>How about an ethernet based bootloader?  Ponyprog is painfully slow.
>How can I use my STK500 compatible programmer with my ethernut board?

When you bought Ethernut, it contained a pre-loaded bootloader.
eboot is available here
http://www.ethernut.de/en/hardware/enut1/index.html


>
>Can Nut/Os be run on a stripped down system?  I.e. just the ATMEGA128?
>I'm thinking at least the external SRAM is required.

Yes, we use this in commercial applications. Of course, no
TCP/IP.


>
>Sorry for all the questions.  I'm sure some of them are answered within
>the ethernut documentation.  If you can refer me to certain documents
>thats great.  I've got a lot to learn about ethernut and ethernet and
>have gotten a little tired of reading and searching for information the
>last 3 days.


You're welcome. As long as this doesn't happen once a day,
it's OK to answer a couple of questions in one go. It's helpful
for others as well, who may have similar questions.

The answer might have been even faster, if you wouldn't have
used HTML formatting. The total size of your message was beyond
the 10k limit and the admit (me) had to manually confirm it.
More info is here
http://mailformat.dan.info/body/html.html

Harald




More information about the En-Nut-Discussion mailing list