Communication on Raspberry Pi with Device

Forum Home Forums Rapid SCADA on Linux and Raspberry Pi Communication on Raspberry Pi with Device

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #5463
    Avatarscadarapid
    Participant

    Hi.

    I use RapidScada on Raspberry Pi, and I have noticed that sometime the communication on raspberry pi with device is slow ,may be 5 minutes,after that communication will come back to normal.

    At that time, what happen to communication of Rapidscada with devices on RPi?
    How can I solve this problem.

    Thank you so much.

    #5466
    MikhailMikhail
    Moderator

    Hi,

    You need to analyze Communicator logs, CPU and memory usage.

    #8194
    Avatarhethongscada62
    Participant

    Dear Mr.Mikhail,
    To continue this topic, i need your help. My project is working properly on Raspberry Pi4. Many RS485 devices are communicating with server on Raspberry Pi4 via RS485-WiFi converter (TCP/IP), but unusable. Now i want to replace a Modbus TCP/IP protocal by Modbus RTU. That’s mean the RS485-USB converter will be used. So could you let me know how to configure the PortName for USB on Rapid Scada Communicator?
    Thanks and best regards
    Han Hoang

    #8196
    Avatarhethongscada62
    Participant

    Dear Mr.Mikhail,
    I want to note that the RS485-USB converter is recognised by Raspberry Pi4:
    “Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter”
    Thank you again
    Han Hoang

    #8197
    Avatarhethongscada62
    Participant

    Dear Mr.Mikhail,
    I want to replace some words “but unusable” by “but unstable”.
    Thanks

    #8198
    Avatarmanjey73
    Participant

    Udev rules

    Use an online translator. The rules can bind the USB-RS485 converter to a specific port name, depending on which USB port you connect the device to. Then the port name will look like /dev/mydev/Com1 or Com3 and so on

    #8199
    Avatarmanjey73
    Participant

    In general, by default, all ports have the form /dev/ttyUSBx, where instead of x, the number is from 0 and on. But if you have two or more devices, sometimes the numbers change. So that the number does not change and the Udev rule is made and the device has the same name, but it is bound to a specific port via symlink.

    #8200
    Avatarhethongscada62
    Participant

    Dear manjey73,
    Thank you for your reply.
    When i done a command: Sudo lsusb, i saw this “Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter”. I did not see any /dev/ttyUSBx.
    Maybe have to use another USB-RS485 converter, for example USB-RS485 converter FT232.
    Thanks

    #8202
    Avatarmanjey73
    Participant

    Run the
    dmesg | grep usb
    command and look at the output, there you will find the port number to which the USB-RS485 is connected, and in your case, most likely the serial number of the device. Cheap devices don’t have a serial number and can only be linked to the USB port number on the Raspberry

    UDEV rules must be applied when you connect two or more USB-RS485 devices. In your case, it will most likely be /dev/ttyUSB0

    • This reply was modified 2 months, 1 week ago by Avatarmanjey73.
    • This reply was modified 2 months, 1 week ago by Avatarmanjey73.
    #8205
    Avatarmanjey73
    Participant

    Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
    Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
    Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

    I didn’t pay attention, you have a cheap USB-RS485 converter, I have the same ones.
    But I have only 3 pieces installed. And at the time of reboot, they can change their numbers, for example, from /dev/ttyUSB0 to /dev/ttyUSB1, which is unacceptable for the system to work.
    So I apply the Udev rules so that they are named as I want, regardless of what number the device received.

    dmesg | grep usb

    [    2.031971] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
    [    2.164990] usb 1-1.2: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 3.00
    [    2.165006] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [    2.165015] usb 1-1.2: Product: USB-Serial Controller
    [    2.165025] usb 1-1.2: Manufacturer: Prolific Technology Inc.
    [    2.262025] usb 1-1.3: new full-speed USB device number 5 using dwc_otg
    [    2.395529] usb 1-1.3: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
    [    2.395550] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    [    2.395559] usb 1-1.3: Product: USB2.0-Serial
    [    2.491981] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
    [    2.625521] usb 1-1.5: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
    [    2.625539] usb 1-1.5: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    [    2.625549] usb 1-1.5: Product: USB2.0-Ser!
    [    2.944434] usbcore: registered new interface driver usbserial_generic
    [    2.944504] usbserial: USB Serial support registered for generic
    [    2.953464] usbcore: registered new interface driver ch341
    [    2.953554] usbserial: USB Serial support registered for ch341-uart
    [    2.965080] usb 1-1.3: ch341-uart converter now attached to ttyUSB0
    [    2.975967] usb 1-1.5: ch341-uart converter now attached to ttyUSB1
    [    3.042552] usbcore: registered new interface driver pl2303
    [    3.042659] usbserial: USB Serial support registered for pl2303
    [    3.058874] usb 1-1.2: pl2303 converter now attached to ttyUSB2
    [    3.955816] usbcore: registered new interface driver brcmfmac
    [13594.241044] pl2303 ttyUSB2: usb_serial_generic_read_bulk_callback - urb stopped: -32
    

    see the output of the command
    usb 1-1.3: ch341-uart converter now attached to ttyUSB0
    usb 1-1.5: ch341-uart converter now attached to ttyUSB1
    usb 1-1.2: pl2303 converter now attached to ttyUSB2

    Here 1.3 is the number of the USB port on the Raspberry and /dev/ttyUSB0 what is the port number received by the device

    #8206
    Avatarhethongscada62
    Participant

    Dear manjey73,
    I saw the name port for my USB.
    Thank you very much.
    Han Hoang

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.