Good morning,
Do you know if there is a way to lock a usb port to a specific modbus device?
I have two modbus connection rtu and each one has its Modbus_COM where I check the raspberry serial port (usb).
Port 1 = ACM0 and Port 2 = ACM1
Now when I resume the raspberry happens that the doors are changed with the result that the modbus connections do not work.
How do I block the assignment of ports?
Thank you, Alberto
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is two way to fix one device to one serial port.
1) fixed by ID
2) fixed by Path
On raspberry side,
go /dev/serial/ path, you can se there are 2 folder inside it
One of them is by-id
other one is by-path both of them gives information about your device which connected usb port.
I always prefer by-id, recommended to choose by-id.
After choosing by-id, go into the by-id folder you can see your device information.
Copy this file name ( Copy whole name )
You got your device id, and it is time to fix your device id to one port.
now, your device fixed to name of you setted.
For example,
1) I have GPS module which works on USB.
when i looked into the /dev/serial/by-id/ folder i can see the name of the my device ( My device name is "usb-u-blox_AG_-_www.u-blox.com_u-blox_GNSS_receiver-if00" )
Good morning,
Do you know if there is a way to lock a usb port to a specific modbus device?
I have two modbus connection rtu and each one has its Modbus_COM where I check the raspberry serial port (usb).
Port 1 = ACM0 and Port 2 = ACM1
Now when I resume the raspberry happens that the doors are changed with the result that the modbus connections do not work.
How do I block the assignment of ports?
Thank you, Alberto
Hi Alberto,
Google for 'udev rules' this should point you into the right direction
BR
Edwin
I have a solution about it,
There is two way to fix one device to one serial port.
1) fixed by ID
2) fixed by Path
On raspberry side,
go /dev/serial/ path, you can se there are 2 folder inside it
One of them is by-id
other one is by-path both of them gives information about your device which connected usb port.
I always prefer by-id, recommended to choose by-id.
After choosing by-id, go into the by-id folder you can see your device information.
Copy this file name ( Copy whole name )
You got your device id, and it is time to fix your device id to one port.
turn raspberry terminal and write this sentence,
sudo ln -s /dev/serial/by-id/THISPATHFORYOURDEVICEID /dev/THISISYOURSYMBOLICLINKNAME
now, your device fixed to name of you setted.
For example,
1) I have GPS module which works on USB.
when i looked into the /dev/serial/by-id/ folder i can see the name of the my device ( My device name is "usb-u-blox_AG_-_www.u-blox.com_u-blox_GNSS_receiver-if00" )
2) sudo ln -s /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_GNSS_receiver-if00 /dev/XXX
before these steps, my gps device connected to ttyAMA0
after these steps, my gps device connected to XXX
so you can use XXX instead of ttyAMA0. And your device always will fixed to XXX.
I hope it can help to you
Originally created by: KevinR
Hello,
I had the same problem. I've had a UART onboard chip and a USB-two-Serial adapter.
With the help of the CODESYS Support, I've found a solution for this issue.
I've done following to fix it:
1.) Use persistent device names - to realize this, check out this blog entry:
http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/
2.) Edit the CODESYSControl.cfg file and create a "placeholder" name for the symbolic links (e.g. "ttySS"):
3.) Create the symbolic links
BR,
KevinR