Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

vTaskDelay no return after blocking operation.

Posted by matita87 on August 23, 2017

Hi all, I using FreeRTOS V9.0.0 on STM32F4 microcontroller for TFTP server. The vTaskDelay never return when it is call after a blocking operation (e.g. after xQueueGenericReceive()) In details, the TFTP listening task is:

void TFTPserverlistening(void pArgs) { // Create a socket // Bind it to the desired port and protocol // Neverending loop while (1) { vTaskDelay(1000); //this works / wait for a connection request (wait a file to upload) - lwip stack / n = recvfrom(sd, &args->request, TFTPMAXMSGLEN, 0, (struct sockaddr )&args->from, (socklent )&fromlen); vTaskDelay(1000); //this dosen't work - NO RETURN }

where the recvfrom is define as lwiprecvfrom. The lwiprecvfrom is part of the lwipstack which use the xQueueGenericReceive in order to wait forever a incoming message. Similar problem can be obtain calling tow time the vTaskDelay with very long dela: vTaskDelay(10000); //this works, yep for 10 seconds it works :) vTaskDelay(1000); //this dosen't work - NO RETURN

Debugging the vTaskDelay and using the trace data log (with keil) I don't have see any problem,

Thanks all. m


vTaskDelay no return after blocking operation.

Posted by rtel on August 23, 2017

Possibilities for vTaskDelay() never returning would be:

1) The task that called vTaskDelay() is being starved out by higher priority tasks that never block.

2) The tick interrupt is not running (when the issue occurs, inspect the xTickCount variable or set a break point in the SysTick_Handler() ISR function or xTaskIncrementTick function to see if the tick count is still incrementing).

3) You have an old fashioned data corruption that has messed up the linked list from which the task is being referenced. Do you have configASSERT() defined? Do you have stack overflow protection turned on?

If everything works fine until recvfrom() is called then have a good look at that function to make sure there is no way it could exit with interrupts disabled, or from inside a critical section.


vTaskDelay no return after blocking operation.

Posted by matita87 on August 24, 2017

Hi Thank you for the reply

1) I don't get your seggestion. Do you think it could be a problem related to priority? The TFTPserverlistening task is created in main function with priority = 6. 2) During vTaskDelay running (never exiting) the system is alive (it is not in halt). The system tick Timer is runinng and the SysTick_Handler(void) routine is correctly executed (xTickCount is incrementing). Even the vApplicationIdleHook is running. 3) Where I can check if the configASSERT() and stack overflow protection are defined? 4) Yes, I am sure that the recvfrom() exit with all interrupts enable. Thanks m


vTaskDelay no return after blocking operation.

Posted by rtel on August 24, 2017

1) I don't get your seggestion. Do you think it could be a problem related to priority? The TFTPserverlistening task is created in main function with priority = 6.

I thought that was a possibility, but as you say that vApplicationIdleHook() is running it seems that is not the case.

2) During vTaskDelay running (never exiting) the system is alive (it is not in halt). The system tick Timer is runinng and the SysTick_Handler(void) routine is correctly executed (xTickCount is incrementing). Even the vApplicationIdleHook is running.

That is very curious then. Are you 100% sure vTaskDelay() is not returning? Have you tried taking a trace recording? (http://www.freertos.org/trace)

3) Where I can check if the configASSERT() and stack overflow protection are defined?

See the following links (and read the book): http://www.freertos.org/a00110.html#configASSERT http://www.freertos.org/Stacks-and-stack-overflow-checking.html http://www.freertos.org/Documentation/RTOS_book.html


vTaskDelay no return after blocking operation.

Posted by matita87 on August 25, 2017

OK thanks Regads


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists