User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

lwIP - A Lightweight TCP/IP stack

Wed Jan 02, 2013 7:09 pm

Hi,

I saw one reference for lwIP (http://savannah.nongnu.org/projects/lwip/) in this forum.
Anyone trying to make a port?

Thanks. Regards, Arjan
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

tufty
Posts: 1454
Joined: Sun Sep 11, 2011 2:32 pm

Re: lwIP - A Lightweight TCP/IP stack

Thu Jan 03, 2013 7:23 am

Given that IP runs, by necessity, over USB on the Pi, it's gonna have to wait until there's a fully working USB implementation up and running.

jorisvergeer
Posts: 6
Joined: Wed Jul 18, 2012 3:33 pm

Re: lwIP - A Lightweight TCP/IP stack

Wed Jan 09, 2013 8:44 pm

Actually, LWiP does not need usb.

The only thing LWiP needs is a way to pass on and receive bits. the fysical layer doesn't matter.

You can use for example GPIO to send the ethernet packages to another RPi.

User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

Re: lwIP - A Lightweight TCP/IP stack

Wed Jan 09, 2013 9:10 pm

Hi Joris,

The Ethernet controller used on the Raspberry Pi is connected to the SoC via USB. So I really need to wait for full USB implementation.

Grt, Arjan
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

ghans
Posts: 7360
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: lwIP - A Lightweight TCP/IP stack

Wed Jan 09, 2013 9:19 pm

Oh well , i'd be interested in Ethernet over GPIO :D
Where would be the technical speed limit on that ?


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
DavidS
Posts: 3009
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: lwIP - A Lightweight TCP/IP stack

Wed Jan 09, 2013 11:56 pm

Ethernet over GPIO, has some one be thinking about the Xerox Alto:-) ? That is definately doable . Heck if we are delving into sof hardware what about VGA over GPIO?
ARM BASIC: For the love of Simplicity, Fast Interpreted BASIC, and Assembly Language.
Always KISS Keep It Simple Silly.

User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

lwIP - A Lightweight TCP/IP stack

Sun Oct 12, 2014 3:27 pm

Already ported?

Thanks, Arjan
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

treii28
Posts: 71
Joined: Fri May 10, 2013 4:52 pm

Re: lwIP - A Lightweight TCP/IP stack

Sat Sep 23, 2017 12:36 pm

I haven't dived into decoding packets/protocols in ages. Would it be possible to use something like lwip to to things similar to ipTable rules to forward all port 80 to your softAP address?

User avatar
Ronaldlees
Posts: 224
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 4:46 pm

DavidS wrote:
Wed Jan 09, 2013 11:56 pm
Ethernet over GPIO, has some one be thinking about the Xerox Alto:-) ? That is definately doable . Heck if we are delving into sof hardware what about VGA over GPIO?
I too wonder what the speed of such a thing might be. RISCOS comes to mind, as I've been trying to figure a way to do WiFi without the add-on bridge/repeater hardware that's usually suggested, or a second Pi just to do the WiFi. So far I've come up with the idea of using I2C or serial IO to a Photon, but someone who did something similar indicated that the throughput was less than ideal.

The serial IO might work for the OP though ...
I am The Umbrella Man

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 6:05 pm

We have been thru all this before the IO speeds are fixed by the GPIO clock speeds
Raspberry Pi 1 of 22.7Mhz, Raspberry Pi 2 of 41.7Mhz and the Raspberry Pi 3 at 65.8Mhz

Subtract away your per packet bits and you would get the maximum possible speeds.
For example if you ran a software UART format 1 start 8 data no parity 1 stop you need 10 bits to get 8 across so the transmission speed is 8/10ths of quoted maximum speed.

You will also struggle to get the Pi2 and Pi3 off the board at those max speeds without a lot of buffering there isn't huge drive available at those speeds.

It is no faster and a heck of a lot more work than just using the onboard USB and Ethernet proper. Most baremetal implementations will put a fake hub at device 1 for the communication so bridging, relaying and routing is really trivial. I know I even call mine Faked Root Hub (tm) as a joke when I first stated playing around.

Now if you connect two Pi's by Ethernet or USB which will give you around 20Mbs anyhow.
The Pi Zero including the W doesn't have the ethernet port so the USB port supports OTG mode and you directly connect it to another Pi without the tricks around the USB connection for normal Pi's. It's used a fair bit in clusters
http://raspberryjamberlin.de/zero360-pa ... to-a-pi-3/

So there are much simpler options out there that no one would really bother.
Last edited by LdB on Tue Sep 26, 2017 6:22 pm, edited 1 time in total.

User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 6:21 pm

LdB wrote:
Tue Sep 26, 2017 6:05 pm
We have been thru all this before the IO speeds are fixed by the GPIO clock speeds
Raspberry Pi 1 of 22.7Mhz, Raspberry Pi 2 of 41.7Mhz and the Raspberry Pi 3 at 65.8Mhz

Subtract away your per packet bits and you would get the maximum possible speeds.
For example if you ran a software UART format 1 start 8 data no parity 1 stop you need 10 bits to get 8 across so the transmission speed is 8/10ths of quoted maximum speed.

You will also struggle to get the Pi2 and Pi3 off the board at those max speeds without a lot of buffering there isn't huge drive available at those speeds.

It is no faster and a heck of a lot more work than just using the onboard USB and Ethernet proper.

