Quality RTOS & Embedded Software

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


Loading

PIC Memory Problem

Posted by Nobody/Anonymous on May 9, 2007
Hello!!

I'm using Freertos with PIC 18F8821, i have 5 tasks running well in differents projects but when i put all together it works just for 10 seconds, then the program reset....

Can you help me please? i'm changing the value of the #define portTOTAL_HEAP_SIZE but doesn't work...

Thanks for all your ideas!!! i'm in big problems with that...

Rob

RE: PIC Memory Problem

Posted by Richard on May 10, 2007
Have you checked the return value of xTaskCreate() to make sure the tasks are actually being created successfully? Also check that the tasks are not running out of stack space - you allocate the size of the stack as a parameter to the xTaskCreate() API function when the task is created.

Regards.

RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 10, 2007
thanks for your help, i'm sure that all the task are succesfully create like that

check=sTaskCreate( Task_Main, ( const portCHAR * const ) "Main", portMINIMAL_STACK_SIZE, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

and each task has define the portMINIMAL_STACK_SIZE with the minimun value to work.. at this moment i have:

check=sTaskCreate( Task_Main, ( const portCHAR * const ) "Main", 120, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

check=sTaskCreate( Task_INFR, ( const portCHAR * const ) "Main", 110, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

check=sTaskCreate( Task_OBSRV, ( const portCHAR * const ) "Main", 120, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

check=sTaskCreate( Task_Marcadores, ( const portCHAR * const ) "Main", 90, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

check=sTaskCreate( Task_PosXY, ( const portCHAR * const ) "Main", 150, ( void * ) pParamEvento1,mainTASK_MAIN, NULL );

and the #define portTOTAL_HEAP_SIZE ( 3150 )

Check is 1 when i'm using the mplab's debuguer (breakpoints), but it works for few seconds after it reset without breakpoints.... i'm thinking to change the pic for one with much memory like 8722 .... do you think it can works? or i will have the same problem?

PIC 18F8621
Program Memory Data Memory
Flash #Single-Word SRAM(bytes) EEPROM(bytes)
(bytes) Instructions
64K 32768 3840 1024



PIC 18F8722
Program Memory Data Memory
Flash #Single-Word SRAM(bytes) EEPROM(bytes)
(bytes) Instructions
128K 65536 3936 1024


The PosXY task works with 20 differetns float variables, so when i put the other tasks all is good.... bur when i put the PosXY with the others the problem appear...

I don't know what else can i do..... i have to work whit this floats ... so do you have an idea??

Thanks again for your help.... i'm very worried i have to finish it very soon......

Thanks and have a nice day!!!




RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 10, 2007
Are the floating point variables on the stack? If so then try declaring them static.

Is the .math and .tmpdata section sizes equal to the setting in the FreeRTOS configuration file as described on the PIC18 page?

RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 10, 2007
Thanks for your help.... this is the task:

i defined all the variables out of the task at the beggining of the program....(only this task will use it)

float fDesplazamiento;

float fDesplazamientoDerecho;
float fDesplazamientoIzquierdo;
float Xnueva=0;
float Ynueva=0;

float fThetan_1;
float fXn;
float fYn;
float fThetan;
char estadoAnterior;
char estadoAnterior1;

static volatile unsigned portCHAR cont = ( unsigned portCHAR ) 1;
static volatile char a=0;
static volatile char b=0;
float fXnA=0, fYnA=0,fThetanA=0;
float Xa, Ya;
float acumuladorx=0, acumuladory=0;

float newX=0;
float newY=0;
float separacion=10;
static volatile byte cual;
static volatile byte antcual=0;

float ang=0;
float antnewx=0;
float antnewy=0;
char sensor;


static void Task_PosXY( void *pvParameters )
{
Contador algo;
portTickType xDelayTime = mainNO_ERROR_CHECK_PERIOD;
char u;
byte centro;
int casillaX=1;
int casillaY=1;

Param_evento *pParamEvento, ParamEvento;

pParamEvento = (Param_evento *) pvParameters;
ParamEvento=*pParamEvento;
fDesplazamiento=0;
estadoAnterior=0;
estadoAnterior1=0;

fDesplazamientoDerecho=0;
fDesplazamientoIzquierdo=0;
acumuladorx=0, acumuladory=0;
fXn=0;
fYn=0;
fThetan=0;

Xnueva=0;
Ynueva=0;

Encoder_Inicializar();

for(;;)
{
//....task code

}//fin for

}

i will try to put it static.... the problem is that i have to use one more task... so what do you think to change the pic ?

thanks for all your help!!!!

RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 10, 2007
Hello!! one question more if i have more than 19 bytes who can Freertos works when i have only this task?

and can you help me to know how is the way to know the value that you have to change for this constant?

#define portCOMPILER_MANAGED_MEMORY_SIZE0x13

thanks so much!..

RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 10, 2007
You have to look in the map file at the size of the .tmpdata and .mathdata sectors. This is why the C18 compiler is not a good C compiler. Search for portCOMPILER_MANGAED_MEMORY_SIZE on the following page http://www.freertos.org/a00097.html (shouldnt that be configCOMPILER_MANAGED_MEMORY_SIZE?)

RE: PIC Memory Problem

Posted by Nobody/Anonymous on May 11, 2007
Thanks !! so much for your help it seems to work!!!! i changed the constant defined and the macros now is working everything!!!

Thanks again and have a very nice day!!!!!!


[ 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