CC1352P: UART + GPIO in watchdog callback

Part Number: CC1352P

Hi! I'm currently using the watchdog as a last resort reset of our system. But I need to extend functionality to perform a safe shutdown of external components before resetting MCU.

So started using the callback functionality.

But it seems very limited what function calls can be executed from within the watchdog callback.

Can you please provide guidance for how to perform the following from withing the watchdog callback

  1. Toggle GPIOs with delays in between
  2. Print on UART (I'm OK printing static strings, just want debug log to have some note of the watchdog triggered)

My setup:

  • MCU is CC1352P and using the CC1352P1-LAUNCHXL during tests.
  • SDK simplelink_cc13x2_26x2_sdk_4_40_04_04
  • To limit the complexity I'm testing on example uartecho and adding watchdog and Debug_printf()

main_tirtos.c below. If I run this without every resetting watchdog it will trigger as expected, print "T" on terminal (first character of string in callback), hang and then reset after second watchdog timeout. As expected. But I want to print whole string and also control GPIO.

Watchdog_Handle fido;

void fidoCallback(uintptr_t watchdogHandle)

 *  ======== main ========
int main(void)
    pthread_t           thread;
    pthread_attr_t      attrs;
    struct sched_param  priParam;
    int                 retc;


    /* Call driver init functions */

    //---------- Watchdog
    Watchdog_Params fido_params;

    fido_params.debugStallMode  = Watchdog_DEBUG_STALL_OFF;
    fido_params.resetMode       = Watchdog_RESET_ON;
    fido_params.callbackFxn     = (Watchdog_Callback) fidoCallback;

    fido = Watchdog_open(CONFIG_WATCHDOG_0, &fido_params);
    if (fido == NULL) {
       // Error opening Watchdog
       while (1);

    /* Initialize the attributes structure with default values */

    /* Set priority, detach state, and stack size attributes */
    priParam.sched_priority = 1;
    retc = pthread_attr_setschedparam(&attrs, &priParam);
    retc |= pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
    retc |= pthread_attr_setstacksize(&attrs, THREADSTACKSIZE);
    if (retc != 0) {
        /* failed to set attributes */
        while (1) {}

    retc = pthread_create(&thread, &attrs, mainThread, NULL);
    if (retc != 0) {
        /* pthread_create() failed */
        while (1) {}


    return (0);