• 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

    Polling issue with high register number with Arduino via Modbus

    User help
    5
    27
    19.3k
    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.
    • hussamH
      hussam
      last edited by

      update rate must be >timeout*(retries+1),and max read bit count=16*register. just fyi

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

        stensma, JoelHaggar, hussam, thanks for your answers, this helped a lot!

        I changed update period to 1200 ms, timeout to 500 ms with 1 retry, max read bit count to 160 and max read/write register count to 10. No aborted polls and timeouts so far after 0,5 h run, nevertheless, I will test it further.

        What is still present is error I see in log and command window, the content is as below:

        (com.serotonin.io.serial.JsscSerialPortInputStream.serialEvent:134) - java.lang.NullPointerException

        I get it every 5 - 8 ms, then there is ~50 ms break, and it starts again. I suppose the error occurs every time something is calculated/updated but I cannot get what might be wrong here.

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

          I tested this settings further (and even some others) and the problem is still present. Just after launch of both Arduino and Mango it goes good for circa 40 minutes, then there is a series of 10 to 20 timeouts lasting from 1 to 3 minutes and then can be a 5 minutes break for normal working or even smaller. Sometimes errors start to appear even 5 minutes after launch.

          I even tried 1000 ms retry and 3000 ms update period but no success, the rate of occurring errors is similar. Any hints what to do now?

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

            Can you print more of the stack trace for that NullPointerException?

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

              phildunlap, thanks for your post.

              Below, you can find my current settings (I believe they have an impact on error appearing rate). The whole log with started "Modbus" data source is here: http://pasted.co/7265b7d4

              modbus_settings.JPG

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

                Hi copytco,

                I took a look at where those NullPointerExceptions are coming from. I'm not sure it will solve your problem, but it could help sort the issue out a little. I modified this JsscSerialPortInputStream to 1) check for a null buffer and return (where I believe that mess of Exceptions are coming from) and 2) output a better error message from errors during the read. Have you seen if there's anything interesting in your Modbus log?

                You may also want to move your Mango/classes/debug-log4j.xml to Mango/classes/log4j.xml and rename the existing log4j configuration. This way you'll get debug messages for serial port receive events and whatnot.

                If you place the attached .class file into your Mango/overrides/classes/com/infiniteautomation/mango/io/serial/ directory and restart Mango, it should use this modified class instead.

                JsscSerialPortInputStream.class

                Having this file could conflict with future upgrades, so consider removing it after testing. In general, we do not support overridden class situations. You may have to rename the file to "JsscSerialPortInputStream.class"

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

                  Thank you, phildunlap.

                  I did what you have written - moved debug-log4j.xml in place of log4j.xml, created overrides folder and subfolders, and placed the file provided by you in there. Here is the log I received: http://pasted.co/d6b935a0

                  I do not know much about how Modbus works "inside", but I here is the log I received for this session: http://pasted.co/10adedb5

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

                    How interesting! It looks like there is a duplicate class in sero-utils and my override isn't being loaded. sero-utils pulled our Jssc code! This is quite bizarre... nothing in Mango references com.serotonin.io.serial.JsscSerialPortInputStream!

                    Edit The below probably won't work, the package in the java is wrong! Sorry!


                    Well, that's probably your issue. Try placing a copy of that .class file I gave you in Mango/overrides/classes/com/serotonin/io/serial/ as well. I will investigate why it's using the Jssc from sero utils...

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

                      Hi, I tried placing the file into serotonin folder and when tried to enable my data source, got an error as shown below.

                      modbus_error.JPG

                      What could I do about it now?

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

                        So is there any way of solving that problem? I see than I encounter the same error message even on fresh install of Mango when creating Modbus data source and defining at least one data point.

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

                          Hi copytco! Sorry for the delay.

                          Let's try this again....
                          JsscSerialPortInputStream.class

                          This time it's the one for the Mango/overrides/classes/com/serotonin/io/serial/ directory. I am hoping the stack trace will shed more light on what could be null in that method. I'm thinking the origin is the native library for the jssc. If so, another thing to try would be to attempt communication from a different computer to the arduino. I hope being able to read the stack trace sheds some light, though.

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

                            Thanks, phildunlap, I used your file and this is the log I received: http://pasted.co/6ac92888

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

                              Hi copytco, glad that class worked! I was able to get a little more information. Can you try this attached .class in that same location ( com/serotonin/io/serial ) and let me know if it's still occurring?

                              JsscSerialPortInputStream.class

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

                                Thanks, I see that there is no longer error message, but some other appeared. Details are here: http://pasted.co/ae06e69d To know if it resolves the aborted polls issue, I would need to let it run for couple of hours.

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

                                  Great! I do not know what you are referring to, "but some other appeared." The only errors I see relate to your meta points having some disabled points in the context. Remember, we turned on debug logging! Please let me know if that fixes the issue for you, and I can discuss the modification I made with the other developers for integration.

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

                                    Thanks, unfortunately I still experience those errors mentioned in the first post. Though, they seem to be a little bit less intensive.

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

                                      How bizarre. Like I said, I think part of the error is from the native portion of the JSSC, so perhaps you could have better luck on a *nix system. It would be nontrivial to troubleshoot this more through the forum. Would you mind providing a couple details? Like, what version of windows are you using? Can you confirm the errors are still from com.serotonin.io.serial.JsscSerialPortInputStream?

                                      My understanding of what I think it going on is that JSSC is reporting an RX event, and then we're requesting to read the number of bytes the event purports to contain. This null would suggest an RX event occurred purporting more bytes than it had (or than are actually in the buffer), which would suggest a deeper problem.

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

                                        I run Mango on Windows 7 Home Premium, on Asus K53S with i7-2630QM CPU. All I know about those errors is that what is in the first post and while going through the log I see also something like that:

                                        WARN 2016-01-15 19:25:18,888 (com.serotonin.m2m2.rt.dataSource.PollingDataSource.scheduleTimeout:106) - Modbus: poll at 2016/01/15 19:25:18 aborted because a previous poll started at 2016/01/15 19:25:16 is still running
                                        DEBUG 2016-01-15 19:25:18,888 (com.serotonin.m2m2.rt.EventManager.raiseEvent:155) - Event raised: type=DataSoureEventType(dataSourceId=2, eventTypeId=4), message='Modbus': Data source with xid: DS_257972 and name: Modbus, aborted 219 polls.

                                        I can try to run fresh Mango install on virtual machine with Ubuntu installed and see what happens.

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

                                          Seems like pretty normal conditions. It's definitely experienced heavy use on Windows 7. So, you're not getting the same NullPointerException, or you are? It's certainly possible the Arduino is saying something it shouldn't to the wire.

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

                                            No, this exception no longer occurs. However, timeout errors are still present. I imported the project, after some modifications, to ScadaBR and It works without those errors. Also, I have set up RapidSCADA and It is also going without any timeouts on the same polling time configuration, so this drives me to conclusion, that the issue comes directly from Mango.

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