Skip to content

Did the switch press reach the boat? ​

A wireless switch on a bulkhead stops working. Nothing on a screen tells you whether the press was received, because by the time it reaches a screen it has already been through the receiver, the bus and the broker.

muxen-diag-sfsp watches the layer directly below all of that. It prints one line every time a switch button changes state, every time a receiver changes how many switches it is emulating, and every time a receiver hears a switch it does not recognise.

For an owner: this is a live log of the boat's wireless switches. Press a button, watch a line appear. If no line appears, the press did not arrive.

Running it ​

sh
muxen-diag-sfsp                    # read can0
muxen-diag-sfsp -i can1            # another CAN interface
muxen-diag-sfsp -h 127.0.0.1       # read the same events from MQTT
muxen-diag-sfsp -h 192.168.1.10 -p 1883

Giving -h switches it into MQTT mode. Without -h it opens the CAN interface directly.

Unlike the other four tools this one is not a full-screen table: it writes plain lines to standard output, so it can be piped, redirected or left running in a scrollback:

sh
muxen-diag-sfsp | tee /tmp/switches.log

Quit with Ctrl-C.

Which source to read ​

Both sources carry the same three events, but they are not the same measurement.

SourceWhat it proves when a line appears
CAN (-i)the frame is on the bus. The receiver heard the switch and reported it
MQTT (-h)the frame reached the bus and something decoded it onto the broker

So the pair is a bisection. Press a button:

  • A line in CAN mode and a line in MQTT mode — the whole chain works, and the fault is above the broker.
  • A line in CAN mode and nothing in MQTT mode — the receiver works and the decoding does not.
  • Nothing in CAN mode — the press never reached the bus. Battery, range, pairing, or the receiver itself.

CAN mode is the more fundamental of the two and the one to start with when the switch is suspected. MQTT mode is the one that works from a laptop.

The three lines it prints ​

A button changed state ​

switch    3: button 2 pressed
switch    3: button 2 released

The number after switch is the switch's displayed number, counted from 1: switch 3 is the interrupter at instance 2 on the bus. The button number is also counted from 1, and only the first four buttons of a switch are reported.

Only changes are printed. A button held down produces one pressed line, not a stream. Silence therefore means "nothing changed", not "nothing is being received".

A receiver changed how many switches it emulates ​

receiver  1: emulating 4 switch

Again printed only on change. A receiver that emulates a different number of switches after a pairing operation says so here.

A receiver heard a switch it does not know ​

receiver  1: unknown switch detected 3086238208 (0xB7F80000)

This is the pairing line, and it is the reason to run this tool during commissioning. The receiver heard a valid transmission from a switch that is not paired to it, and reports its identity both as a decimal and as a hexadecimal number.

Unlike the other two, this line is printed every time the frame arrives, not only on change — so an unpaired switch being pressed repeatedly produces a line per press.

Two uses:

  • Pairing. Press a button on the switch you are installing and read its id off this log.
  • Interference. A stream of unknown ids from a boat where everything is paired means the receiver is hearing switches that are not yours — a neighbouring boat, most often in a marina.

What to check when nothing is printed ​

Nothing being printed is the normal state of a boat where nobody is touching anything. Establish that the tool is working before concluding anything about the switches.

  1. In MQTT mode, did it connect? It says so on standard error:

    mqtt: connected to 127.0.0.1:1883

    A failure prints mqtt: connection failed (rc=…) instead.

  2. In CAN mode, is the interface up? ip link show can0. The tool binds the interface named by -i, defaulting to can0.

  3. Press a button and watch. A pressed line and a released line should follow within a moment of each other.

  4. Is anything else on the bus? candump can0 for a few seconds. A completely silent bus is a bus problem, not a switch problem.

What it does not show ​

  • It shows nothing a receiver did not report. A switch out of range, with a flat battery, or paired to a different receiver produces no line anywhere, and the tool cannot distinguish those from a switch nobody pressed.
  • It shows no state, only changes — except for unknown-switch reports. Starting the tool tells you nothing about what is currently pressed; you have to press something.
  • It does not show what the press did. Whether the press turned an output on is a question for muxen-diag-io. Running both side by side in two terminals is the direct way to see a press turn into an output.

Integration of multiplexed solutions
MUXEN and the MUXEN logo are trademarks of MUXEN SAS.