This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: TI Fee functions hang inside the FreeRTOS task.

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

My project is running using FreeRTOS which is generated from HalCoGen on Hercules Development Kit. Multiple tasks are running in the design. One of the tasks is to read and write from the Flash using TI FEE functions.
I am facing an issue when I try to use TI FEE functions from the FreeRTOS task. The task hangs in TI_Fee_Init() forever. The TI FEE functions are working fine when running outside the tasks.

My issue is similar to the following post.
https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/632209/rtos-tms570ls1224-call-fee-functions-from-freertos-tasks-hangs

All the links and files mentioned in the post are inaccessible. Can anyone please send me the correct links and files?

Also, based on that post, I should switch from user mode to supervisory mode to execute the TI FEE functions. Can anyone please help me understand how to switch the processor to supervisory mode?

#include "FreeRTOS.h"
#include "os_task.h"
#include "ti_fee.h"
#include "HL_sci.h"
#include "stdio.h"

xTaskHandle xTestTaskHandler

void vTestTask();

int main(void)
{
/* USER CODE BEGIN (3) */
    sciInit();

    xTaskCreate(vTestTask, "TestTask", 5 * configMINIMAL_STACK_SIZE, NULL, 1 , &xTestTaskHandler);
    vTaskStartScheduler();
    
    while(1);
    
/* USER CODE END */
    return 0;
}


void vTestTask(){
    //varialbes
    
    //========== flash initialization ==========
    TI_Fee_Init();
    do
    {
        TI_Fee_MainFunction();
        delay();
        Status = TI_Fee_GetStatus(0);
    }
    while (Status != IDLE);
    
    //========== write to flash ==========
    blockNumber = 0x1;
    TI_Fee_WriteAsync(blockNumber, &memoryBlock[0]);
    do
    {
        TI_Fee_MainFunction();
        delay();
        Status = TI_Fee_GetStatus(0);
    }
    while (Status != IDLE);
    
    //========== read flash ===========
    blockOffset = 0x00;
    length = 68;
    outputResult = TI_Fee_Read(blockNumber, blockOffset, Read_Ptr, length);
    do
    {
        TI_Fee_MainFunction();
        delay();
        Status = TI_Fee_GetStatus(0);
    }
    while (Status != IDLE);
    while(1){
        sciDisplayData(sciREG1, (uint8*) Read_Ptr, 4);
    }
}