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.

IWRL6432BOOST: Industrial Visualizer code methods not receiving data from device over UART.

Part Number: IWRL6432BOOST

It was suggested that I look at the source code for the Industrial Visualizer to view how the program connects and receives and to base my parser off of that.

After a lot of searching and cutting, I've come up with a minimal version of the COM port connector and configuration file transmitter, but still I am unable to retrieve any data from the sensor.

The sensor is flashed with the motion and presence detection release image using the LP visualizer, and I am sending over the Presence detection configuration file as presented in the visualizer files.

# Package imports
import serial
import serial.tools.list_ports
import numpy as np
import time

# PresenceDetect config file
configFileName = 'cfg/6432config_pr.cfg'
print(configFileName)

# -- Find all Com Ports
serialPorts = list(serial.tools.list_ports.comports())
    
# -- Find default CLI Port and Data Port
# For xWRL6432 devices, we only need the CLI port, not the Data port, extract both just in case and save.
for port in serialPorts:
    print(port)
    if ('XDS110 Class Application/User UART' in port.description or 'Enhanced COM Port' in port.description):
        print(f'\tCLI COM Port found: {port.device}')
        comText = port.device
        comText = comText.replace("COM", "")
        cliComText = "COM" + comText 
    elif ('XDS110 Class Auxiliary Data Port' in port.description or 'Standard COM Port' in port.description):
        # This port is unused but we leave this part up for posterity.
        print(f'\tData COM Port found: {port.device}')
        comText = port.device
        comText = comText.replace("COM", "")
        dataComText = "COM" + comText

# connectComPort (singular, since we're using the 6432 device)
uart_baud = 115200 
# Extra settings: , bytesize = serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout= 0.5
com_uart = serial.Serial(cliComText, baudrate = uart_baud, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=0.6) # 4 for 6432; 7 for 1642
print("Port Assigned Succesfully")

com_uart.reset_output_buffer()

config = []
for line in open(configFileName):
    if line.startswith('%') == False and line != '\n':
        time.sleep(0.03)
        config.append(line)
        # Check if the config requests different baudrate
        splitline = line.split()
        if(splitline[0] == "baudRate"):
            try:
                com_uart.baudrate = int(splitline[1])
            except:
                print("\nError -- Invalid Baud rate\n")
        
        # Check if baudrate is different from the norm, if so we need to add character delay.
        if(com_uart.baudrate == 1250000):
            for char in [*line]:
                time.sleep(0.001)
                com_uart.write(char.encode())
        else:
            com_uart.write(line.encode())
        # Delay to read input has been registered
        for i in range(2):
            i += 1
            ack = com_uart.readline()
            print(ack)
               
time.sleep(0.03)
com_uart.reset_input_buffer()

# readAndParseUartSingleCOMPort
# Reopen CLI port
if(com_uart.isOpen() == False):
    print("Reopening Port")
    com_uart.open()
        
# Loop 
UART_MAGIC_WORD = bytearray(b'\x02\x01\x04\x03\x06\x05\x08\x07')
while True:
	# Find magic word, and therefore the start of the frame
    index = 0
    magicByte = com_uart.read(1)
    frameData = bytearray(b'')
    # If the device doesnt transmit any data, the COMPort read function will eventually timeout
    # Which means magicByte will hold no data, and the call to magicByte[0] will produce an error
    # This check ensures we can give a meaningful error
    if (len(magicByte) < 1):
        print("ERROR: No data detected on COM Port, read timed out")
        print("\tBe sure that the device is in the proper mode, and that the cfg you are sending is valid")
        magicByte = com_uart.read(1)
    elif (magicByte[0] == UART_MAGIC_WORD[index]):
        index += 1
        frameData.append(magicByte[0])
        if (index == 8): # Found the full magic word
            break
        magicByte = com_uart.read(1)          
    else:
    # When you fail, you need to compare your byte against that byte (ie the 4th) AS WELL AS compare it to the first byte of sequence
    # Therefore, we should only read a new byte if we are sure the current byte does not match the 1st byte of the magic word sequence
        if (index == 0):
            magicByte = com_uart.read(1)
        index = 0 # Reset index
        frameData = bytearray(b'') # Reset current frame data

All of these functions have been extracted from the Industrial Visualizer source code, with some modifications to get rid of the GUI code. I only include the magic word analyzer because the code never gets past that and just returns empty bytes, or b' ', even when just repeatedly scanning the COM port using com_uart.read(com_uart.in_waiting). The device switches are set to S1:100011 and S4:0001

The Industrial Visualizer works as intended but is very unstable and crashes often. Any modification to the source code does not seem to take, even just print commands which do not show up in the command line window that opens up with the Visualizer.

Any help would be appreciated with this as the device has been next to unusable outside of demo software in the LP Visualizer so far.

  • Hello,

    We are looking into the crashing you have mentioned.

    Best Regards,

    Pedrhom

  • Hi,

    A few questions so I can better understand. Which version of the radar toolbox are you using? Are you running the visualizer from source or .exe? There is a setUpEnvironment.bat file in the industrial visualizer source folder - do your Python packages match the versions listed in that file? When is the visualizer crashing, as the device is running and points are showing on the plot(s) or before you even run? I am surprised print commands are not showing up, where are you adding them? Even adding one at the beginning of the program before the GUI is launched doesn't show up?

    Regards,

    Tim

  • Hello,

    I am using version (1.10.00.13) of the radar toolbox as acquired from the very inaccessible download buttons found in the Resource Explorer page.  The visualizer is being run from the .exe file found in C:\ti\radar_toolbox_1_10_00_13\tools\visualizers\Industrial_Visualizer.

    The crashing occurs at very inconsistent and random moments; Sometimes it crashes right after boot and after I select my device, though I have successfully managed to boot it up, connect and get visual information going in it, namely the presence detection demo. The crashing normally occurs if I go to switch the configuration file and the demo presented. The visualizer is very graphics heavy on my system and can also crash if I fx move my hand too fast in front of the radar device, which is why I am trying to get a minimal python version started as I posted in my ticket.

    All the python packages are as described as I used the .bat file to install them.

    I added print commands in the readAndParseUartSingleCOMPort function in gui_parser.py right after the magic word has been found (after line 196) and I print the frame length that is acquired from the header. Neither of which show up in the command line window that opens with the Visualizer.

    Best regards, Halldór

  • Hi Halldór,

    A couple of things:

    1. What system are you running? The Visualizer is a little bulky, but it should not be too strenuous on an average computer. Are you running other CPU intensive processes in the background?

    2. The crashing might be caused by getting too many points from the radar device - sometimes too many points will crash it - I suggest looking at CFAR configurations in the .cfg file to raise the threshold for detected points.

    3. When you switch the demo/configuration file after the device is already running, you need to restart the visualizer.

    4. I suspect you aren't seeing the print statements since you are running the .exe and not running from python source? You should run "python gui_main.py" to run the code with changes you made.

    Regards,

    Tim