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:
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.
Listing the modules
Section titled “Listing the modules”piTest -dThe 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.0Module is present input offset: 113 length: 6 output offset: 119 length: 7Every module must show Module is present.
Listing the configured signals
Section titled “Listing the configured signals”piTest cannot list all signal names. Read them from the PiCtory configuration instead:
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")EOFExample 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 bitThe 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.
Checking one signal
Section titled “Checking one signal”piTest -v Core_Temperaturevariable name: Core_Temperature offset: 117 length: 8 bit: 0piTest -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.
Reading a value
Section titled “Reading a value”Read a value once:
piTest -1 -r Core_Temperature1 Byte-Value of Core_Temperature: 50 dez (=32 hex)Print only the value:
piTest -1 -q -r Core_TemperatureRead a value every second until you press Ctrl+C:
piTest -r Core_TemperatureAdd ,h for hexadecimal or ,b for binary output, for example piTest -1 -r RevPiLED,b.
Writing a value
Section titled “Writing a value”piTest -w RevPiLED,1The value is written to the process image and the driver sends it to the module.
Outputs can also be read back with piTest -r.
Testing a digital output at the terminal
Section titled “Testing a digital output at the terminal”To prove that the PiCtory positions match the DIN rail, switch one output and measure it at the terminal:
- Make sure that no load is connected to the output, or that switching it is safe.
- Write
1:piTest -w O_1,1. - Measure the voltage at the terminal of output 1 on the module that you expect.
- Write
0:piTest -w O_1,0.
If the voltage appears on a different module, the positions in PiCtory are wrong.
Example: status LED of the base module
Section titled “Example: status LED of the base module”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.
RevPi Connect 4
Section titled “RevPi Connect 4”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.
| LED | Bits | Red | Green | Orange (red + green) | Blue |
|---|---|---|---|---|---|
| A1 | 0–2 | 1 | 2 | 3 | 4 |
| A2 | 3–5 | 8 | 16 | 24 | 32 |
| A3 | 6–8 | 64 | 128 | 192 | 256 |
| A4 | 9–11 | 512 | 1024 | 1536 | 2048 |
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).
piTest -w RevPiLED,1 # A1 redpiTest -w RevPiLED,2 # A1 greenpiTest -w RevPiLED,4 # A1 bluepiTest -1 -r RevPiLED # read back the valuepiTest -w RevPiLED,0 # all LEDs offRevPiLED 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.
Resetting the driver
Section titled “Resetting the driver”After a change in PiCtory, load the configuration into the driver:
sudo piTest -xThis 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.
Command overview
Section titled “Command overview”| Command | Purpose |
|---|---|
piTest -d | List 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 -x | Reset the driver and load the saved configuration |
lsmod | grep piControl | Check that the driver is loaded |
ls -l /etc/revpi/config.rsc | Check that the PiCtory configuration exists |