Serial to Socket Transmitter

Principle

The MicroEJ Serial to Socket Transmitter is a tool which transfers all bytes from a serial port to a TCP client or TCP server.

It is typically used to transfer the output traces of a testsuite executed on a device.

Use

To start transferring data from the COM0 serial port to the port 5555, execute the serialToSocket task as follows:

./gradlew serialToSocket

After the execution of the task, you should see a message similar to the following one:

INFO: Now listening on Serial Port COM0
INFO: Redirecting to localhost:5555.

To customize the serial port, baudrate, socket port or socket address, you can provide the corresponding properties (see Options).

Options

The Serial to Socket Transmitter can be configured using the following options in the microej.serialToSocket block of the gradle.properties file:

microej {
    serialToSocket {
        serialPort = "COM0"
        socketPort = 5555
        baudRate = 115200
        dataBits = 8
        stopBits = 1
        parity = "none"
    }
}
  • serialPort: Defines the COM port.

    • Default value: COM0

      • Windows: COM1, COM2, , COM*n*

      • Linux: /dev/ttyS0, /dev/ttyUSB0, , /dev/ttyS*n*, /dev/ttyUSB*n*

  • socketPort: Defines the TCP server port.

    • Default value: 5555

  • socketAddress: Defines the TCP server address.

    • This option has no default value, if not set, the transmitter will act as a TCP server (hosting on localhost), otherwise it will act as a TCP client connecting to the specified address.

  • baudRate: Defines the COM baud rate.

    • Default value: 115200

    • Available values:
      • 9600

      • 38400

      • 57600

      • 115200

  • dataBits: Defines the number of data bits transmitted in each serial frame.

    • Default value: 8

  • stopBits: Defines the number of stop bits used to signal the end of a serial frame.

    • Default value: 1

  • parity: Defines the parity checking method.

    • Default value: none

    • Available values:
      • none

      • even

      • odd