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.

TMS570LS1227 calling dwdReset() from a FreeRTOS task produces exception

Other Parts Discussed in Thread: HALCOGEN

Hello,

I'm developing an application using the HDK for prototyping. I used HalcoGen for generating a FreeRTOS based application skeleton.

Whe I call dwdReset() from a FreeRTOS task, the MCU raises an exception. I understand this happens because FreeRTOS tasks runs in user mode, but accessing the digital watchdog key register (as dwdReset() does) requires privileged mode. I have found the SWI mechanism implemented in the FreeRTOS source code, and I think that a possibilty could be to add a SWI handler wich calls dwdReset() from privileged mode, but I'm unsure about how to correctly implement this kind of handler.

I'm wondering if there is an official way to handle the digital watchdog from an HalcoGen generated FreeRTOS application. Or maybe there is already some example code I could use.

Could you help please?

Thanks in advance.

  • You can use the xTaskCreateRestricted API of FreeRTOS to create a task that runs with privilege. See post: e2e.ti.com/.../1965194
  • Thanks Bob, you pointed my out in the right direction.

    But it turned out to be a simpler solution. After examination of HALCoGen generated FreeRTOS source code, I saw that the OS idle task is already created with privileges, so I inserted my watchdog service code in vApplicationIdleHook(), like this:

    void vApplicationIdleHook(void)
    {
    /* watchdog timeout is set to 300 msec, clear it every 64 msec */
    if ((xTaskGetTickCount() & (64 - 1)) == 0)
    {
    /* prevent digital watchdog expiration */
    dwdReset();
    }
    }

    It is my programming habit to service the watchdog in the OS idle task, because if it gets a chance to run then it means the user defined tasks are not starving the processor time.

    Thank you again.

    Best regards,
    Antonio Lopez