vTaskDelay problem - C8051F120 Silabs

fjburgoa wrote on Saturday, May 23, 2009:

Dear members.

I’d like to post a problem concerning the vTaskDelay primitive. So you can give me any idea about how to proceed.

I’m using FreeRTOS in a Silicon Labs C8051F120 development board and the SDCC compiler (as indicated in the demo).

I’ve slightly modified the demo code, to simplify the tasks. The code consists on
- hardware start-up: prvSetupHardware() and prvSetupSystemClock()
-  just one single task that toggles a bit and suspends its execution for some ticks
- the main function: It performs hwd start-up and scheduler init.

I compile the code without any problem. I download it into the hardware, but when I start running the code, it always keeps blocked in the vTaskDelay function. I tried to change task stack size and xDelay time, but it is always blocked in that point until I reset the hardware.

Does anybody have any idea to solve this problem?

Below I show the code of the application.

Task looks like this:
static void LoopTask(void *pvParameters){
     const portTickType xDelay = 125 / portTICK_RATE_MS;
     ( void ) pvParameters;


This task is initialized in main function in this way:

void main(void){
    xTaskCreate( LoopTask, "TAREA",  configMINIMAL_STACK_SIZE,  NULL, tskIDLE_PRIORITY + 1, ( xTaskHandle * ) NULL );

Many Thanks for your help!!

edwards3 wrote on Saturday, May 23, 2009:

Check that the tick interrupt is working. If the tick is not executing then tasks that call vTaskDelay() will never unblock.

fjburgoa wrote on Monday, May 25, 2009:

Thanks edward3 for your answer.
Then to check that the tick interrupt is working, How should I proceed?

In a non FreeRTOS application I have to activate corresponding interrupt enable: IE, TI0, …
but in FreeRTOS, is there any primitive to do that? I mean, it can be
a bit confusing to mix high level instructions like vTaskDelay and low level like IE=1.

In case the user is in charge of enable and activate these interruptions, where is the
more convenient place, Just before calling the scheduler start-up?

Many thanks for your help.

Javier Burgoa

ragbagger wrote on Thursday, June 04, 2009:

I have the same problem. Here is the sequence:

Main() runs and calls vTaskStartScheduler()
From there all goes well and control is passed to the first task:
which starts to execute. At this point interrupts are enabled but the clock hasn’t reached the first tick. Execution proceeds to calling:
which executes down to the bottom force reschedule loop which calls:
At this point interrupts are disabled and control is never returned to original task and the timer ISR is not run since interrupts are disabled.

Any help would be appreciated.