LPC54113 Freertos

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC54113 Freertos

2,160 次查看
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 项奖励
回复
7 回复数

2,140 次查看
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 项奖励
回复

2,139 次查看
TDC1333
Contributor III

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

0 项奖励
回复

2,119 次查看
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 项奖励
回复

2,111 次查看
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 项奖励
回复

2,127 次查看
hs2
Contributor I
So something else isn't setup correctly. I think defining configASSERT could help to narrow down the issue.
0 项奖励
回复

2,113 次查看
TDC1333
Contributor III

@hs2

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

0 项奖励
回复

2,109 次查看
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 项奖励
回复