Skip to content

Checking signals with SSH

On the RevPi, you can check the configured signals and their values without the logiccloud portal. Use this to test the wiring, to check a PiCtory change, or to compare a value in logiccloud with the value on the device.

All commands on this page run on the RevPi. Connect with SSH first:

Terminal window
ssh pi@<device-ip>

The password of the pi user is printed on the sticker on the side of the housing.

The command line tool is piTest. It is part of the RevPi image.

Terminal window
piTest -d

The command shows every module that the driver knows, with its position (Address) and its area in the process image:

Address: 0 module type: 136 (0x88) RevPi Connect 4 V1.0
Module is present
input offset: 113 length: 6
output offset: 119 length: 7

Every module must show Module is present.

piTest cannot list all signal names. Read them from the PiCtory configuration instead:

Terminal window
python3 - <<'EOF'
import json
with open("/etc/revpi/config.rsc") as f:
config = json.load(f)
for device in config["Devices"]:
for section in ("inp", "out", "mem"):
for var in sorted(device[section].values(), key=lambda v: int(v[3])):
print(f"{device['position']:>3} {device['name']:<18} {section:<4} {var[0]:<22} {var[2]:>3} bit")
EOF

Example output:

0 RevPi Connect 4 inp RevPiStatus 8 bit
0 RevPi Connect 4 inp RS485ErrorCnt 16 bit
0 RevPi Connect 4 inp Core_Temperature 8 bit
0 RevPi Connect 4 inp Core_Frequency 8 bit
0 RevPi Connect 4 out RevPiLED 16 bit
33 RevPi AIO inp InputValue_1 16 bit

The columns are: position, module, section (inp input, out output, mem module configuration), signal name and bit length. The bit length decides the data type in logiccloud. See Data type mapping.

Terminal window
piTest -v Core_Temperature
variable name: Core_Temperature
offset: 117
length: 8
bit: 0

piTest -v asks the driver, not the file. If the driver does not know the name, the command prints Failed to get variable info. The logiccloud connector finds signals in the same way, so a name that fails here also fails in logiccloud.

Read a value once:

Terminal window
piTest -1 -r Core_Temperature
1 Byte-Value of Core_Temperature: 50 dez (=32 hex)

Print only the value:

Terminal window
piTest -1 -q -r Core_Temperature

Read a value every second until you press Ctrl+C:

Terminal window
piTest -r Core_Temperature

Add ,h for hexadecimal or ,b for binary output, for example piTest -1 -r RevPiLED,b.

Terminal window
piTest -w RevPiLED,1

The value is written to the process image and the driver sends it to the module. Outputs can also be read back with piTest -r.

To prove that the PiCtory positions match the DIN rail, switch one output and measure it at the terminal:

  1. Make sure that no load is connected to the output, or that switching it is safe.
  2. Write 1: piTest -w O_1,1.
  3. Measure the voltage at the terminal of output 1 on the module that you expect.
  4. Write 0: piTest -w O_1,0.

If the voltage appears on a different module, the positions in PiCtory are wrong.

The RevPiLED output of the base module controls the LEDs on the front of the housing. Each LED uses a group of bits. The bit layout depends on the base module.

The RevPi Connect 4 has RGB LEDs. Each LED uses 3 bits: the lowest bit is red, the middle bit is green and the highest bit is blue.

LEDBitsRedGreenOrange (red + green)Blue
A10–21234
A23–58162432
A36–864128192256
A49–11512102415362048

Other colours combine the bits of one LED, for example red + blue (5 for A1) or green + blue (6 for A1). LED A5 uses the bits 12–15. See the KUNBUS documentation of the RevPi Connect 4 for this LED.

To switch several LEDs, add their values. For example, 10 switches A1 green (2) and A2 red (8).

Terminal window
piTest -w RevPiLED,1 # A1 red
piTest -w RevPiLED,2 # A1 green
piTest -w RevPiLED,4 # A1 blue
piTest -1 -r RevPiLED # read back the value
piTest -w RevPiLED,0 # all LEDs off

RevPiLED is 16 bits wide and holds all LEDs. Writing a new value changes all LEDs at the same time. To change one LED only, read the current value, change the bits of that LED, and write the complete value back.

RevPiLED needs no wiring and no I/O module, and you can see the result on the housing. This makes it useful for a first test of a logiccloud connection. See Example: reading and writing signals.

After a change in PiCtory, load the configuration into the driver:

Terminal window
sudo piTest -x

This has the same effect as Tools > Reset Driver in PiCtory. Then restart the logiccloud runtime. On the RevPi Bookworm image, sudo asks for the password of the pi user.

CommandPurpose
piTest -dList the modules
piTest -v <name>Show offset, length and bit of a signal
piTest -1 -r <name>Read a value once
piTest -r <name>Read a value every second
piTest -w <name>,<value>Write a value
sudo piTest -xReset the driver and load the saved configuration
lsmod | grep piControlCheck that the driver is loaded
ls -l /etc/revpi/config.rscCheck that the PiCtory configuration exists