Read data not working in SerialLibrary

Hi All,

I am trying to connect to a Linux device and test using the SerialLibrary, I am currently testing with a teensy board connected to COM31, it has a simple program to send the incoming data to a second serial port and send a response to COM31.
I can see the expected data from the teensy’s second serial port but no response data is recorded by SerialLibrary.

This is my resource code for SerialLibrary;

*** Settings ***
Documentation Connect to a Charger Unit using via Serial Port
Library SerialLibrary

*** Variables ***
${USERNAME} root\r
${PASSWORD} password\r
${RETURN} \r
${CHARGER PORT} COM31

*** Keywords ***
List My Com Ports
@{ports} = List Com Ports
Log ${ports[0].device}

Open Serial Port
Add Port ${CHARGER PORT}
… baudrate=115200
… bytesize=8
… parity=N
… stopbits=1
… timeout=999
sleep 1s
Open Port ${CHARGER PORT}
sleep 1s

Serial Port Log in
Write Data ${RETURN} encoding=ascii port_locator=${CHARGER PORT}
${read} = Read All And Log loglevel=debug encoding=ascii port_locator=${CHARGER PORT}
sleep 1s
Write Data ${USERNAME} encoding=ascii port_locator=${CHARGER PORT}
${read} = Read All And Log loglevel=debug encoding=ascii port_locator=${CHARGER PORT}
sleep 1s
Write Data ${PASSWORD} encoding=ascii port_locator=${CHARGER PORT}
${read} = Read All And Log loglevel=debug encoding=ascii port_locator=${CHARGER PORT}
sleep 1s

Serial Check for Version
Write Data cat /opt/ovo/version.txt encoding=ascii port_locator=${CHARGER PORT}
${read} = Read All And Log loglevel=debug encoding=ascii port_locator=${CHARGER PORT}
sleep 1s

And this is output form my test;

[info] Starting the test case to connect via Serial Port
[info (+0.01s)] @{ports} = [ COM13 - Silicon Labs CP210x USB to UART Bridge (COM13) | COM1 - Communications Port (COM1) | COM31 - USB Serial Device (COM31) ]
[info] COM13
[info (+1.01s)] Slept 1 second.
[info (+1.01s)] Slept 1 second.
[info] ${read} = None
[info (+1.01s)] Slept 1 second.
[info] ${read} = None
[info (+1.00s)] Slept 1 second.
[info (+0.01s)] ${read} = None
[info (+1.01s)] Slept 1 second.
[info (+0.01s)] ${read} = None
[info (+1.01s)] Slept 1 second.
Should be able to open a Serial Connection to a Charger :: This is… | PASS |

Can anyone help please?

Many thanks

Stephen

Hi all,
I’ve solved this problem, I need to use Read Until and have specific character at the end of each response like “/r”.

Regards
Stephen

1 Like