How can I have diffrent nodes modbus and serial node use the same usb port?

My issue is that I only have one usb port and thus only one config node can connect to it at any given time both my serial node and modbus node need their config node to be connected to the usb port for the node to work.

I do know a easy fix is to have 2 usb to rs485 converter so I have 2 usb port that both config node can be connected to but the whole point of RS485 is that I can have 1 port to control 255 devices over some distant using wires. I am using less than 255 devices so if I have more than 1 usb to rs485 converter it seems strange.

This is my flow

[{"id":"ce085873429da727","type":"serial out","z":"5166dd2a7e38940b","name":"","serial":"bbc414bb7e1feaec","x":430,"y":340,"wires":[]},{"id":"ee4d246d01114515","type":"inject","z":"5166dd2a7e38940b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":80,"wires":[["d079711f78c1baa8"]]},{"id":"d079711f78c1baa8","type":"function","z":"5166dd2a7e38940b","name":"","func":"msg.payload={ 'fc': 3, \n              'unitid': 3, \n              'address': 0 , \n              'quantity': 3 };   \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":280,"y":140,"wires":[["5db00c229ce0e15c"]]},{"id":"5db00c229ce0e15c","type":"modbus-flex-getter","z":"5166dd2a7e38940b","name":"","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"64e234ec8ad4b896","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":290,"y":180,"wires":[["4efbfd818ce4af96"],[]]},{"id":"4efbfd818ce4af96","type":"debug","z":"5166dd2a7e38940b","name":"sensor 3 raw data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":290,"y":240,"wires":[]},{"id":"add795f329a38cb4","type":"inject","z":"5166dd2a7e38940b","name":"\"string\", \" 0x3d\", \" 0x10\", 17","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0x68\", \" 0x03\", \" 0x01\", \" 0x00\", \" 0x22\", \" 0xab\", \" 0x04\", \" 0x9b\", \" 0x04\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x48\", \" 0x3d\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x48\", \" 0x3e\", \" 0x4a\", \" 0x3a\", \" 0x4b\", \" 0x3a\", \" 0x4b\", \" 0x3a\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x4b\", \" 0xc0\", \" 0x01\", \" 0x47\", \" 0x3e\", \" 0x48\", \" 0x3d\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x4b\", \" 0xc1\", \" 0x01\", \" 0x4a\", \" 0x3b\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x47\", \" 0x3e\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4a\", \" 0x3b\", \" 0x4d\", \" 0x38\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x47\", \" 0xc4\", \" 0x01\", \" 0x4a\", \" 0xc1\", \" 0x01\", \" 0x47\", \" 0xc5\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x47\", \" 0xc5\", \" 0x01\", \" 0x4a\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x49\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x49\", \" 0xc2\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0x3f\", \" 0x4a\", \" 0x3b\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0xc5\", \" 0x01\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0x86\", \" 0x05\", \" 0xa7\", \" 0x04\", \" 0xa0\", \" 0x04\", \" 0x46\", \" 0x3f\", \" 0x46\", \" 0xc6\", \" 0x01\", \" 0x46\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0x40\", \" 0x45\", \" 0xc6\", \" 0x01\", \" 0x44\", \" 0xc7\", \" 0x01\", \" 0x42\", \" 0xca\", \" 0x01\", \" 0x42\", \" 0xca\", \" 0x01\", \" 0x42\", \" 0x44\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xca\", \" 0x01\", \" 0x41\", \" 0xcd\", \" 0x01\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x47\", \" 0x3e\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0xce\", \" 0x01\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0x48\", \" 0x3d\", \" 0xcf\", \" 0x01\", \" 0x3d\", \" 0x10\", \" 0x16\"]","payloadType":"bin","x":220,"y":320,"wires":[["ce085873429da727","d6572391d59bb2cb"]]},{"id":"d6572391d59bb2cb","type":"debug","z":"5166dd2a7e38940b","name":"17 [\"0x68\", \"0x03\" ,]","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":300,"wires":[]},{"id":"bbc414bb7e1feaec","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":" ,","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"1","bin":"bin","out":"time","addchar":"","responsetimeout":"10000"},{"id":"64e234ec8ad4b896","type":"modbus-client","name":"RS485-1","clienttype":"simpleser","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":1,"commandDelay":200,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":true}]

I also asked this qn on this topic but I repost this qn using the modbus tag

Typically serial ports are single use and whatever opens it will create a hard lock preventing anything else from also opening the port.

So to have more that one service connected to a single serial port requires some form of port sharing arrangement at the OS level. This is certainly possible but isn't a default configuration.

Do you have any recommendation of how to do port sharing( or shared serial driver if I get it ). The device I am using is a Jetson Nano which OS is Linux4Tegra a version of Ubuntu 18.04

Not done it for a very long time. This might work though: Virtual Serial Port for Linux - Stack Overflow

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