![]() The systems test just needed to use the virtual port name to run in the test environment without modification. For more information, visit Building and Running an Example. Running the Example To run the example from Qt Creator, open the Welcome mode and select the example from Examples. The embedded code was compiled into an executable for the test platform - using a custom runner script and a mock serial API which read from and wrote to stdin and stdout. For receiving data synchronously over the selected serial port, use the read () or readAll () methods, and readyRead () signal. This virtual serial port was configured to pipe all data transferred to an executable (using stdin and stdout). Using the tool, I could create a virtual serial port in the test environment. Thinking about how to handle this, I eventually settled on a neat solution using the socat utility. This came with the challenge that the test environment would not have the device connected to the serial port. As part of the development, there was a series of system tests which ran from the development machine, sending example commands to the device and then checking the responses against expected values.Īs part of the testing process, I wanted to run the system tests in the CI/CD pipeline. Application commands and device responses were exchanged using the device’s serial port. ![]() Recently, I’ve been working on an embedded system which used a physical serial port for communication. The -d -d -v options are used to print virtual port stream values to the console as well as the target. The EXEC option will run the executable (given by the COMMAND value) and connect to the virtual serial port using stdin & stdout. ![]() The port is created using the file id given by the link option. The first pty options creates the virtual serial port. It took me a while to find the correct combination of options to make this work. Here is the magic command you need: socat -d -d -v pty,rawer,link= EXEC:,pty,rawer ![]() How can you test and debug programs using serial port communication when you don’t have access to a physical serial port? Using the socat utility to create virtual serial ports which pipe port traffic to custom executables using stdin/stdout. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |