Closed juuko2 closed 6 months ago
Should definitely work. Have you tried /dev/ttyS0 instead? The hat has both CAN and RS485 interfaces.
Also try swapping the TX/RX cables
https://www.waveshare.com/wiki/RS485_CAN_HAT did you follow the steps under "RS485 usage"?
I've tried all that but somehow I just can't get it to work.
Examples I've seen on how to use the HAT seem to use /dev/ttyS0. I have one of those myself, I can try it later tonight and see if it works.
Couldnt find a working SD card so testing will have to wait. Can you try again with /dev/ttyS0, and try swapping the wires too. Do you get the same error or another error?
With /dev/ttyS0 it ends up on the same error.
I have this can hat and wires connected on green rs485 module at AB pins.
Did you disable "user serial" and add the right line to /boot/config.txt?
Yes I did. I also try do downgrage node to version v18.19.0. This eda-modbus is still v.2.5.0.
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000
[all] enable_uart=1 dtparam=spi=on
But with /dev/ttys0 and /dev/ttyAMA0 I still get the same error. I stopped the systemd service and now only try to start with node.
The relevant steps are under "RS485 usage" here: https://www.waveshare.com/wiki/RS485_CAN_HAT
If you can't get the hat to work I suggest buying a USB RS485 adapter before giving up.
Closing this for now, there's not much more I can do at the moment
I am new to linux and don't have any previous experience with it. I have Greenair Pandion eco EDX with integrated HP. This model is custom-made for Desingtalo and it is for heating only with HP and normal electric heating element.
I have raspberry pi zero with waveshare rs 485 can hat, but I can't get readings from pandion and it fails to the first reading.
Now the RJ10 is connected to freeway port green/red cables connects to AB ports on can hat. Modbus is 1 in the EDA panel. So far I've tried the newest version and the 2.5.0. And everything should be working according to waveshare manuals.
I dont know what to try next so therefore I wanted to ask if it should work with this software version.
user@raspberrypiz:/opt/eda-modbus-bridge $ node eda-modbus-bridge.mjs --mqttBrokerUrl mqtt://192.168.1.xxx:1883 --mqttUsername xxx --mqttPassword xxxx --mqttDiscovery true -d /dev/ttyAMA0 2024-02-05T18:59:15.422Z [main] info: Opening serial connection to /dev/ttyAMA0, slave ID 1 2024-02-05T18:59:15.693Z [main] info: Connecting to MQTT broker at mqtt://192.168.1.xxx:1883 2024-02-05T18:59:15.698Z [main] info: Using MQTT broker authentication 2024-02-05T18:59:16.889Z [http] info: Listening on http://1:8080 2024-02-05T18:59:17.015Z [main] info: Successfully connected to MQTT broker at mqtt://192.168.1.xxx:1883 2024-02-05T18:59:22.128Z [modbus] error: Failed to read coil address 16, length 1 2024-02-05T18:59:22.138Z [main] error: An exception occurred: TransactionTimedOutError: Timed out
user@raspberrypiz:/opt/eda-modbus-bridge $ ifconfig can0: flags=193<UP,RUNNING,NOARP> mtu 16 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 65536 (UNSPEC) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 5 dropped 5 overruns 0 carrier 5 collisions 0
user@raspberrypiz:/opt/eda-modbus-bridge $ ls -l /dev/serial* lrwxrwxrwx 1 root root 5 5. 2. 20:24 /dev/serial0 -> ttyS0 lrwxrwxrwx 1 root root 7 5. 2. 20:24 /dev/serial1 -> ttyAMA0
user@raspberrypiz:/opt/eda-modbus-bridge $ dmesg | grep -i '(can|spi)' [ 8.254364] can: controller area network core [ 8.254536] NET: Registered PF_CAN protocol family [ 8.297258] can: raw protocol [ 39.899351] vc4-drm soc:gpu: [drm] Cannot find any crtc or sizes [ 43.363701] CAN device driver interface [ 44.625473] mcp251x spi0.0 can0: MCP2515 successfully initialized.