Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

karma-JC
Level 1
Level 1
10 sign-ins First like received First reply posted

Hi:


I'm working on TC277 Application kit with FreeRTOS. I have an issue with vTaskDlay not returning back when it got block; the code is in "Debug Mode". It looks like the tick count not being updating. However, I have vApplicationIdleHook implementation(in code section) from an example in FreeRTOS example to update the tick. But, the vTaskDelay still can not return from blocking.

Would anyone has any information or lead how to get around this issue? 

Thanks

James

The following is the ApplicationIdelHook implementation:

/*
 * OSHookup.c
 *
 *  Created on: Dec 12, 2022
 *      Author: jche
 */

#include "Ifx_Types.h"
#include "Compilers.h"
#include "IfxStm.h"
#include "FreeRTOS.h"
#include "task.h"

static void OsTasks_setupTimerInterrupt(Ifx_STM *stm);

void vApplicationIdleHook( void )
{
    OsTasks_setupTimerInterrupt(&MODULE_STM0);
}

/**
 * FreeRTOS Kernel Tick timer setup
 * FreeRTOS needs kernel Tick through an interrupt occurring at configTICK_RATE_HZ rate.
 * The ISR need to call the function vPortSystemTickHandler.
 */
static void OsTasks_setupTimerInterrupt(Ifx_STM *stm)
{
    IfxStm_setCompareControl(stm,
                             IfxStm_Comparator_0,
                             IfxStm_ComparatorOffset_0,
                             IfxStm_ComparatorSize_32Bits,
                             IfxStm_ComparatorInterrupt_ir0);

    IfxStm_clearCompareFlag(stm,
                            IfxStm_Comparator_0);

    {
        volatile Ifx_SRC_SRCR *src;
        src=IfxStm_getSrcPointer(stm, IfxStm_Comparator_0);
        IfxSrc_init(src, (IfxSrc_Tos)IfxSrc_Tos_cpu0, configKERNEL_INTERRUPT_PRIORITY);
        IfxSrc_enable(src);
    }

    {
        uint32 stmCount= IfxStm_getLower(stm);
        IfxStm_updateCompare(&MODULE_STM0,
                             IfxStm_Comparator_0,
                             stmCount + (configSTM_CLOCK_HZ/configTICK_RATE_HZ )* 100 );
        IfxStm_enableComparatorInterrupt(stm, IfxStm_Comparator_0);
    }
}

/**
 * FreeRTOS Kernel Tick interrupt provider
 * FreeRTOS needs kernel Tick through an interrupt occurring at configTICK_RATE_HZ rate.
 * The ISR need to call the function vPortSystemTickHandler.
 */
IFX_INTERRUPT(OsTasks_TickProvider, 0, configKERNEL_INTERRUPT_PRIORITY)
{
    uint32 stmCount= IfxStm_getCompare(&MODULE_STM0, IfxStm_Comparator_0);
    IfxStm_updateCompare(&MODULE_STM0,
                                 IfxStm_Comparator_0,
                                 stmCount + configSTM_CLOCK_HZ/configTICK_RATE_HZ );
    vPortSystemTickHandler();
}

 

 

0 Likes
1 Reply
Nambi
Moderator
Moderator
Moderator
First like given 25 likes received 50 solutions authored

Hi,

You can refer to the STM_Interrupt_1_KIT_TC277_TFT ADS(Aurix Development Studio) example to configure the STM with interrupt and adapt it for your need.

Best Regards.

0 Likes