2015-06-25 01:48 AM
In my project I use a STM32F4 Discovery with a phy adapter DP83848 to create an ethernet connection between my board and my laptop. I use it to acquire measure.
I use F4Cube as library with the stack LWIP and I don't use RTOS. I create a TCP server on my board and use a TCP terminal as a client on my laptop. My connection works well and is stable with no paquet lost at 10Mbits.Here is my main problem, I would like to send each measure that I acquire through one USART as soon as I get one (my STM32F4 send a command each time to get one). These measures are small (30 octets). The problem is, between two measure I get a 10ms delay due (I think) to the TCP/IP stack and I don't know where looking to reduce this one.During this 10ms delay I can't send anoter command to acquire a new measure so my maximum acquisition frequency is stuck at 100Hz.Any idea to reduce this delay? #discovery #stm32f4 #lwip2015-06-25 03:40 AM
You can try to optimize your protocol. For example get 10 measures every time instead of 1 then you will have 1000Hz.
2015-06-25 11:16 PM
I can't, I need a continous acquisition. I can't take only 10 measures and after, wait 10ms where I can't continue to measure to be able to send last 10 one.
I saw many option (memory size, buffer size, paquet size, paquet fragment...) on the LWIP stack (opt.h and lwipopts.h) but I don't know which one is critical in my case. I also try to desactivate nagle algorithme but I got no effect on this delay.2015-06-29 06:46 AM
Hello McCliff
probably TCP/IP is not the correct protocol for your usecase. TCP/IP has no deterministic in the delivery. Chose something like EtherCAT (Real Time). However if you stay with TCP, you should start by disabling Nagle algorithm. also you may get better results by using UDP. Also the LWIP poll interval (default 250ms) can have an influence on you.2016-11-04 04:07 AM
Hi McCliff,
I work on a configuration that is like yours:A board with STM32F1 that samples data and act as a server, in order to send a stream of data to the connected client Computer.I already took a look at the examples of the LwIP from F1CubeMX, but at the end I couldn't get so much help from them.Could you please give me some clues on where to start? thank you very much2016-11-07 01:36 AM
Hello,
I'd recommend you to have a look to the User manual, in the paragraph ''B.3.6 LwIP'' for the STM32CubeMX LwIP side.For more details about LwIP, I suggest that you take a look to the following resources which can help you to go further in your application:-
“Developing applications on STM32Cube with LwIP TCP/IP stack“.- “lwIP TCP/IP stack demonstration for STM32F107xx connectivity line microcontrollers� .Regards