Trouble using rs485 and Modbus on reComputer R1000

Hi I am following the instructions here on the latest arm64 Raspberry Pi OS: How to use rs485 and modbus with reComputer R1000 but I am not able to see any interfaces like /dev/ttyAMA* after everything completes correctly as per the instructions.

Hi, I did follow the instructions to install-drivers on the SeeedStudio wiki and after rebooting now have 3 devices /dev/ttyAMA2, /dev/ttyAMA3, /dev/ttyAMA5 but I am not so far able to get a reponse from a 9600 baud N-8-1 device. on the unit the CH1A terminal is connected to the Data+ (plus) terminal of a Modbus RTU kWh meter with Modbus ID 3, the CH1B terminal is connected to the Data- (minus) terminal of the Modbus RTU meter, and terminal GND1 terminal is connected to the Ground/Shield of the Modbus RTU kWh meter, and I am using the following mbpoll command: mbpoll -a 3 -b 9600 -m rtu -r 29 -t 4:float -P none -1 /dev/ttyAMA2

solar@solarnode:~ $ mbpoll -a 3 -b 9600 -m rtu -r 21 -t 4:hex -P none -0 -c 2 /dev/ttyUSB_2
mbpoll 1.5-2 - ModBus(R) Master Simulator
Copyright (c) 2015-2023 Pascal JEAN,
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type ‘mbpoll -w’ for details.

Protocol configuration: ModBus RTU
Slave configuration…: address = [3]
start reference = 21, count = 2
Communication…: /dev/ttyUSB_2, 9600-8N1
t/o 1.00 s, poll rate 1000 ms
Data type…: 16-bit register, output (holding) register table

– Polling slave 3… Ctrl-C to stop)
[21]: 0x0000
[22]: 0x3F80
for example works fine when I use an FTDI USB-to-RS485 adapter, but the same command using the /dev/ttyAMA2 device returns: – Polling slave 3… Ctrl-C to stop)
Read output (holding) register failed: Connection timed out

Hi,

Like we mentioned, you issue has been put in a new thread and we shall follow here. Also we’ll run some tests simultaneously, see if we can reproduce the issue at our end.

Are you able to share the connection of your current setup?

Hi there,

If it works with the Adapter then the command is correct I would say, seems like a physical connection issue.
Have you tried switching the A and B?
Can you post a picture of how it looks connected?
HTH

GL :slight_smile: PJ :v:

Thanks PJ and Kevin, I got it working! it was just installing the driver,(the devices then appeared) then making sure the kernel module was loaded and re-loaded on reboot. I’m able to use mbpoll with device /dev/ttyAMA2 to poll a Modbus RTU kWh meter. just testing the other two ports /dev/ttyAMA3, /dev/ttyAMA5 and we’ll likely publish a SolarNodeOS image (which is Debian 12 based). Thanks again!

1 Like

Hi, I have received v1.0 of R1000 but impossible to get working RS485 on any port.
I followed the kernel mode but without success. It works great on v1.1 by the way.
I didn’t flash a new OS but tried with the one that comes shipped. I followed the instructions and tried on two different devices and I see that it hooks up correctly in dmesg but no success communicating with another device.

can you see the devices /dev/ttyAMA2, /dev/ttyAMA3, /dev/ttyAMA5 after installing the drivers?

Yes, LED blinks when sending the request.
I have a device that is connected with a cable of 50cm length if that helps. Maybe timing issue?
I see that gpio level changes for DE/RE but I still have Timeouts

Can you use a USB-to-RS485 adapter on the reComputer to make sure the unit itself is returning values? our OS maps one the USB ports to /dev/ttyUSB_1 and the other /dev/ttyUSB_2 so I could check that I could see the device that way first. when I did have /dev/ttyAMA2, /dev/ttyAMA3, /dev/ttyAMA5 devices listed but could NOT poll the kWh meter device, it was because the kernel module ( the r1000v1_rs485_autoflow.ko file) was not loaded. I had to both load it using a static reference to the file like: sudo insmod /home/solar/r1000v1-rs485-autoflow/r1000v1_rs485_autoflow.ko when I checked dmesg I saw:

[ 307.679976] r1000v1_rs485_autoflow: RS-485 interface has been hooked successfully
[ 312.470976] firewall denied: IN=eth0 OUT= MAC=ff:ff:ff:ff:ff:ff:c0:ee:40:71:0f:41:08:00 SRC=192.168.178.114 DST=255.255.255.255 LEN=129 TOS=0x00 PREC=0x00 TTL=255 ID=6140 PROTO=UDP SPT=50222 DPT=50222 LEN=109

I then did and tried my mbpoll command again and it worked, but on reboot I’m not sure if the kernel module reloaded. So I used the second method of sudo make dkms_install and that allowed for the module to be loaded on boot I understand because the mbpoll client commands worked afterwards, whereas they did not work before that.