Quality RTOS & Embedded Software

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


Loading

am I doing right on creating FREERTOS project

Posted by runfirst on July 12, 2013
I am new at FreeRTOS. If I make stupid mistake on setting it up., please be patien. thanks for any help.

I have a simple app running on STM32F407 Discovery board. It runs prety well, stays for days without problem.
However, I am not satified that tasks can not run simultaneously. So I get your information online.

I read the supported list. It does support my MCU. However it is IAR not KEIL. I dont really know how to use IAR.
So I set it up by following steps on this post:
http://www.freertos.org/Creating-a-new-FreeRTOS-project.html

First step I include the FreeRTOS's files:

FreeRTOS/Source/tasks.c
FreeRTOS/Source/queue.c
FreeRTOS/Source/list.c
FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c.
FreeRTOS/Source/portable/MemMang/heap_1.c


2nd step I add head path:

FreeRTOS/Source/include
FreeRTOS/Source/portable/RVDS/ARM_CM4F


3rd, copy the FreeRTOSConfig.h. from Demo\CORTEX_M4F_STM32F407ZG-SK under my project

4th, Interrupt Vectors , I dont understand this part. So I have no idea how to implement this in my project.

And I also add this line before tasks starts:
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );

I forget when I see a post regarding this.

I make simple task:

portTASK_FUNCTION( vStartMachine,  pvParameters )
{
/* Block for 500ms. */
STM_EVAL_LEDToggle(LED3);
vTaskDelay(1000);
STM_EVAL_LEDToggle(LED3);

}


Built it, fix some underfinded errors. then no warning no error.
Run it, well, no problem. then I add more tasks in it. I post it in another post here:
https://sourceforge.net/projects/freertos/forums/forum/382005/topic/8531370

when it is running UART related task, it will stop after minutes.

When it is stopped, I click on "stop" and see it is sending out uart datas. it is Usart_SendString(USART3,"TEST STATU\r\n"); failed at :

void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}


I tried increase the stack size to 2000, heap size to 10*10240...whatever, it still stop after almost same time.

I had searched all over this forum, tried a lot experiences from others. still no luck.

Whatelse do I miss in this setting up?

Thanks a lot.



RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 12, 2013
I dont know how to modify the post. contiued above

now I find out the problem.

I dont send any data to uart, then this app can run more than 1hour.

It seems incoming datas cause stack overflow. how to prevent this happen?

Regards

RE: am I doing right on creating FREERTOS project

Posted by Richard on July 12, 2013
My guess from this and your previous support thread is that your problem is not related to FreeRTOS, but either the driver you are using on the UART, or the integration of the driver with FreeRTOS. I asked you a couple of time how your delay() function is implemented, but so far, unless I missed it, you have not replied on that. Also on the point of whether your UART is using interrupts, because it could be a simple interrupt priority issue.

Regards.

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 13, 2013
Hi Richard

I had changed my delay to vTaskDelay already.
Yes, it uses UART3 interrupt for receiving incming datas. I creat a xTaskCreate( vUSARTTask for it. how to check interrupt priority issue?

RE: am I doing right on creating FREERTOS project

Posted by Dave on July 13, 2013
What is configMAX_SYSCALL_INTERRUPT_PRIORITY set to and what is the priority of the UART interrupt?

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 13, 2013
Uart was zero. Then i change it to 4. Now Both are 4.

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 13, 2013
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
configPRIO_BITS=4

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);

it will stop after minutes if I config as above.
How to fix it?

Regards

RE: am I doing right on creating FREERTOS project

Posted by Richard on July 13, 2013
I think near the beginning of your original thread references were provided that will show the configuration you just posted is incorrect. I could post the same links again, but would rather you went back and read what has already been posed in previous answers.

Regards.

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 14, 2013
Hi Richard

What post do you mean?
Would you please just tell me :
What is configMAX_SYSCALL_INTERRUPT_PRIORITY I should set to and what is the priority of the UART interrupt I should set?

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 15, 2013
Hi Richard

Now I am moving my app to your demo of CORTEX_M4F_STM32F407ZG-SK. I know it is different with my MCU.
Now, LEDs are working. UART is working too. However it sends lots of ????...to receiver.

I think it is because the bauterate is incorrect. But I dont know how to calculate it by your demo.

It is my first day using IAR because you only providedemo for IAR.

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 15, 2013
now it goes to void DebugMon_Handler(void). what is that mean?

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 16, 2013
I suggest your project should get more funds that can have more tech support..
I am upset about this .
I will go for UCOS. I dont care I might spend money on it but I do care bettter tech support.
good bye here.
thanks Richard.

RE: am I doing right on creating FREERTOS project

Posted by Richard on July 16, 2013
I am told that tech support for FreeRTOS is better than for most commercial OSes. In this case every new question you have asked, spanning across two threads, has been answered, mainly by graciously pointing out where the answers to your questions can be found within the documentation. Our aim is to maintain good documentation so there is a central resource that can be referenced by everybody, and referenced from the forum, rather than expend effort answering the same questions over and over again, where the answers will remain hidden inside a support thread and not easy to find.

My last reply to you was to say that the code you posted still had errors in it, but you have not commented on that, like you had not commented on most suggestions provided to you.

If you continue to use FreeRTOS then I would say, as I have said multiple times, that I don't think your problem is related to FreeRTOS, and if it is, it is purely a configuration problem - like calling NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); when the page a referred you to said explicitly, in bold, and in red font to stand out, not to do that.

Good luck with your project.

Regards.

RE: am I doing right on creating FREERTOS project

Posted by runfirst on July 28, 2013

Hi Richard


You said my code has error. However my code runs well without OS. Anyway, I was trying to make my code to fit your OS.

I have done everything as you suggested.

At that post:
http://sourceforge.net/projects/freertos/forums/forum/382005/topic/8531370

I replied you at last. But no reply back from you.

I also changed my code as you suggested. You last reply suggesting I do a hard faul tracking.
http://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html.
However there is no enough detail how to impletement this in my project. I pasate it in main.c. When I build it in KEIL, it gets errors.
And then you did not reply it again. I dont know what happen. so I open this post.

in this post, your last reply says dont calling NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); . I had tried it, still same.
I also tried heap1,heap2, heap3, heap4....no luck

For a good OS, it should be easy used. Or you provide enough simple details. Most ppl go for you because they dont have strong background/experience. Otherwise they can write good code without OS already. Dont expect I am same level as you. Like checking hard fault. where do I put those sample code? how do I fix problem? etc....it is not easy for a junor ppl like me

Regards

RE: am I doing right on creating FREERTOS project

Posted by Dave on July 28, 2013
Well I don't think you will find an OS that is easier, or has more publicly available examples for all experience levels or one that is better supported for that matter. There is even a tutorial book text for beginners.

Even if your code works without the OS it does not it will not interact with and have dependencies that are different when used with the OS. In this case your use of NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); is definitely an error that had already been pointed out. Your app may appear to work with this setting, but it will be unstable and given time will break. You need to call NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4) (as documented).

If you are still pursuing this I suggest using FreeRTOS V7.5.2 with configASSERT() defined because it will call assert() if you have this setting wrong.


[ 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