Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

STM32, FreeRTOS and lwIP - Timeout problems

Posted by Thomas Jespersen on January 6, 2013
Hi.
I have been trying hard to get my FreeRTOS v7.3.0 system working together with lwIP v1.4.1 and I have sucessfully managed to get connection and DHCP.
But when I try to use sockets it only works sometimes.

Most of the times it takes long, trying to connect, and then it times out.

I have been trying almost everything from changing the Heap Size, changing the TCP-IP stack and priority.
But as I don't know that much about RTOS yet, I am unsure if the problem might have something to do with interrupt priority of the Ethernet layer.

I don't know if the NVIC IRQ Priority of the Ethernet HAL should be set lower or higher.
I have been trying with
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
as it was how it was in the example STM32 Ethernet port.

Have any of you experienced the same type of timeouts or VERY slow response?

Thanks a lot.

Regards Thomas

RE: STM32, FreeRTOS and lwIP - Timeout problems

Posted by Richard on January 7, 2013
You would have to look at the execution pattern of the system to determine what was being slow. For example, does the stack start executing immediately that data is received, or is there a delay because the task processing the data is too low priority. Likewise when anything gets posted on a queue, are the sending task and receiving task running right away or waiting for other higher priority tasks to finish first? Etc.

I can't answer the question as to what the interrupt priority should be without knowing what your configMAX_SYSCALL_INTERRUPT_PRIORITY value is set to in FreeRTOSConfig.h. Basically it needs to be no higher than that (which on a Cortex-M means a numerically lower value). See the following page: http://www.freertos.org/RTOS-Cortex-M3-M4.html and particularly note the requirement to call NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); on STM32 parts.

Regards.

RE: STM32, FreeRTOS and lwIP - Timeout problems

Posted by Thomas Jespersen on January 7, 2013
Hi Richard.
Thank you for your response.
I have already set the Priority Group to 4 to enable 4-bit preemption mode only.
I have also read both your recommended page and this following forum post with about the same issue, which unfortunately didn't help me fixing my Ethernet issue: http://www.freertos.org/FreeRTOS_Support_Forum_Archive/October_2011/freertos_Random_hangs_with_STM32_4753773.html

How should I check the stack, if it is executing on time and the delay of the tasks (if any)?

Regards Thomas

RE: STM32, FreeRTOS and lwIP - Timeout problems

Posted by Thomas Jespersen on January 8, 2013
I have now done some logging and package sniffing and it seems like the webserver in the other end doesn't respond to the requests, rather than a problem with the RTOS and the lwIP stack.

This is the log:
root@DD-WRT:/tmp/smbshare/tmp/ipkg# tcpdump host 192.168.0.136
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br0, link-type EN10MB (Ethernet), capture size 96 bytes
21:06:16.755439 arp who-has 192.168.0.136 tell DD-WRT
21:06:17.749425 arp who-has 192.168.0.136 tell DD-WRT
21:06:18.749419 arp who-has 192.168.0.136 tell DD-WRT
21:06:19.009820 IP DD-WRT > 192.168.0.136: ICMP echo request, id 24829, seq 0, length 28
21:06:19.010268 IP DD-WRT.bootps > 192.168.0.136.bootpc: BOOTP/DHCP, Reply, length: 300
21:06:19.013484 IP DD-WRT.bootps > 192.168.0.136.bootpc: BOOTP/DHCP, Reply, length: 300
21:06:19.013816 arp who-has 192.168.0.136 tell 0.0.0.0
21:06:19.253541 arp who-has 192.168.0.136 tell 0.0.0.0
21:06:20.755843 arp who-has DD-WRT tell 192.168.0.136
21:06:20.756171 arp reply DD-WRT is-at 00:1c:10:36:55:d5 (oui Unknown)
21:06:20.756363 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:23.505626 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:26.505681 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:29.505745 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:32.505805 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:35.505865 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
21:06:38.505924 IP 192.168.0.136.49153 > api.theblast.dk.www: S 6509:6509(0) win 5840
STM32 Debug: TIMEOUT
21:06:40.058179 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:43.058028 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:46.058071 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:49.058133 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:52.058188 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:55.058256 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
21:06:58.058307 IP 192.168.0.136.49154 > api.theblast.dk.www: S 6583:6583(0) win 5840
STM32 Debug: TIMEOUT
21:06:59.565567 IP 192.168.0.136.49155 > api.theblast.dk.www: S 6731:6731(0) win 5840
21:06:59.587891 IP api.theblast.dk.www > 192.168.0.136.49155: S 2608560878:26085 60878(0) ack 6732 win 14600
21:06:59.588153 IP 192.168.0.136.49155 > api.theblast.dk.www: . ack 1 win 5840
21:06:59.589999 IP 192.168.0.136.49155 > api.theblast.dk.www: P 1:164(163) ack 1 win 5840
21:06:59.611974 IP api.theblast.dk.www > 192.168.0.136.49155: . ack 164 win 15544
21:06:59.677696 IP api.theblast.dk.www > 192.168.0.136.49155: P 1:221(220) ack 164 win 15544
21:06:59.678214 IP api.theblast.dk.www > 192.168.0.136.49155: F 221:221(0) ack 164 win 15544
21:06:59.678451 IP 192.168.0.136.49155 > api.theblast.dk.www: . ack 222 win 5619
21:06:59.729786 IP 192.168.0.136.49155 > api.theblast.dk.www: F 164:164(0) ack 222 win 5619
21:06:59.750428 IP api.theblast.dk.www > 192.168.0.136.49155: . ack 165 win 15544

In that case, as the server isn't responding properly, could it be something with the HTTP header?
The header I'm sending/using is:
GET / HTTP/1.1\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)\r\nHost: api.theblast.dk\r\n\r\n

Looking forward to your feedback.

Regards Thomas

RE: STM32, FreeRTOS and lwIP - Timeout problems

Posted by MEdwards on January 8, 2013
I think you would get a better answer by giving the same info and asking the same question on the lwIP mailing list. They are very helpful.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner