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.

AWR1642BOOST: Print Output on the Console

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: SYSBIOS

Hello,

I am using the AWR1642BOOST and attempting to display the output on the console for a gain block. My setup includes SDK version 3.06_01_00-LTS, XDC tools version 3.62, the latest version of CCS, and BIOS version 6.73.01.

When I try to print the output using the UART_write command or CLI_write command for my specific code, nothing gets printed. However, a line from the cli.h file that I have included does get printed.

I have used the following commands:

System_printf("Output is: %d\n", (int)test_20_02_Y.Out1);

CLI_write("Answer is: %d\n", (int)test_25_01_Y.Output);

I have also tried uart_write, but in every case, only the output from the cli.h file is getting printed on the console.

What command should I use to print my output on the console?

Note: I have included the necessary header files, and the binary is being generated without throwing any errors.

  • Additional Information: This is getting printed from cli.c file : 

    These are the lib files I have included to generate binary in this priority order: 

    **What should I write in my main file to print the output**

  • Hello Asim,

    Is the CLI_write API not functional for you?

    The CLI_Write API is the one that you should be using because it internally calls the UART_write itself and it should be working.

    System_printf only works with your Debugger console view as it writes it over the JTAG and not the UART.

    You should onyl be using the CLI_Write as in that function it properly sets up the UART and then prints it over the serial terminal.

    Regards,
    Saswat Kumar

  • The CLI_write prints the string 'xwr16xx mmWave Demo' from the cli_main file using the mmwave_cliinit function as you can see from the screenshot attached above.

    But it is not printing the output I am trying to print.

    I have done linking of the cli library file.

    And from there the main file is calling the mmWaveDemo_CliInit function and only this much is getting printed. 

    But what I intend to print is not getting printed.

    Here is my code: 

  • Hello Asim,

    Instead of using the CLI_write you can also follow this example: C:\mmwave_sdk_03_06_00_00-LTS\packages\ti\drivers\uart\test

    Try this example first and then check if this is printing in your serial terminal.

    Then you can implement the same function call sequence in your application instead of being dependent on the CLI driver.

    Regards,
    Saswat Kumar

  • This is the code I wrote: But it is giving me error because of dma, hwi, semaphore linking. I doing bare_metal (not freeRTOS) code so I am not linking these things. Can you suggest how to correct it?

    /*
    * File: test_20_02.c
    *
    * Code generated for Simulink model 'test_20_02'.
    *
    * Model version : 1.2
    * Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
    * C/C++ source code generated on : Wed Feb 28 18:38:19 2024
    *
    * Target selection: ert.tlc
    * Embedded hardware selection: ARM Compatible->ARM Cortex
    * Code generation objectives: Unspecified
    * Validation result: Not run
    */
    #include "test_20_02.h"
    #include "rtwtypes.h"
    #include <ti/utils/cli/cli.h>
    #include <ti/drivers/uart/UART.h>
    #include <ti/sysbios/knl/Task.h>
    /* External outputs (root outports fed by signals with default storage) */
    ExtY_test_20_02_T test_20_02_Y;
    /* Real-time model */
    static RT_MODEL_test_20_02_T test_20_02_M_;
    RT_MODEL_test_20_02_T *const test_20_02_M = &test_20_02_M_;
    UART_Handle uart_handle;
    /* Model step function */
    void test_20_02_step(void)
    {
    /* Outport: '<Root>/Out1' incorporates:
    * Constant: '<Root>/Constant'
    * Gain: '<Root>/Gain'
    */
    test_20_02_Y.Out1 = test_20_02_P.Gain_Gain * test_20_02_P.Constant_Value;
    /* Convert the output to string and send it over UART */
    char outputString[32];
    snprintf(outputString, sizeof(outputString), "Answer is : %d \n", (int)test_20_02_Y.Out1);
    UART_write(uart_handle, outputString, strlen(outputString));
    }
    /* Model initialize function */
    void test_20_02_initialize(void)
    {
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uart_handle = UART_open(Board_UART0, &uartParams);
    if (uart_handle == NULL) {
    /* UART_open() failed */
    while (1);
    }
    /* (no initialization code required) */
    }
    /* Model terminate function */
    void test_20_02_terminate(void)
    {
    if (uart_handle != NULL) {
    UART_close(uart_handle);
    uart_handle = NULL;
    }
    /* (no terminate code required) */
    }
    /*
    * File trailer for generated code.
    *
    * [EOF]
    */
  • Hello Asim,

    /*
     *   @file  main_mss.c
     *
     *   @brief
     *      Unit Test code for the UART on the XWR16xx MSS
     *
     *  \par
     *  NOTE:
     *      (C) Copyright 2016 Texas Instruments, Inc.
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /**************************************************************************
     *************************** Include Files ********************************
     **************************************************************************/
    
    /* Standard Include Files. */
    #include <stdint.h>
    #include <stdlib.h>
    #include <stddef.h>
    #include <string.h>
    #include <stdio.h>
    
    /* BIOS/XDC Include Files. */
    #include <xdc/std.h>
    #include <xdc/cfg/global.h>
    #include <xdc/runtime/IHeap.h>
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Error.h>
    #include <xdc/runtime/Memory.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Event.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/heaps/HeapBuf.h>
    #include <ti/sysbios/heaps/HeapMem.h>
    #include <ti/sysbios/knl/Event.h>
    #include <ti/sysbios/family/arm/v7a/Pmu.h>
    
    /* mmWave SK Include Files: */
    #include <ti/common/sys_common.h>
    #include <ti/drivers/soc/soc.h>
    #include <ti/drivers/uart/UART.h>
    #include <ti/drivers/pinmux/pinmux.h>
    #include <ti/drivers/esm/esm.h>
    #include <ti/utils/testlogger/logger.h>
    
    /* MCPI Global Variable which is used to select run
     * the original unit test or MCPI uart echo test
     */
    uint8_t         gMCPIUARTEchoTestEnable = 0;
    uint8_t         gMCPIUARTDMATestEnable = 1;
    
    /**************************************************************************
     ************************** External Definitions **************************
     **************************************************************************/
    
    /* Common Test Functions: */
    extern int32_t Test_uartAPI (void);
    extern int32_t Test_profileTransmit(uint32_t uartInstanceNum);
    extern int32_t Test_pollingData(void);
    extern int32_t Test_blockingData(void);
    extern int32_t Test_DMAReadWrite(void);
    extern void    Test_echo(UArg a0, UArg a1);
    
    /**************************************************************************
     *************************** Global Definitions ***************************
     **************************************************************************/
    
    /* Global Variable which holds the CPU Clock Frequency */
    uint32_t gCPUClockFrequency = (200 * 1000000);
    
    /* Global Variable which holds the DMA Instance */
    DMA_Handle   gDMAHandle;
    
    /**
     * @brief
     *  Initialize the MCPI Log Message Buffer
     */
    MCPI_LOGBUF_INIT(9216);
    
    /**************************************************************************
     *************************** SOC UART Startup code *************************
     **************************************************************************/
    
    /**
     *  @b Description
     *  @n
     *      System Initialization Task which initializes the various
     *      components in the system.
     *
     *  @retval
     *      Not Applicable.
     */
    static void Test_initTask(UArg arg0, UArg arg1)
    {
        Task_Params     taskParams;
        DMA_Params      dmaParams;
        int32_t         errCode;
        UART_Params     params;
        UART_Handle     handle;
        uint8_t*        ptrTestBanner = "Hello World\n";
    
        /* Initialize the test logger framework: */
        MCPI_Initialize ();
    
        /* Initialize the UART */
        UART_init();
    
        /* Initialize the DMA */
        DMA_init ();
    
        /* Open the DMA Instance */
        DMA_Params_init(&dmaParams);
        gDMAHandle = DMA_open(0, &dmaParams, &errCode);
        if (gDMAHandle == NULL)
        {
            printf ("Error: Unable to open the DMA Instance [Error code %d]\n", errCode);
            return;
        }
    
        /* Setup the PINMUX to bring out the MSS UART-1 */
        Pinmux_Set_FuncSel(SOC_XWR16XX_PINN5_PADBE, SOC_XWR16XX_PINN5_PADBE_MSS_UARTA_TX);
        Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN5_PADBE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR16XX_PINN4_PADBD, SOC_XWR16XX_PINN4_PADBD_MSS_UARTA_RX);
        Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINN4_PADBD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
    
        /* Setup the PINMUX to bring out the MSS UART-3 */
        Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINF14_PADAJ, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR16XX_PINF14_PADAJ, SOC_XWR16XX_PINF14_PADAJ_MSS_UARTB_TX);
    
        /* Setup the PINMUX to bring out the DSS UART */
        Pinmux_Set_OverrideCtrl(SOC_XWR16XX_PINP8_PADBM, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR16XX_PINP8_PADBM, SOC_XWR16XX_PINP8_PADBM_DSS_UART_TX);
    
        /* Debug Message: */
        if (gMCPIUARTEchoTestEnable == 0)
        {
            System_printf ("Debug: UART PINMUX configurations for MSS and DSS have been initialized\n");
        }
    
        if (gMCPIUARTEchoTestEnable == 1)
        {
            /* Initialize the Task Parameters. */
            Task_Params_init(&taskParams);
            taskParams.stackSize = 4*1024;
            Task_create(Test_echo, &taskParams, NULL);
            return;
        }
    
        /* Setup the default UART Parameters */
        UART_Params_init(&params);
        params.clockFrequency = gCPUClockFrequency;
        params.baudRate       = 115200;
        params.isPinMuxDone   = 1;
    
        /* Open the UART-1 Instance: */
        handle = UART_open(0, &params);
        if (handle == NULL)
        {
            System_printf("Error: Unable to open the UART-1\n");
            return;
        }
        UART_writePolling(handle, ptrTestBanner, strlen((const char*)ptrTestBanner));
    
        return;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the entry point into the unit test code
     *
     *  @retval
     *      Not Applicable.
     */
    int32_t main (void)
    {
    	Task_Params     taskParams;
        int32_t         errCode;
        SOC_Handle      socHandle;
        SOC_Cfg         socCfg;
    
        /* Initialize the ESM: Dont clear errors as TI RTOS does it */
        ESM_init(0U);
    
        /* Initialize the SOC confiugration: */
        memset ((void *)&socCfg, 0, sizeof(SOC_Cfg));
    
        /* Populate the SOC configuration: On the EVM we want to ensure that the BSS is
         * executing and the system clock is correctly configured. */
        socCfg.clockCfg = SOC_SysClock_INIT;
    
        /* Initialize the SOC Module: This is done as soon as the application is started
         * to ensure that the MPU is correctly configured. */
        socHandle = SOC_init (&socCfg, &errCode);
        if (socHandle == NULL)
        {
            System_printf ("Error: SOC Module Initialization failed [Error code %d]\n", errCode);
            return -1;
        }
    
        /* Debug Message: */
        if (gMCPIUARTEchoTestEnable == 0)
        {
            System_printf ("******************************************\n");
            System_printf ("Debug: Launching the UART Test Application\n");
            System_printf ("CPU Clock Frequency: %d\n", gCPUClockFrequency);
            System_printf ("******************************************\n");
        }
    
        /* Initialize the Task Parameters. */
        Task_Params_init(&taskParams);
        taskParams.stackSize = 4*1024;
        Task_create(Test_initTask, &taskParams, NULL);
    
        /* Debug Message: */
        if (gMCPIUARTEchoTestEnable == 0)
        {
            System_printf ("Debug: Launching BIOS [Reset the FIQ]\n");
        }
        /* Start BIOS */
    	BIOS_start();
        return 0;
    }
    
    

    I have provided you the reference code which works on our end.
    You can refer to this to make your code. 

    Regards,
    Saswat Kumar