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.

How can i use printf() or System_printf() in cc2650 sensor tag to print the values on the console and debug sensor tag code

Other Parts Discussed in Thread: CC2650STK

I want to print the sensor values on my CCS console and other my debug statements on console. I tried using printf() and System_printf() they do not produce any error, neither they print anythihng on the console

  • Hi Zaed, 

    Yes, you can use Sysbem_printf() to print to the console in TI-RTOS applications.  I would recommend using SysMin as your system provider.  To do so, just add/update the following to the *.cfg file:

    /* ================ System configuration ================ */
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;

    Now you can add System_printf() calls to your code to print to an internal buffer and System_flush() to print out to the console.

    Regards,

    -- Emmanuel

  • Can you kindly explain in detail how do i use SysMin() in an efficient way.   I am a complete beginner.
    right now when i am using printf() or system_printf() to print the data i2c data being read by the sensor tag from its sensor via i2c, i get the first value printed and every thing hangs

  • Hi Zaed,

    System_printf() will print to an internal buffer, it is safe to use in all context (Task, Hwi, Swi). However System_flush() makes use of the C runtime library (which needs a mutex) so you need to make sure System_flush() is only called from the Task (not Hwi's or Swi's) context.

    Regards,
    -- Emmanuel
  • Hello experts,

    I'm trying to add debug logging with printf to the CC2650STK SensorTag default app and have followed instructions given by you.

    I didn't get any log output.

    Then I tried with the uartecho_CC2650STK_TI_CC2650F128 default project, and I get the printf messages from that in the CCS console. I've tried to figure out what the difference is and have concluded that I need to add/initialize the UART.

    In main.c of the SensorTag default app, I added:

    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    #include <ti/drivers/UART.h>

    ...and changed the main function like this (just added the UART_init(); call, see below)

    int main()
    {
    PIN_init(BoardGpioInitTable);

    #ifndef POWER_SAVING
    /* Set constraints for Standby and Idle mode */
    Power_setConstraint(Power_SB_DISALLOW);
    Power_setConstraint(Power_IDLE_PD_DISALLOW);
    #endif // POWER_SAVING

    /* Initialize ICall module */
    ICall_init();

    /* Start tasks of external images - Priority 5 */
    ICall_createRemoteTasks();

    /* Kick off profile - Priority 3 */
    GAPRole_createTask();

    /* Kick off application - Priority 1 */
    SensorTag_createTask();
    SensorTagTmp_createTask();
    SensorTagHum_createTask();
    SensorTagBar_createTask();

    //added by me:
    UART_init();

    BIOS_start(); /* enable interrupts and start SYS/BIOS */

    System_printf("Hello World :)");
    System_flush();

    return 0;
    }


    The problem is that I get this linker error:

    undefined first referenced
    symbol in file
    —------- —------------—
    UART_init ./Startup/main.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "SensorTag.out" not built

    » Compilation failure
    gmake: *** [SensorTag.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    I'm I on the right path to get this working? What do I need to do to solve the problem?

    Your help will be appreciated, cheers,

    Florian
  • Can you start a new thread? Since this thread is marked as "Answered", it goes into a different bucket.