|
|
FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2010 Threads] FreeRTOS Crash on IAR LPC1768 Eval boardPosted by kittu112 kittu on November 16, 2010 Hello ...
I am using IAR Evaluation board as a development start up for battery managment project and I am using FreeRTOS as OS. I am experiencing some problems. I am kind of lost and felt I hit the wall. Need some pointers. Below are the list of issues I am facing
1. I started my development with uipWebserver demo FreeRTOS example. With some modifications I used the uipWebserver example in the project to read out the task's run time stats for the application. And slowly I started adding my other BMS application related tasks. This started increasing my SRAM consumption, which is understandable. So I accordingly started adjusting my FreeRTOSConfig.h and eventually when I go over 32K of SRAM bank, my application crashes immediately before even it runs. I know the LPC1768 has two separate banks of 32K SRAM, I have changed my IAR compiler to treat the two separate SRAM banks as one and it did it. But for some reason when I set configTOTAL_HEAP_SIZE to put the SRAM over 32KB after compilation, the whole application crashes with Hardfault exception error shown in the debugger. I use IAR workbench compiler and debugger. I am using IAR 1768-SK evaluation board as my development board.
2. Second problem, I have added few task to the BMS application and in the process I wanted bumped the priority of uipTask to (tskIDLE_PRIORITY + 6) and in the webserver's webpage in the runtime stats or in one of those tabs where it shows the each task's details shows the priority as 4. If I put the task priority as 5 or higher it shows up as 4 on the webpage. But other tasks whose priority is 4 or less shows up correctly. Why? I remember reading in the freertos manual that you can setup up priority numbers pretty high and can run any number of tasks.
3. Third problem, when I add a new task or change priorities around, the whole application becomes very unstable. Any info or pointers would definitely help me get going.
Just to give you an idea of the application tasks that are presently running.
int main( void ) { /* Configure the hardware for use by this demo. */ prvSetupHardware();
AppSetupHardware(); /* Create the uIP task. The WEB server runs in this task. */ xTaskCreate( vuIP_Task, ( signed char * ) "uIP", (configMINIMAL_STACK_SIZE * 4), ( void * ) NULL, (tskIDLE_PRIORITY + 6), NULL );
/* Create the task to do the Book keeping like polling and updating periodically */ //xTaskCreate( AppMain.Main, (signed char *) "BookKeeping", mainBASIC_CAN_STACK_SIZE, (void * ) NULL, mainBOOK_KEEPING_PRIORITY, NULL );
/* Create the Eeprom task. This task will handle periodic writes to Eeprom to store statistical data. */ //xTaskCreate( vStatsUpdate_Task, ( signed char * ) "Eeprom", configMINIMAL_STACK_SIZE*3, ( void * ) NULL, mainEEPROM_TASK_PRIORITY, NULL );
/* Create the CAN Rx task */ xTaskCreate( CanApi.RxTask, (signed char *) "eCANRx", (configMINIMAL_STACK_SIZE * 13) , (void * ) NULL, (tskIDLE_PRIORITY + 5), NULL );
/* Create the CAN Rx task */ //xTaskCreate( CanApi.TxTask, (signed char *) "eCANTx", mainBASIC_CAN_STACK_SIZE, (void * ) NULL, mainCAN_TASK_PRIORITY+8, NULL );
/* Create the simple LED flash task. */ //xTaskCreate( prvFlashTask, ( signed char * ) "Flash", configMINIMAL_STACK_SIZE*3, ( void * ) NULL, mainFLASH_TASK_PRIORITY, NULL );
/* Create the Timer task to calculate SoC, run TimerPoll(used for one time timer with call back function) & Charge Control Mgmt */ xTaskCreate( LpcTimer.Main, ( signed char * ) "TimerTask", (configMINIMAL_STACK_SIZE * 4) ,( void * ) NULL, (tskIDLE_PRIORITY + 4), NULL ); /* Create the A2DTask ( does TI communication every 2sec ) */ xTaskCreate( AppTaskA2D.Main, ( signed char * ) "AppTaskA2D", (configMINIMAL_STACK_SIZE*5), ( void * ) NULL, (tskIDLE_PRIORITY + 2), NULL ); /* Create the TaskControl ( manages Mosfet states, during charging, discharging and on startup and during sleep ) */ xTaskCreate( TaskControl.Main, ( signed char * ) "TaskControl", (configMINIMAL_STACK_SIZE*4), ( void * ) NULL, (tskIDLE_PRIORITY + 3), NULL );
/* Start the scheduler. */ vTaskStartScheduler();
/* Will only get here if there was insufficient memory to create the idle task. The idle task is created within vTaskStartScheduler(). */ for( ;; ); }
and
void AppSetupHardware( void ) { /* Initialize System clock */ SystemInit(); --> this is a function I called from CMSIS library, which has all the drivers nicely developed for Cortex - M3 NVIC_DeInit(); NVIC_SCBDeInit();
/* Set Vector table offset value */ #if (__RAM_MODE__==1) NVIC_SetVTOR(0x10000000); #else NVIC_SetVTOR(0x00000000); #endif /* Pin Configuration */
}
Thanks in advance
RE: FreeRTOS Crash on IAR LPC1768 Eval boardPosted by Richard on November 16, 2010 > 1. I started my development with uipWebserver demo FreeRTOS example. > With some modifications I used the uipWebserver example in the > project to read out the task's run time stats for the application.
Note that the run time and task stat tables are good for debugging purposes, but generating the tables leaves interrupts disabled for a long time so they are not so good for production code.
> And slowly I started adding my other BMS application related tasks. > This started increasing my SRAM consumption, which is understandable.
Did you also remove the other 'standard demo' tasks that you don't need? That in turn will free up RAM.
> So I accordingly started adjusting my FreeRTOSConfig.h and eventually > when I go over 32K of SRAM bank, my application crashes immediately > before even it runs. I know the LPC1768 has two separate banks of 32K > SRAM, I have changed my IAR compiler to treat the two separate SRAM > banks as one and it did it. But for some reason when I set > configTOTAL_HEAP_SIZE to put the SRAM over 32KB after compilation, > the whole application crashes with Hardfault exception error shown in > the debugger.
Check where the Ethernet buffers are being placed. I think it will be in one of the AHB RAM sections, but it might not necessarily show up in the map file - depending on how they are defined. They might befined as arrays or just as hard coded addresses. In the latter case you might be getting some memory usage overlap.
I'm not sure what the LPC17xx requirements are for accessing the AHB RAM directly, rather than from the Ethernet or USB DMA.
> I use IAR workbench compiler and debugger. I am using > IAR 1768-SK evaluation board as my development board. > > 2. Second problem, I have added few task to the BMS application and > in the process I wanted bumped the priority of uipTask to > (tskIDLE_PRIORITY + 6) and in the webserver's webpage in the runtime > stats or in one of those tabs where it shows the each task's details > shows the priority as 4. If I put the task priority as 5 or higher it > shows up as 4 on the webpage. But other tasks whose priority is 4 or > less shows up correctly. Why?
What is configMAX_PRIORITIES set to in FreeRTOSConfig.h?
> I remember reading in the freertos > manual that you can setup up priority numbers pretty high and can run > any number of tasks.
That is correct, but configMAX_PRIORITIES should be as low as your application allows, to save RAM, so it might be set to 5 (priorities 0 to 4 then being valid).
> 3. Third problem, when I add a new task or change priorities around, > the whole application becomes very unstable. Any info or pointers > would definitely help me get going.
Are you using interrupts? By far the most common cause of support requests on CM3 devices is people getting their interrupt proprieties inverted (0 is the highest priority, which is counter intuitive), or not setting the priority at all (which will mean it has a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY) or using a function to set the priority and passing in the function parameter incorrectly (some functions require the priority to be shifted to the most significant bits, some want it unshifted and do the shifting internally).
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|