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.

CC2640R2L: Print all CPU Exceptions on UART

Part Number: CC2640R2L
Other Parts Discussed in Thread: CC2640

Hello TI Support,

I want to print all exceptions on the UART0 of CC2640R2L.

I use the following config, but it doesn't work.

app_ble.cfg

var SysMin = xdc.useModule('xdc.runtime.SysMin');
//SysMin.bufSize = 128;
//System.SupportProxy = SysMin;
var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
System.SupportProxy = SysCallback;
//SysCallback.abortFxn = "&myUserAbort";
//SysCallback.exitFxn  = "&myUserExit";
//SysCallback.flushFxn = "&myUserFlush";
//SysCallback.putchFxn = "&myUserPutch";

SysCallback.exitFxn = "&xdc_runtime_SysMin_exit__E";  /* This is the generated symbol for SysMin_exit */
SysCallback.putchFxn = "&glue_putchar";
SysCallback.abortFxn = "&my_UARTAbort";
//SysCallback.readyFxn = "&myUserReady";

m3Hwi.enableException = false;
//m3Hwi.excHandlerFunc = null;
m3Hwi.excHookFunc = "&excHookFunc"

The handlers:

#include <ti/sysbios/family/arm/m3/Hwi.h>
volatile uintptr_t *excPC = 0;
volatile uintptr_t *excCaller = 0;
void excHookFunc(Hwi_ExcContext *ctx)
{
    excPC = ctx->pc;
    excCaller = ctx->lr;

    char* buf = "Hello\n"; //Print anything just to make sure the handler is working
    for (int i=0; i<5; ++i)
    {
        glue_putchar(buf[i]);
    }
    while(2);
}

void glue_putchar(char ch)
{
    UART_write(uart_handle, &ch, 1);
}

void my_UARTAbort(CString str)
{
    int len = strlen(str);
    for (int i=0; i<len;++i)
    {
        glue_putchar(str[i]);
    }
}

When an exception happen, i see nothing on UART and the debugger start printing the following in the console.

Cortex_M3_0: Can't Run Target CPU: (Error -2134 @ 0x0) Unable to control device execution state. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
Cortex_M3_0: Error: (Error -1170 @ 0x0) Unable to access the DAP. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 9.12.0.00150) 
Cortex_M3_0: Unable to determine target status after 20 attempts
Cortex_M3_0: Failed to remove the debug state from the target before disconnecting.  There may still be breakpoint op-codes embedded in program memory.  It is recommended that you reset the emulator before you connect and reload your program before you continue debugging

I put a breakpoint inside of excHookFunc and i can hit it, but dunno why UART is not printing.

Here is a screenshot from CCS showing values of UART_handle and UartParams

CCS v12.4

TI BLEStack (SDK v5_30_00_03)

Could you please guide me what is missing ?