STM32 Ethernet Demo

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
rubenswerk
Posts: 104
Joined: Wed Feb 22, 2012 11:39 am

Re: STM32 Ethernet Demo

Post by rubenswerk »

I did another try with a ping utility, and it shows that most packets are replied within <1ms (average 0.68ms), but there are lots of packets with a response time >10ms.

I did this test with a direct point to point connection PC <-> Olimex board.

When I do the same measurement with my private network router, I get a very similar result.

If the MAC can store a maximum of 4 RX packets (I didn't change the config), how can the situation happen that I showed in my Wireshark capture - the answer to 10 packets all at once...!?

With this information in mind (4 RX buffers), I'm quite sure that the result of a PC based sniffer is quite unsure ;-)
Do you have good experience with Linux-based sniffers?
Attachments
ping.png
ping.png (25.05 KiB) Viewed 6546 times
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32 Ethernet Demo

Post by Giovanni »

I just retested it, pinging it with packets of 1024 bytes through my home router:

ping.jpg
ping.jpg (22.61 KiB) Viewed 6545 times


Do you have some process in your PC that could cause that? I also attached that very ancient ping utility but doubt it makes any difference.

Giovanni
Attachments
UOTRACE.zip
(32.47 KiB) Downloaded 619 times
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: STM32 Ethernet Demo

Post by mabl »

Hi Giovanni,

I'm finally back from Australia and did give your new driver a quick test. It works, thank you so much! One thing I had to do was to activate software checksum calculation, any reason you don't do it in hardware?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32 Ethernet Demo

Post by Giovanni »

Hi,

No particular reason, does lwIP support it? it could be eventually added as a configuration option to the driver. I stopped working on it waiting for feedback but it looks very stable.

Giovanni
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: STM32 Ethernet Demo

Post by mabl »

Checksum calculation can be disabled in LwIP via the CHECKSUM_GEN_* macros. One problem we ran into early in this thread was wrong checksums in Ping packages - this is because the ICMP internal checksum cannot be disabled in lwip (which consequently messes up the hardware calculated checksum). Apart from this small patch on lwip - it works great with the wrapper driver.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32 Ethernet Demo

Post by Giovanni »

I will add the option in the weekend but I think I will leave it disable by default in the demo or users would have to patch lwIP before being able to properly use it.

It would be good if lwIP maintainers add official support for automatic CRC in some future version.

Giovanni
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: STM32 Ethernet Demo

Post by mabl »

Hallo Giovanni,

just an upgrade on this: In the trunk version of LwIP there is already a preprocessor switch CHECKSUM_GEN_ICMP and it will be included in lwip 1.4.1

http://lists.gnu.org/archive/html/lwip- ... 00018.html
http://git.savannah.gnu.org/cgit/lwip.g ... pv4/icmp.c
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32 Ethernet Demo

Post by Giovanni »

Excellent, we will make it default after integrating lwIP 1.4.1, is it already released?

Giovanni
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: STM32 Ethernet Demo

Post by mabl »

No, but since it is only a bugfix release (and there is a newly updated 1.4.1 branch in the git repo) I suppose it's going to be released within the next weeks.
rubenswerk
Posts: 104
Joined: Wed Feb 22, 2012 11:39 am

Re: STM32 Ethernet Demo

Post by rubenswerk »

I'm a little busy on other topics at the moment, but I had some time for hobby projects last weekend.

First of all, the STM32 lwIP demo (I took the latest trunk) seems to work fine, no problems at all. However, as mabl stated out, I would appreciate to have an option for hardware checksum. I would be sad to loose this very nice feature which was already working stable.

About my ping problem: thanks again Giovanni for the hint with other processes. I had an application running which does not cause any network traffic and only very low CPU load, but however, it's the root cause for the delayed packages. Without this process, the maximum ping time is 2ms after 1 hour of permanent high-speed pinging. For me, this is the proof that the timestamps of the pcap driver used by Wireshark are not reliable! It shows when my application called the send() function, but not when the OS actually transmitted the frame. I'm happy to know that there's no problem on the STM32 side.

In the meantime I received my STM32F4 Discovery board (sorry for being off topic). It was so easy to get the ChibiOS demo running on it. This is a perfect base for further developments, thank you Giovanni for providing this convenient example.

The native MAC driver, should it also work for the F4 peripheral? I ordered the Chinese PHY board and want to give it a try with the Discovery board. I'm afraid this will be quite challenging for me, I have to step quite deep into the ChibiOS configuration. Which approach would you recommend - shall I use the STM32F107 lwIP demo and adopt it to the F4 board, or shall I use the F4 demo as basis and add all the network stuff?

Kind regards, Ruwe
Post Reply