Page 16 of 26

Re: STM32 Ethernet Demo

Posted: Wed May 02, 2012 8:51 am
by rubenswerk
Hi mabl,

you did a great job, thank you. Offload mode 3 works very pretty now.
I'm looking forward to doing some benchmarks regarding network performance.

There is one small issue remaining, which I did not have with the old lwip demo which was based on the STlib MAC driver: when I send UDP packets with a payload of 1472 bytes (based on the the maximum Ethernet MTU size of 1500 bytes) from the host to my board, the packets are ignored by the driver. A payload of <=1470 bytes is ok. I tried to increase lots of configuration values (there is enough SRAM in the F407), but without success. It's no problem if you know about this limitation, but in the beginning I got crazy because I couldn't receive data.

Bye, RuWe

Re: STM32 Ethernet Demo

Posted: Wed May 02, 2012 9:20 am
by Giovanni
Can this be reproduced using ICMP? I could give it a try using ping.

Giovanni

Re: STM32 Ethernet Demo

Posted: Wed May 02, 2012 9:30 am
by mabl
Good idea, a quick test showed that pings with payload of up to 1470 work (+8 Bytes header). This was on the default LwIP demo without checksum.

Under Linux such a ping can be achieved with ping -s 1470 192.168.1.20.

Re: STM32 Ethernet Demo

Posted: Wed May 02, 2012 10:55 am
by rubenswerk
Sorry it will take until Saturday till I have my test setup available...
But as far as I understood mabl, he can reproduce the problem on ICMP layer. ping should work with up to 1472 bytes.

What I can say:
The 1470 bytes problem does not depend on hardware checksum or processor type. I can reproduce it on F107 and F407, with both software- and hardware checksum.

Re: STM32 Ethernet Demo

Posted: Wed May 02, 2012 11:18 am
by mabl
Just had a quick look. The big ping package is dropped by mac_lld_get_receive_descriptor because the STM32_RDES0_ES bit is set. This bit is an error summary bit. The only error is DS (Descriptor error) bit which

When set, this bit indicates a frame truncation caused by a frame that does not fit within the current
descriptor buffers, and that the DMA does not own the next descriptor. The frame is truncated. This
field is valid only when the last descriptor (RDES0[8]) is set.


The last descriptor bit is also set. The whole rdes0 register has the value 0x5ecc300. The old driver did not disregard packages by itself, so it might very well be that you did only receive a truncated UDP package.

I'll have a look later if we can get around this error somehow.


EDIT:
Just captured a trace with wireshark. A ping with 1470 payload maps to 1499 bytes IP frame and 1512 bytes ethernet frame. STM32_MAC_BUFFERS_SIZE is set to 1518, so there should fit some more bytes in it, right?

Re: STM32 Ethernet Demo

Posted: Sun May 06, 2012 9:46 am
by Giovanni
Hi,

I ran some tests, after increasing the default buffer size from 1518 to 1522 pinging with packets of 1472 bytes works, it is possible that the MAC unit requires enough space in the buffer for the CRC too, probably this is something hidden somewhere in the documentation.

Anyway, now it works so I will just increase that parameter default.

BTW, not opening a ticked because it is all unreleased code.

Giovanni

Re: STM32 Ethernet Demo

Posted: Mon May 07, 2012 10:04 am
by rubenswerk
Thanks for feedback, I'll try to do a test.
On the weekend, I was able to test DP83848 in MII configuration clocked by F4 MCO with 25MHz (up to now I only used RMII mode). It works fine. The MCO source has to be set to HSE. The PLL is not suitable as clock source due to its jitter, as discussed before.
There is one strange effect, my board sometimes gets stuck in the startup code since I use the 25MHz crystal instead of the 8Mhz. I haven't found the reason yet; I guess it hangs in one of the wait loops for voltage or PLL stabilization. I want to solve this issue before going on with ETH testing.
Bye, RuWe

Re: STM32 Ethernet Demo

Posted: Mon May 07, 2012 11:32 pm
by rubenswerk
Hello Giovanni,

I didn't have a look at the updatet trunk yet, have you already corrected the name in the #if statement? I think it should start with STM32_xxx

#if !defined(MAC_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define STM32_MAC_BUFFERS_SIZE 1518
#endif

Bye, RuWe

Re: STM32 Ethernet Demo

Posted: Wed May 16, 2012 12:15 am
by ninesunsz
hi
i want to port the ethernet demo to the stm32f207.The stm32f207 use RMII on my board.The mac phyter is dp83848i. The clock of dp83848i was connected with pa8(mco1).The board can work normal use firmware about lwip of ST.It demonstrate the hardware should have no problewm. if i connect my board with 10M network with firmware of Chibios. it is OK.but it can't work on 100M network. Then can anyone give me advice about it?Thanks

Re: STM32 Ethernet Demo

Posted: Wed May 16, 2012 7:44 am
by Jacon
ninesunsz wrote:hi
i want to port the ethernet demo to the stm32f207.The stm32f207 use RMII on my board.The mac phyter is dp83848i. ...
if i connect my board with 10M network with firmware of Chibios. it is OK.but it can't work on 100M network. Then can anyone give me advice about it?Thanks

It's impossible to use MCO output from STM32F2 or F4 for driving DP83848I in RMII - 100M mode.
Signal quality is not so good. There was long discussion about that in this thread before... ;)