I try to run a simple piece of code in a FreeRTOS task for Infineon TC387, I created an emty project for my evaluation board(KIT_A2G_TC387_5V_TFT), then imported the kernel in my project and the portables from here: [Free RTOS/FreeRTOS-Kernel-Partner-Supported-Ports].
/* code */
Unfortunately FreeRTOS task is never executed(I checked also with the debugger). Any clue where the issue could be?
Thank you!
void core0_main(void)
{
IfxCpu_enableInterrupts();
/* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
* Enable the watchdogs and service them periodically if it is required
*/
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword());
/* Wait for CPU sync event */
IfxCpu_emitEvent(&g_cpuSyncEvent);
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
/* Create LED1 app task */
xTaskCreate(task_app_led1, "APP LED1", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
/* Create LED2 app task */
xTaskCreate(task_app_led2, "APP LED2", configMINIMAL_STACK_SIZE, NULL, 0, NULL);
/* Start the scheduler */
vTaskStartScheduler();
while (1)
{
}
}
/* end code */
#define LED1_BLINKY_PERIOD_MS (250) /* The period (in milliseconds) at which LED1 will blink */
#define LED_D107 &MODULE_P13,0 /* LED D107: Port, Pin definition */
#define WAIT_TIME 500
/*********************************************************************************************************************/
/*---------------------------------------------Function Implementations----------------------------------------------*/
/*********************************************************************************************************************/
/* Initialization function for LED1 app */
static void app_init(void)
{
/* Setup the port/pin connected to LED1 to general output mode push-pull. This function can be
* used to initialize any port pin by specifying the port number, pin number and port pin mode.
*/
/* Initialization of the LED used in this example */
IfxPort_setPinModeOutput(LED_D107, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
/* Switch OFF the LED (low-level active) */
IfxPort_setPinHigh(LED_D107);
}
/* Task which runs the LED1 app */
void task_app_led1(void *arg)
{
app_init();
while (1)
{
IfxPort_togglePin(LED_D107); /* Toggle the state of the LED */
waitTime(IfxStm_getTicksFromMilliseconds(LED1_BLINKY_PERIOD_MS, WAIT_TIME)); /* Wait 500 milliseconds */
}
}
I tried also to create a single task with a very short code inside and the same:
/*********************************************************************************************************************/
/*-----------------------------------------------------Includes------------------------------------------------------*/
/*********************************************************************************************************************/
#include "IfxPort_PinMap.h"
#include "Port/Io/IfxPort_Io.h"
#include "FreeRTOS.h"
#include "task.h"
/*********************************************************************************************************************/
/*-----------------------------------------------------Macros--------------------------------------------------------*/
/*********************************************************************************************************************/
#define LED_D107 &MODULE_P13,0 /* LED D107: Port, Pin definition */
#define LED1_BLINKY_PERIOD_MS (250) /* The period (in milliseconds) at which LED1 will blink */
/*********************************************************************************************************************/
/*---------------------------------------------Function Implementations----------------------------------------------*/
/*********************************************************************************************************************/
/* Initialization function for LED1 app */
static void task_init(void)
{
/* Initialization of the LED used in this example */
IfxPort_setPinModeOutput(LED_D107, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
/* Switch OFF the LED (low-level active) */
IfxPort_setPinHigh(LED_D107);
}
/* Task which runs the LED1 app */
void task_blinky(void *arg)
{
task_init();
while (1)
{
IfxPort_togglePin(LED_D107); /* Toggle the state of the LED */
/* Delay 250ms */
vTaskDelay(pdMS_TO_TICKS(LED1_BLINKY_PERIOD_MS));
}
}
Can you check the xtaskCreate return value and see if the task are getting created? If yes, next you should check if the tick interrupt is firing and xTickCount is getting incremented.
xtaskCreate return 1 and xTickCount is incremented. Anyway, I can see the value of xTickCount only after I pause the execution, after I resume it xTickCount is incremented 1 more time then it remains unchanged, probably something is getting messed up during the execution pause.
Yes, they are called but it takes around 30 seconds between succesive breakpoints are reached. After they are reached xTickCount is incremented with 1.
That seems odd - is it possible that your debugger has issues? You may try to blink an LED in tick hook and run without debugger to confirm that tick ISR is happening continuously.
I inserted the Led blink in a tick hook and toggled the LED every 1000 ticks and the LED is toggling as expected(every 1 second) . The settings are done as follow: