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
STM32 Ethernet Demo
- 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
Can this be reproduced using ICMP? I could give it a try using ping.
Giovanni
Giovanni
Re: STM32 Ethernet Demo
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.
Under Linux such a ping can be achieved with ping -s 1470 192.168.1.20.
-
rubenswerk
- Posts: 104
- Joined: Wed Feb 22, 2012 11:39 am
Re: STM32 Ethernet Demo
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.
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
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
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?
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?
- 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
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
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
-
rubenswerk
- Posts: 104
- Joined: Wed Feb 22, 2012 11:39 am
Re: STM32 Ethernet Demo
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
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
-
rubenswerk
- Posts: 104
- Joined: Wed Feb 22, 2012 11:39 am
Re: STM32 Ethernet Demo
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
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
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
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
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...