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

Some questions..

Posted by Willem on February 9, 2009
Hi,

First of all, thanks again for all your support so far. I really liked it.
Tomorrow I've my first milestone, then I've to present my boss the software that I have already.
I managed to get the OS quite stable, but I had to remove some things for it :(. For example the RS232.

I am now already spending three days to find the unpredictable behavior of the OS when integrating the RS232, interrupt based. I`m a bit clueless, I did all the things I could find on the website and more.

Problem:
Random freezes of the OS when using the RS232 task.

Info:
PIC32 port with multi vector interrupts
Using MP-LAB IDE with Microchip compiler
Running total of 7 tasks:
- Display gatekeeper Task
- SPI Task
- RS232 Task( actually RS485 )
- KeypadTask
- Menu Task
- Task manager (the one that spawns all the tasks)
- Analog to digital

Note:
Different tasks can get each other data by using the defined functions like getAdc, setSpi, etc. Every get/setter is protected by a Mutex or Queue.

What did I try:

1:)
See if it is not a stack overflow by using the method 2. Unfortunately this macro doesn't work for me. I don't know if it is a processor specific thing. When I paste the prototype and function in the main, it will never gets executed. I tested this by stripping down a task stack to a known value where it should overflow. Nothing happened.

2:)
So I tried a piece of my own. I created a function like this:

if( uxTaskGetStackHighWaterMark( NULL ) < 100 )
{
// not enough stack :(
while(1)

And called it in every task. Since I've put a breakpoint in the while, I get noted if a task has less than 100 stack left (I know, this is much. But for the debug only).
No task gets here, so I assume that every task has enough stack. (May i assume this?)

3:)
With the MPLAB Real-Ice i checked many status registers when the OS freezes. Like some status from peripherals from SPI / RS232, but found nothing special. I see that the Timer1 is still incrementing. But no other task gets executed any more when a freeze happens.

What I did not yet tried is to use the trace utility. That is because I do not yet own a Logic Analyzer. I will order this somewhere this week, so i hope this will help to solve more.

Does anyone have any idea's where I can look for now? I am really clueless =(.
This is my first OS and I really like it. I`m also introducing it on my work and there is a high change that they will use it in the feature. So I then hope to switch quickly to the commercial variant (for some real support :) )

Hope someone can give me some advice, thanks.

RE: Some questions..

Posted by alex lysogorov on February 9, 2009
i m not a master in this rtos, but have some experience in rtos architecture...may be my thoughts would be useful.
1. check if you have timer interrupts, because scheduler is driven from this source.
If you can see facts of calls oo scheduler code periodically, then you must to understand why your tasks are not switched.
It can be because
-you are in infinite loop in highest priority code of your programm
-you have disabled task switching via some 'critical section' and forgot to enable it, or are in look in this guarded region.
if your some of your stack is broken - usually it hangs the software. do your stack greater for a test.
It seems there is smth wrong in your ISR dedicated to RS, or in task which handle its data. What about its priority? Try for a while make it lower.

RE: Some questions..

Posted by alex lysogorov on February 9, 2009
***-you have disabled task switching via some 'critical section' and forgot to enable it, or are in look in this guarded region.***
are in LOOP in this guarded region.

also an advice - try to not "play in priorities" in your task.
better to have - "user priority" and "runtime priority". Do not use if possible, - higest priority, the system gives to you.
When your system consists of tasks with different, "well tuned" priorities - usually it means that it is wrong implemented, or hardware is feeble for your project.


[ 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