Page 2 of 2

Re: No such file or directory: '/dev/ttyRS485'

Posted: 19 Dec 2022, 23:38
by MikeStern
Hi,
I bought another RevPi Connect+ device but I have again the same modbus communication problem with Modbus RS485 on /dev/ttyRS485

- if i use '/dev/ttyUSB0' (with usb/rs485 adapter) all work correctly !!!
- if i use '/dev/ttyRS485' (with two wire +- connected to modbus rs485 pinout) doesn't work !!!

Why the /dev/ttyRS485 is very problematic? How can you check surely the problem and how to solve it?

Thanks

Re: No such file or directory: '/dev/ttyRS485'

Posted: 20 Dec 2022, 07:21
by nicolaiB
Please provide logout put from dmesg and error messages if applies.

Nicolai

Re: No such file or directory: '/dev/ttyRS485'

Posted: 16 Jan 2023, 11:44
by KoenW
Hi,

I'm having the same problem with a Connect. I cannot get modbus to work in Codesys with RS485 connector on the front. (see image in this post: https://revolutionpi.de/forum/viewtopic ... sys#p13118)

I followed the comments from Nicolai and turned off PiModbus Master and Slave in Pictory.

I also followed the Codesys steps here: https://revolutionpi.com/tutorials/beis ... u-slave-2/ - This suggests to use tty/USB in the CODESYSControl.cfg settings.

I checked these steps per an old post from Amar: https://www.fleaplc.it/index.php/tutori ... ys-control

Somebody is suggesting to use /ttyRS48 (no '5') and set to port 6: https://forge.codesys.com/forge/talk/Ru ... 2239cdd18/ - but that's not working either.

I'm a bit lost with all these different options? What is the official suggestion from Kunbus? And how should i troubleshoot this: do i check dmsg first? Can I check any log in Codesys that may be helpful?

Regards
Koen

Re: No such file or directory: '/dev/ttyRS485'

Posted: 19 Jun 2023, 15:29
by KoenW
Ok, so I have it working now and I thought it worthwhile to share 1 or 2 things that confused me.

Firstly, I made sure my hardware and wiring was working to the RevPi Connect:
1. Disable Codesys runtime (I just did 'sudo systemctl stop codesyscontrol', followed by 'sudo systemctl disable codesyscontrol'
2. Then set Modbus RTU slave up in Pictory and test this with QModMaster, exactly per this tutorial: https://kunbus-gmbh.atlassian.net/servi ... /416055479
3. Note: in Pictory, the Modbus RTU slave is set up to look at etc/ttyRS485 and 19200 Baudrate, and parity set to None

Then, with the above proven to work, I went to focus on Codesys settings. I will just say what worked after trying a few options:
0. Obviously re-enable CodesysControl first: 'sudo systemctl enable codesyscontrol' and 'sudo systemctl start codesyscontrol'
1. Delete the Modbus RTU slave from Pictory and don't forget to do 'save as start config' and 'reset driver'
2. Don't put anything in '/etc/CODESYSControl.cfg' (this is contrary to this instruction: https://revolutionpi.com/tutorials/bei ... u-slave-2/)
3. Add the following to '/etc/CODESYSControl_User.cfg':
[SysCom]
Linux.Devicefile=/dev/ttyUSB
Strange how in Pictory you use etc/ttyRS485, but in Codesys config it's etc/ttyUSB !
4. In your Codesys project, make sure you set the Baudrate and Parity (I kept same as before: 19200 and None) on the Modbus_Com serial port. Also, select COM port 1!
5. And then, obviously map your variables and call them in a POU.
6. Note that if there is no Master reading or writing, the Modbus Serial Device will still show a dead bus, although the Modbus Device above it will show to be running happily. Once there is actual trafic on the bus, everything goes green.

The main confusion is around the use of etc/ttyUSB instead of etc/ttyRS485 on the Connect and then the fact that this must be in CODESYSControl_User.cfg, which is not what the tutorial states.

Good luck everyone.
Koen