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.

CC2340R5: Log_printf is working incorrectly.

Part Number: CC2340R5
Other Parts Discussed in Thread: SEGGER

Tool/software:

I have been trying to use the 'log' example to examine the 'log' printf functionality but the problem is that it was printing rubbish on my terminal via the UART. I grabbed my oscilloscope to see what was being printed on the UART for the following lines of code in the 'mainthread()' function:

    /* Greet the user, send this to all modules */
    Log_printf(LogModule_App1, Log_DEBUG, "Hello World! %d", 1);
    LogSinkUART_flush();
    Log_printf(LogModule_App2, Log_DEBUG, "Hello World!");
    LogSinkUART_flush();
    Log_printf(LogModule_App3, Log_DEBUG, "Hello World!");
    LogSinkUART_flush();
 

it shall print 'Hello World!'. but what is actually printed is 12 bytes, 4 bytes representing some pointer address, 4 bytes representing the current timestamp, the last 4 bytes representing the v_args which is 1 for the first line in the aforementioned lines of code.

How did I know what each of the bytes represent? I have been debugging the 'log' example code and been digging deep into the library source code. I don't know why this happen. it has been a couple of hours and can't determine why the example code provided by TI isn't working properly.

  • Hello,

    Just double checking but you did reference the log_printf section in the SDK documentation:

    Debugging — SimpleLinkTm Low Power F3 SDK BLE5-Stack User's Guide 3.03.04.00 documentation

    Thanks,
    Alex F

  • Unfortunately, I just realized I was referencing older version of the SDK (v7.0.0)

    However, I tried the step linked in the document but I am stuck at the point that there is no "logSinkBuf" module:

    it worth mentioning that I am using SWO and SWD pins only for my segger j-link debugger. 

  • after quite a debugging session, I understood that LOG module doesn't send the complete message to host via UART but rather sends the following 3 infos:

    - timestamp

    - pointer to message to be printed, where the content of the message can be extracted from the '.out' file using the send address

    - any arguments to the message such as those for %d

    I then had to search how to extract those message using the above infos, I found this tool developed by TI called 'tilogger':

    <SDK_INSTALLATION_PATH>/tools/log/tiutils/Readme.html 

    It performed extraction of these messages for me automatically. but it's quite the hassle to be used. unfortunately, I couldn't use "ROV (Runtime Object Viewer)" as it didn't show any "logSinkBuf", I guess it has something to do with me using "Segger J-link" not the official debugger from TI.