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.

IWR6843: HVAC GUI error - visualizer in 4.2.1 toolbox

Part Number: IWR6843
Other Parts Discussed in Thread: CC3235S, TIDA-010022

I can use GUI at HVAC mode normally by installing the visualizer in TI toolbox, but when I generate an exe file from gui_main.py to run GUI, it always closed immediately after 1 frame of data. This problem happened with updated GUI python program. When I used the old version of GUI, I generated my own exe file without any problem. Due to the lack of HVAC mode in the old GUI version, so I must use an updated GUI. But this updated GUI python program makes me can't run GUI by my own exe file anymore. Please tell me the root cause and solution.

  • Hi Hector,

    With the older gui, you can use IFDM or Indoor False Detection Mitigation with the HVAC demo.

    Regards,

    Justin

  • Hi Justin,

    1. I ran new GUI after modified it to re-open GUI without having to reset device. But now, when I run HVAC mode, GUI has green light flashing. I tried both baud rate at 921600 and 921600*2 but i still happened. What's the cause?

    2. So I only need to modify GUI python code Indoor False Detection Mitigation to a new name as HVAC, will it work normally without green light flashing as in the video below?

    I tested and realized something:

    It's still ok, without green flashing if I keep the original items.

    self.configType.addItems(["3D People Counting", "SDK Out of Box Demo", "Long Range People Detection", "Indoor False Detection Mitigation", "(Legacy) 2D People Counting", "(Legacy): Overhead People Counting"])
    
    #remove static points
    if (self.configType.currentText() == '3D People Counting'):

    But if I modify like this (change "Indoor False Detection Mitigation" into "HVAC" or add more items) , green light flashing issue happened

    self.configType.addItems(["3D People Counting", "SDK Out of Box Demo", "Long Range People Detection", "Sense and Detect HVAC Control", "(Legacy) 2D People Counting", "(Legacy): Overhead People Counting", "Capon3DAOP", "Replay"])
    //or self.configType.addItems(["3D People Counting", "SDK Out of Box Demo", "Long Range People Detection", "Sense and Detect HVAC Control", "(Legacy) 2D People Counting", "(Legacy): Overhead People Counting"])
    #remove static points
    
    if (self.configType.currentText() == '3D People Counting' or self.configType.currentText() == 'Capon3DAOP' or self.configType.currentText() == 'Sense and Detect HVAC Control'):

    Please help me solve the green light flashing issue with updated 4.2.1 toolbox GUI or GUI old version for HVAC, and point out the part that caused this issue. I can't believe that issue happened just because I change item name.

    Below is the video and my GUI python code after modified

    gui_main2.zip

    https://www.youtube.com/watch?v=z1xVYQ8kgMw&feature=youtu.be

  • Hi Hector,

    Because each lab has different output. there are a few parts of the gui that will check the selected lab. Probably one of those did not get changed properly. My recommendation would be not to change the name.

    Regards,

    Justin

  • Hi Justin,

    How about updated GUI in toolbox 4.2.1 lab? It already had HVAC item, so i don't need to change the name. The problem is when I generated exe file from gui_main.py of the updated GUI, it could run only 1 frame of data, then closed unexpectedly. Please tell me how to solve it.

  • Hi Hector,

    What are you using to generate an .exe?

    Regards,

    Justin

  • Hi Justin,

    I'm using pyinstaller

  • Hi Hector,

    I used FBS to create the installer (it can also create a .exe) that is in the Toolbox. The source code already has the hooks for FBS, so this should work, make sure you have python 3.6.

    Regards,

    Justin

  • Hi Justin,

    If I send data from IWR6843 to wifi module. Then wifi module connects to PC via UART, can I use TI GUI python code in mmWave toolbox visualizer for demo with any device via UART? Or that GUI code is only for mmWave device?

  • Hi Hector,

    You may need to modify the source to connect with the COM ports, as this actually calls a connect "COMX" where COMX is the serial port name. The name may appear differently for the wifi evm, you will have to check that.

    Regards,

    Justin

  • Hi Justin,

    Do you mean I need to modify oob_parser.py? I think TI python code has function to recognize COM port. If I change device but still connect via UART, it should use the same code, doesn't it? Please tell me which part I need to look at (device code or GUI code?). I don't get your point about connect COMX.

  • Hi Hector,

    The code uses the module pyserial to connect to the COM Port. One of the arguments to the Serial() call is the COM port name. For TI mmWave devices using XDS110, the com port name appears as something like "COM4". The gui takes the number "4" input by user and appends it to "COM" to get "COM4". So if the serial port naming scheme is different for the CC device, you will need to change the source slightly to account for this.

    Regards,

    Justin

  • Hi Justin,

    I'll test GUI data parsing from CC3235 UART later.

    I wanna ask. If I connect CC3235S directly to PC via wifi TCP socket, without UART. So the GUI will not be modified the way you described above. How about GUI code for demo tracking data received via TCP socket? Please tell me which function I need to modify in that case. Thank you.

  • Hi Hector,

    You still modify the same part of the GUI pipeline, but instead of using a Serial object, you use a TCPIP sockect. This is "Socket" in python 3.

    Regards,

    Justin

  • Hi Justin,

    What if I want to send data from a TI device to PC via 15.4 stack? Is it possible? How to modify GUI code in that case? Since 15.4 stack is a private protocol of TI, there's not many documents on the internet. So I don't know how to modify GUI for it.

  • Hi Hector,

    It always works like this:

    1. Convert data protocol to some binary arrary.
    2. Pass binary array through parser to get data out.

    I can't comment on 15.4 stack.

    Regards,

    Justin

  • Hi Justin,

    When we connect 6843 to PC, GUI of mmWave toolbox only begins demo after finished sending Cfg. If I only want to use that GUI to let IWR6843 receives data from another device (CC3235), do I only need to connect UART port on GUI or also need to remove Cfg part in GUI code? I mean: is it mandatory to begin demo after pressing Send Cfg button with original mmWave toolbox GUI? If so, it's not suitable for my purpose of directly receiving data from another device. Please tell me more details how to modify if needed.

  • Hi Hector,

    When you hit send config, the gui sends the cfg then starts a timer that periodically calls the parse frame function of the parser. So you could modify the send cfg function to skip the part where it sends the configuration. The timer is called parseTimer, you could also have this run as soon as the UART DATA port is connected.

    Regards,

    Justin

  • Hi Justin,

    Do you mean we only need to write code without try-except like this?

    def sendCfg(self):        
            self.parseTimer.start(self.frameTime)
            

    About the 2nd method you mentioned, is it def connectCom as below? I added that command at line 20. Please confirm whether my thoughts for both methods are correct.

    def connectCom(self):
            #get parser
            self.parser = uartParserSDK(type=self.configType.currentText())
            self.parser.frameTime = self.frameTime
            print('Parser type: ',self.configType.currentText())
            #init threads and timers
            self.uart_thread = parseUartThread(self.parser)
            if (self.configType.currentText() != 'Replay'):
                self.uart_thread.fin.connect(self.parseData)
            self.uart_thread.fin.connect(self.updateGraph)
            self.parseTimer = QTimer()
            self.parseTimer.setSingleShot(False)
            self.parseTimer.timeout.connect(self.parseData)        
            try:
                uart = "COM"+ self.uartCom.text()       #deb_gp
                data = "COM"+ self.dataCom.text()       #deb_gp
    #TODO: find the serial ports automatically.
                self.parser.connectComPorts(uart, data)
                #I added this to parse data without having to send Cfg
                self.parseTimer.start(self.frameTime)
                self.uart_thread.start(priority=QThread.HighestPriority)
                self.connectStatus.setText('Connected')     #deb_gp
                self.connectButton.setText('Disconnect')    #deb_gp
    #TODO: create the disconnect button action
            except:
                self.connectStatus.setText('Unable to Connect')
            if (self.configType.currentText() == "Replay"):
                self.connectStatus.setText('Replay')
            if (self.configType.currentText() == "Long Range People Detection"):
                self.frameTime = 400

  • Hi Hector,

    This looks correct to me. The UART thread will parse whatever has been sent since you connected to UART, and the parseTimer will call the UART Thread every frame period.

    Regards,

    Justin

  • Hi Justin,

    I checked CC3235 COM port name. Its name rule is same as COM port of IWR6843. So the GUI python code should not need to be modified. Only the part to initialize GUI without having to send Cfg, you already confirmed my method is correct last time.

    Below is my code to receive data via TCP socket, then mmWave data will be stored in Data. I can use Data for UART_write() to send to GUI PC. But when I opened GUI, I saw nothing. Please point out the root cause of this issue.

    I put my code and files here

    device code

     

    3731.uart_term.c
    /*
     * Copyright (c) 2016, Texas Instruments Incorporated
     * All rights reserved.
     *
     * 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.
     */
    
     /*
     *  Terminal
     */
    
    // Standard includes
    #include <stdarg.h>
    #include <stdlib.h>
    #include <string.h>
    #include "socket_cmd.h"
    #include "uart_term.h"
    #include "network_terminal.h"
    
    extern int vsnprintf(char * s,
                         size_t n,
                         const char * format,
                         va_list arg);
    
    //*****************************************************************************
    //                          LOCAL DEFINES
    //*****************************************************************************
    #define IS_SPACE(x)             (x == 32 ? 1 : 0)
    #define true                    1
    #define false                   0
    #define BUF_SIZE            3000    //1400
    #define TCP_PACKET_COUNT    2000    //1000
    #define PORT_NUM            5001
    
    //*****************************************************************************
    //                          LOCAL FUNCTIONS
    //*****************************************************************************
    uint8_t *retCommand(int8_t increment);
    void pushCommand(char *command);
    
    //*****************************************************************************
    //                 GLOBAL VARIABLES
    //*****************************************************************************
    static UART_Handle uartHandle;
    static const char uSAVE_CURSOR_STR[3] =     {0x1B,0x37,0};
    static const char uRESTORE_CURSOR_STR[3] =  {0x1B,0x38,0};
    static const char uERASE_LINE[5] =          {0x1B,0x5B,0x30,0x4B,0};
    volatile unsigned long  g_ulPacketCount = TCP_PACKET_COUNT;
    float Data[BUF_SIZE];
    
    typedef struct commandHistory_t
    {
        /* 2-D Array of past commands*/
        uint8_t *uHistory[CMD_HISTORY_LEN];
        /*Index of Max + 1*/
        int8_t iTop;
        /*Index that keeps track of where user is viewing the command history*/
        int8_t iCurrent;
        /*Index of one plus the last command added to command history*/
        int8_t iNext;
    
    }commandHistory;
    
    commandHistory app_CH;
    
    uint8_t gSaveCursorPosition = true;
    uint8_t gStackFull          = false;
    
    int32_t BsdTcpClient(unsigned short usPort)
    {
        //int             iCounter;
        //short           sTestBufLen;
        int             iTestBufLen;
        SlSockAddrIn_t  sAddr;
        int             iAddrSize;
        int             iSockID;
        int             iStatus;
        long            lLoopCount = 0;
        int             iNewSockID;
        //uint8_t i;
    
        iTestBufLen  = BUF_SIZE;
    
        //filling the TCP server socket address
        sAddr.sin_family = SL_AF_INET;
        sAddr.sin_port = sl_Htons((unsigned short)usPort);
        //sAddr.sin_addr.s_addr = sl_Htonl((unsigned int)g_ulDestinationIp);
        sAddr.sin_addr.s_addr = sl_Htonl((unsigned long)SL_IPV4_VAL(192,168,1,31));
    
        iAddrSize = sizeof(SlSockAddrIn_t);
    
        // creating a TCP socket
        iSockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
        if( iSockID < 0 )
        {
            ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
        }
    
        // connecting to TCP server
        iStatus = sl_Connect(iSockID, ( SlSockAddr_t *)&sAddr, iAddrSize);
        if( iStatus < 0 )
        {
            // error
            sl_Close(iSockID);
            ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
        }
    
        // sending multiple packets to the TCP server
        while (lLoopCount < g_ulPacketCount)
        //while(1)
        {
            //iStatus = sl_Recv(iNewSockID, g_cBsdBuf, iTestBufLen, 0);
            iStatus = sl_Recv(iNewSockID, Data, iTestBufLen, 0);
    
            if( iStatus < 0 )
            {
                // error
                sl_Close(iSockID);
                ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
            }
            lLoopCount++;
        }
    
        //Report("Sent %u packets successfully\n\r",g_ulPacketCount);
    
        iStatus = sl_Close(iSockID);
        //closing the socket after sending 1000 packets
        ASSERT_ON_ERROR(iStatus, SL_SOCKET_ERROR);
    
        return 0; //return SUCCESS;
    
    }
    //*****************************************************************************
    //
    //! Initialization
    //!
    //! This function
    //!        1. Configures the UART to be used.
    //!        2. Initializes command history.
    //!
    //! \param  none
    //!
    //! \return none
    //
    //*****************************************************************************
    UART_Handle InitTerm(void)
    {
        int8_t i;
        UART_Params uartParams;
    
        UART_init();
        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;
    
        uartHandle = UART_open(CONFIG_UART_0, &uartParams);
        /* remove uart receive from LPDS dependency */
        UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);
    
    
        /* initialize command history */
        app_CH.iCurrent = 0;
        app_CH.iTop = 0;
        app_CH.iNext = 0;
    
    
        for(i = 0; i < app_CH.iTop; i++)
        {
            app_CH.uHistory[i] = NULL;
        }
    
        return(uartHandle);
    }
    
    void Wifi2UART(void)
    {
        BsdTcpClient(PORT_NUM);
        UART_write(uartHandle, Data, sizeof(Data));
    }
    //*****************************************************************************
    //
    //! prints the formatted string on to the console
    //!
    //! \param[in]  format  - is a pointer to the character string specifying the
    //!                       format in the following arguments need to be
    //!                       interpreted.
    //! \param[in]  [variable number of] arguments according to the format in the
    //!             first parameters
    //!
    //! \return count of characters printed
    //
    //*****************************************************************************
    int Report(const char *pcFormat,
               ...)
    {
        int iRet = 0;
        char        *pcBuff;
        char        *pcTemp;
        int iSize = 256;
        va_list list;
    
        pcBuff = (char*)malloc(iSize);
        if(pcBuff == NULL)
        {
            return(-1);
        }
        while(1)
        {
            va_start(list,pcFormat);
            iRet = vsnprintf(pcBuff, iSize, pcFormat, list);
            va_end(list);
            if((iRet > -1) && (iRet < iSize))
            {
                break;
            }
            else
            {
                iSize *= 2;
                if((pcTemp = realloc(pcBuff, iSize)) == NULL)
                {
                    Message("Could not reallocate memory\n\r");
                    iRet = -1;
                    break;
                }
                else
                {
                    pcBuff = pcTemp;
                }
            }
        }
        Message(pcBuff);
        free(pcBuff);
    
        return(iRet);
    }
    
    //*****************************************************************************
    //
    //! Trim the spaces from left and right end of given string
    //!
    //! \param  pcInput - string on which trimming happens
    //!
    //! \return length of trimmed string
    //
    //*****************************************************************************
    int TrimSpace(char * pcInput)
    {
        size_t size;
        char        *endStr;
        char        *strData = pcInput;
        char index = 0;
    
        size = strlen(strData);
    
        if(!size)
        {
            return(0);
        }
    
        endStr = strData + size - 1;
        while((endStr >= strData) && (IS_SPACE(*endStr)))
        {
            endStr--;
        }
        *(endStr + 1) = '\0';
    
        while(*strData && IS_SPACE(*strData))
        {
            strData++;
            index++;
        }
        memmove(pcInput, strData, strlen(strData) + 1);
    
        return(strlen(pcInput));
    }
    
    //*****************************************************************************
    //
    //! Get the command string, and allow for it to be edited via UART
    //!
    //! \param[in]  pcBuffer    - Null terminated string, treated as already
    //!             containing useful data
    //! \param[in]  uiBufLen    - is the length of buffer store available
    //!
    //! \return Length of the bytes received. -1 if buffer length exceeded.
    //!
    //*****************************************************************************
    int GetCmd(char *pcBuffer,
               unsigned int uiBufLen)
    {
        uint8_t uChar;
        uint8_t uCh;
        int8_t iLen = 0;
        /* If the command prompt is clear, save the end of command prompt for use later */
        if(gSaveCursorPosition != false)
        {
            UART_writePolling(uartHandle, uSAVE_CURSOR_STR, strlen((char *) uSAVE_CURSOR_STR));
        }
        UART_readPolling(uartHandle, &uChar, 1);
        /* Checking the end of Command */
        while(1)
        {
            /* Handling overflow of buffer */
            if(iLen >= uiBufLen)
            {
                return(-1);
            }
            /* Copying Data from UART into a buffer
             * Checking for use of return/enter key */
            if((uChar == '\r') || (uChar == '\n'))
            {
                UART_writePolling(uartHandle, &uChar, 1);
                gSaveCursorPosition = true;
                break;
            }
            /* Catches escape sequences for the up and down arrow keys */
            else if(uChar == 0x1B)
            {
                UART_readPolling(uartHandle, &uChar, 1);
                /* included with up and down arrows */
                if(uChar == '[')
                {
                    UART_readPolling(uartHandle, &uChar, 1);
                    if(uChar == 'A') /* up arrow*/
                    {
                        uint8_t *uReturnedString = retCommand(-1);
                        uint8_t size = 0;
                        /* retCommand returns a Null pointer if there is nothing
                         * in the command history at the selected point,
                         * this makes sure nothing is read into the CmdBuffer */
                        if(uReturnedString != NULL)
                        {
                            size = strlen((char *)uReturnedString);
                            memcpy(pcBuffer, uReturnedString , strlen((char *)uReturnedString) + 1);
                        }
                        else
                        {
                            pcBuffer[0] = 0;
                        }
                        iLen = size;
                        ReplaceLine(pcBuffer);
                    }
                    else if(uChar == 'B') /* Down arrow */
                    {
                        uint8_t *uReturnedString = retCommand(1);
                        uint8_t size = 0;
                        /* retCommand returns a Null pointer if there is nothing
                         * in the command history at the selected point,
                         * this makes sure nothing is read into the CmdBuffer */
                        if(uReturnedString != NULL)
                        {
                            size = strlen((char *)uReturnedString);
                            memcpy(pcBuffer, uReturnedString , strlen((char *)uReturnedString) + 1);
                        }
                        else
                        {
                            pcBuffer[0] = 0;
                        }
                        iLen = size;
                        ReplaceLine(pcBuffer);
                    }
                }
            }
            /* This catches the backspace or delete chars and deletes the last character,
             * 0x7F is delete which can be sent by serial terminal instead of backspace */
            else if((uChar == '\b') || (uChar == 0x7F))
            {
                if(iLen != 0)
                {
                    UART_writePolling(uartHandle, &uChar, 1);
                    uCh = ' ';
                    UART_writePolling(uartHandle, &uCh, 1);
                    UART_writePolling(uartHandle, &uChar, 1);
                    pcBuffer[iLen] = 0;
                    iLen--;
                }
                else
                {
                    uCh = '\a';
                    UART_writePolling(uartHandle, &uCh, 1);
                }
            }
            else
            {
                /* Echo the received character */
                UART_writePolling(uartHandle, &uChar, 1);
    
                /* Add the received character to the command string */
                *(pcBuffer + iLen) = uChar;
                iLen++;
            }
            UART_readPolling(uartHandle, &uChar, 1);
        }
        /* Null termination */
        *(pcBuffer + iLen) = '\0';
        if(iLen > 0)
        {
            pushCommand(pcBuffer);
        }
        return(iLen);
    }
    
    /*Local functions to implement command history*/
    //*****************************************************************************
    /*!
        \brief          Return command from command history
    
        This function takes either 1 or -1 as its argument, and returns the command in
        the command history data structure either before or after the current location.
        The current location is kept track of seperately from where commands are added
        to the data structure.
    
        \param          Increment, must be 1 or -1
    
        \return         Address to the beginning of the command string, will be NULL if
                            there is not a command in the data structure
    
    
    */
    //*****************************************************************************
    uint8_t *retCommand(int8_t increment)
    {
        app_CH.iCurrent += increment;
    
        /* wrap around if index reaches a bound */
        if(app_CH.iCurrent < 0)
        {
            app_CH.iCurrent = app_CH.iTop - 1;
        }
        if (abs(app_CH.iCurrent) >= app_CH.iTop)
        {
            app_CH.iCurrent = 0;
        }
        uint8_t *uReturnVal = app_CH.uHistory[app_CH.iCurrent];
        return(uReturnVal);
    }
    
    //*****************************************************************************
    /*!
        \brief          Write command to command history.
    
        This function will record the command passed to it in the command history
        It will overwrite values when the structure is filled up.
    
        \param          Command, pointer to a string.
    
        \return         N/A
    
    */
    //*****************************************************************************
    
    void pushCommand(char *command)
    {
        /* Determine amount of data to allocate */
        size_t size = strlen(command) + 1;
        /* wrap around if reaches the end of the command history structure */
        if(app_CH.iNext >= CMD_HISTORY_LEN)
        {
            app_CH.iNext = 0;
            gStackFull  = true;
        }
        /* entry will be null if nothing is stored in it */
        if(app_CH.uHistory[app_CH.iNext] != NULL)
        {
            app_CH.uHistory[app_CH.iNext] = realloc(app_CH.uHistory[app_CH.iNext], size);
            /* resize to new string length */
        }
        else
        {
            app_CH.uHistory[app_CH.iNext] = malloc(size);
        }
    
        if(app_CH.uHistory[app_CH.iNext] == NULL)
        {
            /* Failure to allocate memory */
        }
        else
        {   /* initialize newly allocated memory */
            memset(app_CH.uHistory[app_CH.iNext], 0, size);
            memcpy(app_CH.uHistory[app_CH.iNext], command, size);
        }
            app_CH.iNext++;
            if(gStackFull != true)
            {
                app_CH.iTop++;
            }
            app_CH.iCurrent = app_CH.iNext;
    }
    //*****************************************************************************
    //
    //! Clears current line of terminal and outputs <str>, while preserving the
    //!       command prompt
    //!
    //! This function
    //!        1. Clears current line of terminal and outputs <str>
    //!
    //! \param[in]  str - is the pointer to the string to be printed
    //!
    //! \return none
    //!
    //
    //*****************************************************************************
    
    void ReplaceLine(const char *str)
    {
        /* Erases entered data, preserves command prompt when using command history */
        UART_writePolling(uartHandle, uRESTORE_CURSOR_STR, strlen(uRESTORE_CURSOR_STR));
        UART_writePolling(uartHandle, uERASE_LINE, strlen(uERASE_LINE));
        UART_writePolling(uartHandle, uSAVE_CURSOR_STR, strlen(uSAVE_CURSOR_STR));
        gSaveCursorPosition = false;
        UART_PRINT(str);
    }
    //*****************************************************************************
    //
    //! Outputs a character string to the console
    //!
    //! This function
    //!        1. prints the input string character by character on to the console.
    //!
    //! \param[in]  str - is the pointer to the string to be printed
    //!
    //! \return none
    //!
    //! \note If UART_NONPOLLING defined in than Message or UART write should be
    //!       called in task/thread context only.
    //
    //*****************************************************************************
    void Message(const char *str)
    {
    #ifdef UART_NONPOLLING
        UART_write(uartHandle, str, strlen(str));
    #else
        UART_writePolling(uartHandle, str, strlen(str));
    #endif
    }
    
    //*****************************************************************************
    //
    //! Clear the console window
    //!
    //! This function
    //!        1. clears the console window.
    //!
    //! \param  none
    //!
    //! \return none
    //
    //*****************************************************************************
    void ClearTerm()
    {
        Message("\33[2J\r");
    }
    
    //*****************************************************************************
    //
    //! Read a character from the console
    //!
    //! \param none
    //!
    //! \return Character
    //
    //*****************************************************************************
    char getch(void)
    {
        char ch;
    
        UART_readPolling(uartHandle, &ch, 1);
        return(ch);
    }
    
    //*****************************************************************************
    //
    //! Outputs a character to the console
    //!
    //! \param[in]  char    - A character to be printed
    //!
    //! \return none
    //
    //*****************************************************************************
    void putch(char ch)
    {
        UART_writePolling(uartHandle, &ch, 1);
    }
    

    void Wifi2UART(void)
    {
        BsdTcpClient(PORT_NUM);
        UART_write(uartHandle, Data, sizeof(Data));
    }
    
    int32_t BsdTcpClient(unsigned short usPort)
    {
        //int             iCounter;
        //short           sTestBufLen;
        int             iTestBufLen;
        SlSockAddrIn_t  sAddr;
        int             iAddrSize;
        int             iSockID;
        int             iStatus;
        long            lLoopCount = 0;
        int             iNewSockID;
        //uint8_t i;
    
        iTestBufLen  = BUF_SIZE;
    
        //filling the TCP server socket address
        sAddr.sin_family = SL_AF_INET;
        sAddr.sin_port = sl_Htons((unsigned short)usPort);
        //sAddr.sin_addr.s_addr = sl_Htonl((unsigned int)g_ulDestinationIp);
        sAddr.sin_addr.s_addr = sl_Htonl((unsigned long)SL_IPV4_VAL(192,168,1,31));
    
        iAddrSize = sizeof(SlSockAddrIn_t);
    
        // creating a TCP socket
        iSockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
        if( iSockID < 0 )
        {
            ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
        }
    
        // connecting to TCP server
        iStatus = sl_Connect(iSockID, ( SlSockAddr_t *)&sAddr, iAddrSize);
        if( iStatus < 0 )
        {
            // error
            sl_Close(iSockID);
            ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
        }
    
        // sending multiple packets to the TCP server
        while (lLoopCount < g_ulPacketCount)
        //while(1)
        {
            //iStatus = sl_Recv(iNewSockID, g_cBsdBuf, iTestBufLen, 0);
            iStatus = sl_Recv(iNewSockID, Data, iTestBufLen, 0);
    
            if( iStatus < 0 )
            {
                // error
                sl_Close(iSockID);
                ASSERT_ON_ERROR(iSockID,SL_SOCKET_ERROR);
            }
            lLoopCount++;
        }
    
        //Report("Sent %u packets successfully\n\r",g_ulPacketCount);
    
        iStatus = sl_Close(iSockID);
        //closing the socket after sending 1000 packets
        ASSERT_ON_ERROR(iStatus, SL_SOCKET_ERROR);
    
        return 0; //return SUCCESS;
    
    }
    
    void * mainThread(void *arg)
    {
      UART_init();
      // CC3235 wifi initialization
      Wifi2UART();
    }
  • Hi Hector,

    Is your PC getting a stream of data? Is the Wifi module connected to your PC recieving data? Is the radar sending data? Please check each step in the path and ensure it is working.

    Regards,

    Justin

  • Hi Justin,

    1. I modified CLI code, so mmWave radar self-initialize itself. The demo code of IWR6843 always has UART_writepolling() to send data to GUI. It can also be used to send data to another device via UART. I checked UART signal on Mss_Logger pin, it has correct waveform, then I also has the same waveform on RX pin of CC3235. I only need to do UART_read() on CC3235 (it's same as sample code in tida-010022 that CC1352 reads data from 6843).

    It's really difficult to check data CC3235 received from Mss_logger, since it separate 2 UART connection settings (2 jumpers to set UART route to COM port, another to route UART to boosterpack header pins). I have to use header pins to connect to Mss_logger. So I can't use XDS110 to check data on RX. Actually, I used a USB-to-UART converter to connect header pins to PC, but both TX, RX don't have any effect. When I use XDS110 port, I can still send command to CC3235 via Teraterm but it didn't work when I connect via header pins. 

    2. Let assume I don't use data received from 6843. If I create a buffer with a preset value to send to GUI via UART_write(), it should work normally. Here's my brief code in this case. It does not show any point cloud on GUI the buffer userData[] can be shown as coordinate of target. Please point out the wrong part. Thank you.

    UART_handle InitTerm()
    {
        int8_t i;
        UART_Params uartParams;
        UART_init();
        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;
    
        uartHandle = UART_open(CONFIG_UART_0, &uartParams);
        /* remove uart receive from LPDS dependency */
        UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);
            
        userData[0] = 1;
        for(i =0; i< sizeof(userData); i++)
        {
                userData[i] += 1;       
                UART_write(uartHandle, (uint8_t *)userData[i], sizeof(userData));
        }
    }
    
    void * mainThread(void *arg)
    {
     InitTerm();
    }
    

    If I want to send data from Server to Client socket, I will do like this:

    sl_Recv(iNewSockID, Data, iTestBufLen, 0);
    UART_write(uartHandle, (uint8_t *)Data, sizeof(Data));

    Below is my GUI code after modified to directly get data from CC3235S UART without sending Cfg

    gui_main420_2nd.zip

  • Hi Hector,

    For sending data to the gui, the baudrate should be 921600. Second, you will need to check and ensure the data you are sending is in the correct format.

    Regards,

    Justin

  • Hi Justin,

    1. I see the function sendCfg() not only has in gui_main.py, but also has in oob_parser.py. Last time you only mentioned modify code in gui_main.py to skip send Cfg and directly show tracking demo. How about oob_parser.py? Is there any part I need to modify in it?

    2. About correct format, do u mean we must do UART_write(buf) with buf has the same format as the buf in GUI code? I see source code of HVAC, UART_write() sends data in the form of data structure with elements: frame_number, posx,posy... are uint8_t. So I created some preset values (uint32_t type) for my own data structure, set baud rate in my CC3235S code to 921600 and send to GUI. Then I opened Teraterm to check Data port, there was no output to PC. If I want to create my own data to send from CC3235 to PC via UART, which data format can I set for the artificial data of frame number, target position... to test whether PC can receive data from CC3235?

    Here's my code to set sensor data and send to PC via UART. I use id, x,y with preset value to assign for sensorData and send via UART_write(), but in Teraterm Data port, there's no data. Is it ok to assign decimal data to them or hex values? Please give me sample code to make my code work properly.

    static struct mmwaveSensorNode latestMmwaveNode;
    
    static void processSensorData()
    {
        Smsgs_sensorMsg_t sensorData;
        uint32_t id = 0;
        uint32_t x = 1;
        uint32_t y = 1;
        memset(&sensorData, 0, sizeof(Smsgs_sensorMsg_t));
    
        uint8_t i;
        sensorData.mmwaveSensor.frame_number = 100;
        sensorData.mmwaveSensor.num_objs = 2;
    
        for(i=0; i<SMSGS_SENSOR_MMWAVE_MAX_OBJ; i++)
        {        
            sensorData.mmwaveSensor.objInfo[i].tid = id;
            id += 1;
            sensorData.mmwaveSensor.objInfo[i].posx = x;
            x += 1;
            sensorData.mmwaveSensor.objInfo[i].posy = y;
            y += 1;
        }
    
        mmwaveUpdateData(sensorData.mmwaveSensor);
    }
    
    void mmwaveUpdateData(Smsgs_mmwaveSensorField_t mmwaveData)
    {
        latestMmwaveNode.mmwaveData = mmwaveData;
    
        Semaphore_post(mmwaveSemHandle);
    }
    
    /******************************************************************************
     Local Functions
     *****************************************************************************/
    
    static void mmwaveUpdatePC(struct mmwaveSensorNode* node)
    {
        uint8_t i;
        char s = '$';
        char n = '\n';
        //UART_write(uartHandle, &s, 1);
        UART_write(uartHandle, &node->mmwaveData.frame_number, 4);
        UART_write(uartHandle, &node->mmwaveData.num_objs, 2);
        for(i=0; i<SMSGS_SENSOR_MMWAVE_MAX_OBJ; i++)
        {
            UART_write(uartHandle, &node->mmwaveData.objInfo[i].tid, 4);
            UART_write(uartHandle, &node->mmwaveData.objInfo[i].posx, 4);
            UART_write(uartHandle, &node->mmwaveData.objInfo[i].posy, 4);
        }
        UART_write(uartHandle, &n, 1);
    }
    
    UART_Handle InitTerm(void)
    {
        int8_t i;
        UART_Params uartParams;
    
        /* Construct a Semaphore object */
            Semaphore_Params semParams;
            Semaphore_Params_init(&semParams);
            Semaphore_construct(&mmwaveSemStruct, 0, &semParams);
            mmwaveSemHandle = Semaphore_handle(&mmwaveSemStruct);
    
    
        UART_init();
        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 = 921600;   //115200;
    
        uartHandle = UART_open(CONFIG_UART_0, &uartParams);
        /* remove uart receive from LPDS dependency */
        UART_control(uartHandle, UART_CMD_RXDISABLE, NULL);
        
        /* Create the mmwave task */
                Task_Params_init(&mmwaveTaskParams);
                mmwaveTaskParams.stackSize = MMWAVE_TASK_STACK_SIZE;
                mmwaveTaskParams.priority = MMWAVE_TASK_PRIORITY;
                mmwaveTaskParams.stack = &mmwaveTaskStack;
                Task_construct(&mmwaveTask, mmwaveTaskFunction, &mmwaveTaskParams, NULL);
    
    
        return(uartHandle);
    }
    
    void * mainThread(void *arg)
    {
     SPI_init();
     GPIO_init();
     InitTerm();
    }

  • Hi Justin,

    I tried to modify demo code of xwr68xx to see whether GUI can still show point cloud as before. The result is, after I removed UART_write(uartHandle,(uint8_t*)&header,sizeof(MmwDemo_output_message_header)), I don't see any point cloud. As I understand, the GUI can only show tracking result when we send all data via UART_write(). I wanna ask:

    1. Do I need to use UART_write() or UART_writePolling() ?

    2. How to let GUI show point cloud when I only send coordinate x/y? When I create my own data to test whether CC3235 can send data to GUI normally, it didn't work. I think it's because GUI code is fixed with a data transfer format. Please help me handle it.

  • Hi Hector,

    1. This doesn't matter as long as it is kept consistent on the device.

    2. The format is described in the user's guide. You may want to add print statements or some other type of flag in the parsing code of the GUI to detected what TLV you are sending incorrectly.

    Regards,

    Justin

  • Hi Justin,

    1. I sent frame_number, number of objects, TID, position x/y without magic_word, number of TLV, totalPacketLen. Does it mean GUI didn't work because I haven't sent all information? How to make GUI work with only some of the information I want as above?

    2. As I referred to TIDA-010022, a TI engineer said CC1352 sub-1Ghz bandwidth is not enough to show point cloud on GUI. How about the compatibility between CC3235S & mmWave toolbox GUI? Can I show point cloud via TCP/IP socket transfer rate?

  • Hi Hector,

    Why don't you capture the information you are sending over UART (use something like teraterm) then run the parser object itself over this dataset. Then you can determine what is failing.

    Regards,

    Justin