LPC54113 Freertos

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC54113 Freertos

2,051 Views
TDC1333
Contributor III

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

0 Kudos
Reply
7 Replies

2,031 Views
hs2
Contributor I

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.

0 Kudos
Reply

2,030 Views
TDC1333
Contributor III

xTaskCreate return pdPASS .But scheduler have not start,ECG_TASK function breakpoint not hit.

0 Kudos
Reply

2,010 Views
ErichStyger
Specialist I

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.

0 Kudos
Reply

2,002 Views
TDC1333
Contributor III

@ErichStyger 

Code stuck in Scheduler routing Problem solve.But,

Now Scheduler run only once.For continuous run task what to do ?.

0 Kudos
Reply

2,018 Views
hs2
Contributor I
So something else isn't setup correctly. I think defining configASSERT could help to narrow down the issue.
0 Kudos
Reply

2,004 Views
TDC1333
Contributor III

@hs2

Now Scheduler run only once.For continuous run task what to do ?.

0 Kudos
Reply

2,000 Views
hs2
Contributor I
Did you step through the complete task code ?
Or does it hang in vTaskDelay ?
Is FreeRTOS xTaskIncrementTick() invoked means the SysTick is running correctly ?
0 Kudos
Reply