DeviceMaster Software Developer Kit Testing Serial Ports

There are two commands that run loopback (internal, RS-232, or RS-422) or port-to-port (RS-485) serial tests.

Loopback Tests (loop)

With a loopback plug connected to a port, the loop command may be used to run a loop-back test in either internal loop-back mode, RS-232 mode or RS-422 mode. In RS-232 mode, modem control lines are also tested. In RS-422 mode and internal loop-back mode, only data paths are tested. If the test fails, a hexadecimal error code is displayed. The first digit of the error code indicates what portion of the test failed. Loop-back error codes are shown in the table below.

Examples of loopback test commands are shown below.

  • RS-232 loopback test on Port 2:

    RedBoot> loop 232 2 

    Loopback pass
  • RS-232 loopback test on Port 3:

    RedBoot> loop 232 3

    - Loopback failed RS-232: 10680
  • Internal loopback test on Port 1:

    RedBoot>  loop int 1  

    Loopback pass
Loopback Error CodesCode Description
0x1ssss No data was present in the receive FIFO when there should have been. The channel status register is displayed in the lower 4 digits (ssss).
0x2ssss An error flag was present when receive data was read.
0x3ttrr Receive data byte did not match transmit data byte. The transmit data byte is tt and the receive data byte is rr.
0x40000 Receive data was present after the expected last byte.
0x5ssss CTS signal did not match expected value.
0x6ssss RI signal did not match expected value.
0x7ssss DSR signal did not match expected value.
0x8ssss CD signal did not match expected value.

Port-to-Port RS-485 Test (t485)

Some DeviceMaster models have internal loopback hardware for use by the loop command.

For models that do not support the loopback command for RS-485 ports an RS-485 cross-over cable must be connected between two different ports on the DeviceMaster.

The t485 command is used to perform a bi-directional, half-duplex, data-transfer test between two ports. If ports 0 and 4 are connected with an RS-485 crossover cable, the command to perform the test is:

RedBoot> t485 0 4

485 pass

Testing ports not connected to each other results in a failure:

RedBoot> t485 0 1

 - Failed 485 test: 1220008

nice color