How to debug serial out

Is there some way to debug a non-working serial connection? The gateway (Eltako FGW14-USB) remains silent.

Is that a USB/RS485 adaptor?

When you mean it is silent do you mean that you have put a scope on the outputs and there is no data?

Does it work if you use different software to drive the serial port?

@Colin, as per your suggestion, I wrote the following python program. It switches on a light, i.e. the USB/RS485 adapter works,

import serial as s
import time

ser = s.Serial()
ser.port = '/dev/ttyUSB0'
ser.open

while ser.isOpen():
    input('Error: Ser is already open, please close it manually. if the port is closed, press enter\n')
    try:
        ser.close()
    except serial.serialutil.PortNotOpenError:
        pass
ser.open()

b1 = bytearray.fromhex('a5 5a 0b 05 30 00 00 00 ff e7 af c0 30 c5')
ser.write(b1)

So, then the question is that why the following doesn't do the same.

[
    {
        "id": "a4f4870704c37208",
        "type": "inject",
        "z": "21791ddc4a0ad0ab",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "'a5 5a 0b 05 30 00 00 00 ff e7 af c0 30 ff'",
        "payloadType": "str",
        "x": 110,
        "y": 540,
        "wires": [
            [
                "c5de03e978ce6e02",
                "7806e797fa467d7a"
            ]
        ]
    },
    {
        "id": "c5de03e978ce6e02",
        "type": "debug",
        "z": "21791ddc4a0ad0ab",
        "name": "debug 23",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 320,
        "y": 480,
        "wires": []
    },
    {
        "id": "7806e797fa467d7a",
        "type": "serial out",
        "z": "21791ddc4a0ad0ab",
        "name": "",
        "serial": "c498c0f59b8c57ec",
        "x": 330,
        "y": 540,
        "wires": []
    },
    {
        "id": "c498c0f59b8c57ec",
        "type": "serial-port",
        "serialport": "/dev/ttyUSB0",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "dtr": "none",
        "rts": "none",
        "cts": "none",
        "dsr": "none",
        "newline": "14",
        "bin": "bin",
        "out": "count",
        "addchar": "",
        "responsetimeout": "100"
    }
]

You need to inject a buffer if that is what you want to send :slight_smile: currently you have it set to inject a string.

[{"id":"a4f4870704c37208","type":"inject","z":"27d4cd61f8c2d5ed","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0xa5\",\"0x5a\",\"0x0b\",\"0x05\",\"0x30\",\"0x00\",\"0x00\",\"0x00\",\"0xff\",\"0xe7\",\"0xaf\",\"0xc0\",\"0x30\",\"0xff\"]","payloadType":"bin","x":150,"y":160,"wires":[["c5de03e978ce6e02","7806e797fa467d7a"]]},{"id":"c5de03e978ce6e02","type":"debug","z":"27d4cd61f8c2d5ed","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":360,"y":100,"wires":[]},{"id":"7806e797fa467d7a","type":"serial out","z":"27d4cd61f8c2d5ed","name":"","serial":"c498c0f59b8c57ec","x":370,"y":160,"wires":[]},{"id":"c498c0f59b8c57ec","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"14","bin":"bin","out":"count","addchar":"","responsetimeout":"100"}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.