• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Modbus RTU RS-485 problem

    User help
    4
    10
    5.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mikael
      last edited by

      Hi. I recently got myself a raspberry PI. I was thinking of running a web server with modbus communication in Mango M2M. I have a FTDI usb/serial converter connected to my PI. The problem is that i am getting this error message constantly after a few minutes of polling:

      "com.serotonin.modbus4j.exception.ModbusTransportException: com.serotonin.modbus4j.sero.messaging.TimeoutException: request=SerialMessage [modbusMessage=ReadCoilsRequest [slaveId=1, getFunctionCode()=1, toString()=ReadBinaryRequest [startOffset=0, numberOfBits=1]]]"

      I have been running the same communication with Mango M2M in Windows 10 for a long time with the same FTDI converter and it has been working perfectly. So the problem seem to be in Linux/Rasbian OS .
      I have been googling this problem but havent find anything that have been working properly
      My modbus RTU setting are:
      Updaterate: 30s
      Timeout: 500ms
      Retries: 2
      Has anyone any idea what the problem is?

      Thanks in advance //Mikael

      1 Reply Last reply Reply Quote 0
      • C
        craig
        last edited by

        The error is a timeout. Are you sure you have the correct serial port address?

        Make sure you can use the serial port from other linux programs.

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          @craig thanks for helping people with their questions this last week!

          Hi Mikael,

          If I understand you correctly, you're saying that it works for several minutes, then stops working? As craig suggested, checking that the serial port works is a good first step. Linux is really nice in that you can do things like sudo echo "Hello World" >> /dev/ttyUSB0 and it'll try to write out those characters at the configuration of the serial port. Hopefully your converter has rx/tx LEDs?

          Some other things to keep eyes out for is reenumerating the serial port, but the enumeration changing. I.E. /dev/ttyUSB0 is now showing up as /dev/ttyUSB1 . You could see this enumeration occurring in a dmesg output. Another possibility is that something else is resetting the configuration periodically. So, in a working state, observe sudo stty -a -F /dev/ttyUSB0 and then observe the command again when it is not working. If the confiugration of the port is not the same, either the connection to the serial converter is bad (try another USB port) or something else is fussing with the serial converter.

          1 Reply Last reply Reply Quote 0
          • M
            Mikael
            last edited by

            Hello again, and thanks for taking time helping me.

            Yes, it is updating correcly for about 1-2 minutes no matter what updatarate and timeout i set. I get correct values. But then stops and i get the fault message. Yepp it has RX/TX leds and you see its updating correcly those first minutes. But then you see like 8-9 fast blinks from rx/tx leds and the fault message in m2m.

            I will try what you are suggesting tomorow and see what happens. I will come back when I have tested.

            1 Reply Last reply Reply Quote 0
            • M
              Mikael
              last edited by

              Hey . I have been searching for a answer for a few days with the new information I got from you, to solve my problem. No luck so far thou. I have been monitoring dmesg when i get error like you said. It looks like this:

              [177933.336023] ftdi_sio ttyUSB0: failed to get modem status: -32
              [177936.967285] ftdi_sio ttyUSB0: failed to get modem status: -32
              [177939.391069] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
              [177997.635468] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178012.491447] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178014.356323] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178022.094132] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178030.387082] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178037.685084] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178194.498338] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178211.858300] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178224.504454] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
              [178230.219091] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
              [178296.276900] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32[178330.143037] ftdi_sio ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -3
              [178382.466934] ftdi_sio ttyUSB0: failed to get modem status: -32
              [178388.017523] ftdi_sio ttyUSB0: failed to get modem status: -32
              And goes on and on if I try to reset the connection in Mango. One strange thing is that it seems to work perfect if you poll manually in "Point locataor test " in mango. I never get any error when I do the polls manually nomatter how many times i try it. I havent tested any other program with modbus yet. I will try to find a good modbus master software. Do you know any good one working with Rpi 3?

              //Mikael

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by phildunlap

                It is possible your slave doesn't respond at all to requests will illegal registers. You could try lowering the max registers per request to 1 and see if that changes anything.

                You have said Mango M2M twice, so I am wondering what version of Mango is this?

                Mango is my favorite modbus master!

                Googling that "usb serial failed to get modem status" got me a forum post with someone saying the voltage expected by their converter wasn't what was being supplied by the device. The device was supplying too low a voltage, says that forum.

                1 Reply Last reply Reply Quote 0
                • C
                  craig
                  last edited by

                  As phildunlap found it looks like a problem with the USB serial port and linux or rpi hardware and not a mango problem. Try a powered USB hub?

                  1 Reply Last reply Reply Quote 0
                  • M
                    Mikael
                    last edited by

                    Hello again! I baught an externaly powered usb hub today and plugged in my usb/serial adapter. I have only tested a short time sofar but , the polling in mango is working perfectly. So it seem to have solved my problem. Proberbly the voltage level is to low from the Pi usb outputs like you said.

                    Thank you phildunlap and craig for your guidance and help with this "pain in the ass problem of mine" .

                    1 Reply Last reply Reply Quote 0
                    • D
                      DieselD
                      last edited by

                      Make sure the Pi has an adequate power supply (>2 amps). I had some issues with mine until I got a proper power supply.

                      1 Reply Last reply Reply Quote 0
                      • M
                        Mikael
                        last edited by

                        I have the original 2.5 amp powersupply for raspberry Pi3 , so shouldnt be the problem in this case.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post