Now if you connect two Pi's by Ethernet or USB which will give you around 20Mbs anyhow.
The Pi Zero including the W doesn't have the ethernet port so the USB port supports OTG mode and you directly connect it to another Pi without the tricks around the USB connection for normal Pi's. It's used a fair bit in clusters
http://raspberryjamberlin.de/zero360-pa ... to-a-pi-3/

So there are much simpler options out there that no one would really bother.
This is the Bare metal forum. The request was a lwIP implementation on top of the USB stack.
Meanwhile we have a Bare metal TCP/IP stack with Circle (https://github.com/rsta2/circle).
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 6:26 pm

Yes I know I have about 10 implementations of various things on Baremetal on the USB/Ethernet.

What I think you are not understanding is the Ethernet is part of the USB on the Pi it's device 2 in the chain. You don't have to sit over the USB you can build it into the USB.

You actually can't use the Ethernet without first bringing up the USB on the Pi :-)

User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 6:32 pm

LdB wrote:
Tue Sep 26, 2017 6:26 pm
Yes I know I have about 10 implementations of various things on Baremetal on the USB/Ethernet.
Links to source code?
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

User avatar
Arjan
Posts: 218
Joined: Sat Sep 08, 2012 1:59 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 6:34 pm

LdB wrote:
Tue Sep 26, 2017 6:26 pm
You actually can't use the Ethernet without first bringing up the USB on the Pi :-)
See also my previous append with
The Ethernet controller used on the Raspberry Pi is connected to the SoC via USB. So I really need to wait for full USB implementation
http://www.raspberrypi-dmx.org/
Open Source DMX/RDM/MIDI/OSC/Art-Net/sACN solutions

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: lwIP - A Lightweight TCP/IP stack

Tue Sep 26, 2017 7:01 pm

You lost me you already gave the linked to circle which I thought had a full USB implementation and a partial Ethernet, they at least show you how to open the special pipe endpoint as I remember?

If you need something specific I don't have an issue putting it up for you. So if you look at my AAARCH64 sample I have been messing around with which is real real basic. It's about the simplest USB implementation possible :-)
https://github.com/LdB-ECM/Raspberry-Pi ... m32_64_USB

So do you want me to just connect the Ethernet on it for you to play with. You will see LAN9512 gets enumerated as device 3 I just need to open the special pipe endpoint on that code and select poll, DMA or interrupts method for send receive channels. Device one is my fake hub and device 2 is the real Pi hub. Four and onwards will be whatever else you have plugged into the USB.

It's real basic but it works and you just connect the data to the usual stack and away you go. That is sort of shaking my head you are making out it is far harder than it is.

Xinu has a pretty clean explaination of what is involved ... set mac address and setup bulk transfer.
http://embedded-xinu.readthedocs.io/en/ ... N9512.html

Other than that explain to me what you want and I can probably put it together, my only constraint is I am true baremetal I have no switcher or threads like say Ultibo does so you need to tell me how you want the data delivered. I am pretty sure Ultibo has everything running out of the box if you want a simple solution. Anyhow on my code the control channel is automated but once you commit to data exchange you need to have DMA, Interrupts or polling setup because it will come at you at about 12MBs in Full speed mode.

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: lwIP - A Lightweight TCP/IP stack

Wed Sep 27, 2017 1:38 am

Ultibo has had TCP since it was first released ;)
Over the last 1 and 1/2 years most of the bugs have been sorted too :D

But Ultibo is not baremetal enough for most people, because you can actually make stuff with it :lol:
Some people do baremetal because they like learning the low level stuff.
Others use baremetal because Linux gets in the way.

Since Garry wrote his own TCP/IP stack for Ultibo he can tell you how long it took :shock:

Most people would start here first.
http://dunkels.com/adam/software.html
Only 2003? I thought it was much older.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: lwIP - A Lightweight TCP/IP stack

Wed Sep 27, 2017 2:35 am

Yep you know I already think he has done fantastic work and it is definitely the most complete system out there, but yes it gets in the way for me. That isn't an indictment on the Ultibo or it's system, it is much more a reflection that I am messing around not doing normal "in the box" stuff. To be honest no system would work for me and why I have never bothered to try to build one.

You don't have to tell me how much work Gary has done, I have done a lot less than him and I have lost so many man hours into this stuff :-)

For local LAN direct ethernet transmission between two devices you control, you can fire packets without needing a TCP/IP stack at all you just craft your own packets and fire to your own endpoints. It is when you want to go out on the internet proper you need TCP/IP stack and even then depending what you want to do you can only need partial features. For novices a good start point I would suggest is something like
https://barrgroup.com/Embedded-Systems/ ... ded-TCP-IP

For some of the situations like port forwarding above there is no requirement for anything like a TCP/IP stack, you are simply acting as "man in the middle" router changing TCP/IP packet headers. The communication ultimately is between two other devices you are simply eavesdropping on the communication and all you need to be able to do is identify the protocol header packet and copy or change it and all following packets that belong to it. Things like IpTables, Routers, filtering and firewalls tend to be packet bashers because they aren't a source or destination of the packets. If you are interested in packet bashers the hardware packet basher sites will give you the flow charts and overview with less confusion
https://github.com/NetFPGA/netfpga/wiki/ReferenceRouter
https://en.wikipedia.org/wiki/NetFPGA

Return to “Bare metal”

Who is online

Users browsing this forum: No registered users and 3 guests