Hi,
I am creating FreeRtos project For LED ON/OFF using LPC54113 MCU as per Demo Code reference .But Freertos vTaskStartScheduler() not working?
Below are the code,
#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "LPC54113.h"
#include "fsl_debug_console.h"
#include "FreeRTOS.h"
//#include "queue.h"
#include "task.h"
void ECG_TASK(void *pvParameters);
/* TODO: insert other include files here. */
/* TODO: insert other definitions and declarations here. */
/*
* @brief Application entry point.
*/
int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
//#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
// /* Init FSL debug console. */
// BOARD_InitDebugConsole();
//#endif
// GPIO_PinWrite(BOARD_INITPINS_SD1_GPIO,BOARD_INITPINS_SD1_PORT,BOARD_INITPINS_SD1_PIN,0U);
xTaskCreate(ECG_TASK, "ECG_task", configMINIMAL_STACK_SIZE, ((void *)0), 1, NULL);
vTaskStartScheduler();
// GPIO_PinWrite(BOARD_INITPINS_SD1_GPIO,BOARD_INITPINS_SD1_PORT,BOARD_INITPINS_SD1_PIN,1U);
while(1);
}
void ECG_TASK(void *pvParameters)
{
while (1)
{
GPIO_PinWrite(BOARD_INITPINS_SD1_GPIO,BOARD_INITPINS_SD1_PORT,BOARD_INITPINS_SD1_PIN,1U);
vTaskDelay(100);
GPIO_PinWrite(BOARD_INITPINS_SD1_GPIO,BOARD_INITPINS_SD1_PORT,BOARD_INITPINS_SD1_PIN,0U);
}
}
Thanks,
TDC
You should check the return code of xTaskCreate if it was successful at all.
Then you could set a breakpoint on ECG_TASK function to see if it's hit (and the task was started by the scheduler)
Also I'd recommend to enable the debug features FreeRTOS provides like define configASSERT and enable stack checking.
See also https://www.freertos.org/FAQ.html for more useful hints.
xTaskCreate return pdPASS .But scheduler have not start,ECG_TASK function breakpoint not hit.
did you step into the start scheduler routine to see what is not working? It could be that it run on an assert or into a fault condition. Let it run and then pause with the debugger to see where it is stuck.
Code stuck in Scheduler routing Problem solve.But,
Now Scheduler run only once.For continuous run task what to do ?.
Now Scheduler run only once.For continuous run task what to do ?.