Quality RTOS & Embedded Software

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




Loading

Tasks compile and don't work

Posted by karima7 on April 9, 2016

Hello everyone,

I work with FreeRTOSV9 for the HCS12 family. I added a code to manipulate the LEDs in the main function, and it worked well, and when I joined this snippet of code into tasks, the project compiles, but the LEDs fail to light up, I don't really know if it's a problem with the management of interrruption or not, if that is the case how can I solve it? I must inform you that I created a new project, and I integrated the different files necessary to have a FreeRTOS kernel following the steps of creating a new project under the FreeRTOS website.

Please find below the code that I used :

~~~~ void MyTask1(void* pvParameters);

void main(void) {

DDRP = 0x0F;

PElowlevel_init();

xTaskCreate( MyTask1, ( signed char * ) "MyTask1", configMINIMALSTACKSIZE, NULL, 1, NULL );

vTaskStartScheduler();

for(;;){}

}

void MyTask1(void* pvParameters) { while(1) {

    PTP=0x08;

    vTaskDelay(5000);
}

}

~~~~

Thank you in advance for your help.


Tasks compile and don't work

Posted by heinbali01 on April 10, 2016

Hi Karima,

I would be curious to see if this would make a change:

~~~~~ void MyTask1(void* pvParameters) { while(1) { PTP=0x00; vTaskDelay(2000);

    PTP=0x08;
    vTaskDelay(2000);
}

} ~~~~~ What compiler are you using?

Can you use an in-circuit debugger and see if MyTask1 is called? Can you confirm that main() is called? In case main() is not called: does you project need a separate startup-code, maybe an assembler source file that calls your main()?

Are you using C-only or mixed with C++? If the code is placed in a C++ file, add the calling type:

extern "C" void MyTask1(void* pvParameters);

Can you check if vPortTickInterrupt() is called in either:

~~~~~ FreeRTOS/Source/portable/GCC/HCS12/port.c FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c ~~~~~


Tasks compile and don't work

Posted by rtel on April 10, 2016

I work with FreeRTOSV9 for the HCS12 family.

It sounds like you have the RTOS running on the HCS12. There have been a lot of questions about this recently.

I added a code to manipulate the LEDs in the main function, and it worked well

I presume that means you have code that toggles LEDs without the RTOS running, and that is functioning.

, and when I joined this snippet of code into tasks, the project compiles, but the LEDs fail to light up

So up to this point my understanding is:

1) You have the RTOS running without the LED code in the task. 2) You have the LED code working outside of an RTOS task. 3) If you add the LED code into the RTOS task then the RTOS task is no longer running.

Is this correct?

If so, when the RTOS task is not running, what is it doing? It is very hard to see how adding the line:

PTP=0x08;

into the task would make a difference as it is unlikely that code would either generate an interrupt or use any stack.


Tasks compile and don't work

Posted by karima7 on April 10, 2016

Hello,

Thank you very much for your answers.

Yes indeed the three points you made, describes perfectly my problem. So what can I use instead of PTP = 0x08 in the task? I tried the function you suggested me Mr.Hein, but it didn't work. I work with the CodeWarrior IDE 5.9.0 compiler, and I just created a project with C. I compiled step by step, and it actually made the call of different functions that I used, and enters the main function. I check if the vPortTickInterrupt () function is called in the port.c file path: FreeRTOS/Source/portable/CodeWarrior/HCS12/port.c and indeed it is already integrated and developed down the file port.c

/ * Tick context switch function. This is the timer ISR. * / vPortTickInterrupt void interrupt (void);


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

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