|
From: | Noam Weissman |
Subject: | Re: [lwip-users] Connection freeze after 29200 Bytes |
Date: | Sat, 6 Aug 2016 15:36:16 +0000 |
Hi,
STM32F4 is a micro processor and not a processor with huge amount of RAM !
First of all I suggest using LwIP 1.41 and not the older 1.32 that has bugs.
Secondly do not use such large buffers there is no reasoning for that. Use the LwIP default 536 bytes or standard TCP size 1460 or similar.
If you define a large window that means you need to set a few buffer with that size and that's a big
issue. My default MSS size is 536 bytes and I have no problems sending or receiving large files 600-800K
The reason for using a small MSS size is that I also use a TCP server (telnet) like and I do not want to use large buffers in order to send small chunks of data. This compromise is good for me.
Depending on the FLASH size you use. Normally FLASH uses a page size of 256 bytes and a sub sector
or sector that has 4K bytes. I do not see why you need to collect 64K bytes before you burn it to FLASH. At maximum I think you need 4K, but again it depends on the FLASH itself.
If you can burn pages of 256 bytes what I will do is collect data into a 256 byte buffer and once I have 256 I will write that page. Take more data from the TCP packet and if it does not fill the 256 byte buffer wait for the next TCP packet and add the fragmented data...
Once you get the last packet write what ever is left in the temporary buffer.
If you use a large FLASH (more then 2M byte) that need to erase a sub sector of 4K at most I would define a 4K buffer and do the above.
BR, Noam.
From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Norbert Kleber <address@hidden>
Sent: Saturday, August 6, 2016 2:03 PM To: address@hidden Subject: [lwip-users] Connection freeze after 29200 Bytes Hello everyone,
I ran into a problem while implementing the LwIP stack v1.3.2 onto the STM32F4 Evalboard. My Intention is to build a bootloader application while using Raw API. I want to transmit the .bin file in Parts of 64kB (matching the CCM) to the microcontroller, put it into the CCM and after that is filled or all data is transmitted to write the data into the FLASH. As long the file to transfer is smaller than this magical 29200 Bytes every thing works fine, but if it exceeds that limit the TCP connection freezes after transmitting the 29200Bytes. Wireshark didn't see any messages following that freeze not even a keep alive message. If i stop my terminal program that is sending the data the frame for closing the connection is send and answered. To control the data transmission i have a second tcp connection to another port where i am sending control instructions like how many bytes to expect. The acknowledgements to these frames had somehow a decreasing window size. That happens as follows:
Is there a mistake in interfacing the lwIP stack? The windowsize update function is disabled.
I took the driver as well as the interface out of the ethernet example for STM32F4Evalboar + STM32F4DIS-BB from element 14. i would be grateful for any hint. sincerly, Norbert |
[Prev in Thread] | Current Thread | [Next in Thread] |