apessina wrote on Tuesday, February 16, 2010:
Hi, I’m a FreeRTOS absolute beginner and I’m trying to add a simple Led Flasher task to the LM3S811 evaluation kit.
I’ve found the following code and very simply, inserted in main.c.
Unfortunately I don’t rememer the author’s name but I publicly thank him.
Added some #defines (near the ‘Demo Board Specifics’ #defines):
#define mainUSER_LED GPIO_PIN_5
Right after that, add a #define for the blink rate (1000 ms = 1 second):
#define mainLED_DELAY ((portTickType) 1000/portTICK_RATE_MS)
Added a prototype for the task function:
static void vUserLEDTask(void *pvParameter);
In the main() function, added the call to create the task after
the other demo tasks (modelled exactly after the other task create calls):
xTaskCreate(vUserLEDTask, “UserLED”, configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY - 1, NULL);
In the prvSetupHardware() function, added a line to configure the GPIO pin
as an output, immediately after the section that configures the push button input:
GPIODirModeSet(GPIO_PORTC_BASE, mainUSER_LED, GPIO_DIR_MODE_OUT);
And finally, added the actual blinking task after the other tasks:
static void vUserLEDTask(void *pvParameter) {
for(; {
GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, mainUSER_LED); // let it shine
vTaskDelay(mainLED_DELAY);
GPIOPinWrite(GPIO_PORTC_BASE, mainUSER_LED, 0); // take a break
vTaskDelay(mainLED_DELAY);
}
}
But once flashed the demo program hangs.
If I comment out the added parts, the original demo program works ok.
The FreeRTOSConfig.h is the original demo one and the compiler is the IAR Embedded Workbench.
CSTACK is 0x400 and HEAP is 0x800.
Any suggestion?
Thank you
Antonio
Milano - Italy