• 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

    How to use the new Serial Data Source in Mango Automation 2.1

    User help
    4
    43
    32.6k
    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.
    • mebiusM
      mebius
      last edited by

      We tried according to Terry's guide and wiki but failed to receive response successfully.

      Good to say, Sending the command through mango point is work, but failed to receive response message successfully through another point.

      But the response message can be watched clearly by using a serial-port monitoring tool after sending the command message in mango.

      But no any response message is displayed in mango, even the receiving point's value regex is set to display all it can receive.

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

        In your case, checking whether any messages can be received would probably mean setting your message regex to (!)(.)\n with point identifier 1 and having an enabled alphanumeric point with point identifier "!", values regex (!)(.)\n and value index 2.

        When this data source was first developed it was printing all the serial traffic to the mango console, which made debugging the regex setup much easier. I need to look a little closer when I'm at a computer, and not just waiting for coffee, but I remember having message terminators in the value regex for the point was important.

        Edit: So, both the message regex and the value regex should end in your message terminator. We've said your terminator for (cr) is \n, but it depends on your system. If your serial stream watching utility doesn't display special characters in human readable ways, your message terminator is probably one of these three: "\n", "\r" or "\r\n" which will only cause you problems when trying to read a value (as the regex could fail to match the whole message, and since it's currently implemented as a "matches" and not a "find" it will need to match the entire serial message received).

        In the vast majority of default implementations, (.*) doesn't match \r or \n. Maybe the best catch-all you could use would be (!)(**) value index 2. I chose vertical bar because nobody uses vertical bar for anything, but if it is in your serial stream you can select a different character for your catch-all debugging point. You can check your message terminator's form this way, by examining it in a scripting or meta data source.

        1 Reply Last reply Reply Quote 0
        • mebiusM
          mebius
          last edited by

          hi Terry, I set the data source and data point as the first sentence in your latest reply. you can check that from attached screenshot pictures.

          and I tried several another replacement, ex. use \r to replace \n.

          It still can't work. But I can captured the command sent from mango and response from the device by using a capturing tool.

          Any other clue to help me? :)

          BTW, mango can't accept \r\n as message terminator.

          If in your convenient, you can access my mango instance directly. if you want to do that, please contact me by skype hxg2008. thanks.

          Attachment: download link

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

            Hi mebius,

            I recompiled the module with debug logging statements.

            1. Backup your serial data source module ([Mango Home]/web/modules/serial) and your log4j configuration files ([Mango Home]/classes debug-log4j.xml and log4j.xml).
            2. Place the attached zip into your modules folder
            3. Place the attached log4j into your classes folder, overwrite the version already in the folder (you should have it backed up).

            Now if you start Mango with a serial source, it should log all traffic in both directions on your serial data source. Remember, all regular expressions need to match a whole message (terminator and all)!

            Attachment: download link

            1 Reply Last reply Reply Quote 0
            • mebiusM
              mebius
              last edited by

              Bingo!

              I replaced log4j and loaded the new serial module, it works this time.

              please see attached screenshot.

              Thank you. Phildunlap .

              Attachment: download link

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

                Does that mean if you put your old log4j file back, it stops working? That seems unlikely to me, but would be most disturbing.

                1 Reply Last reply Reply Quote 0
                • mebiusM
                  mebius
                  last edited by

                  1. It seems that a new log4j.xml was created automatically after debug-log4j.xml was put into the classes folder.

                  2. When the old log4j file was put back to replace the new log4j.xml, it stops working.

                  3. when put the new log4j.xml back, it works again.

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

                    That is not what happened when I tested it on my machine. On my machine it is definitely easier to configure, but the data source still works without the debug-style log4j

                    1 Reply Last reply Reply Quote 0
                    • mebiusM
                      mebius
                      last edited by

                      It's same on my machine.

                      Just now I removed the debug-log4j.xml which you gave to me from the folder and left the new created log4j.xml still there, it still works.

                      I think this problem is solved, isn't it?

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

                        ..

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

                          Hello, Terry and Phil, this is Marc.
                          Same problem happened while I was trying it on another COM port: the receiving data point showed nothing.
                          Since we have upgraded to Mango core 2.2, the logging mod cannot be used. I've tried changing the log4j.xml alone, and still no luck.

                          The command message is ~10012A410000FDA6\r . And response message is a long one with more than 100 characters, which starts with ~10012A00 ,and ends with a \r.

                          Data Source Settings
                          'Message Terminator' - \r
                          'Message Regex' - (.*)
                          'Point Identifier Index' - 0

                          Receiving Point
                          'Data Type' - Alphanumeric
                          'Point Identifier' - .
                          'Value Index' - 0
                          'Value Regex' - (.*)

                          Sending Point
                          'Data Type' - Alphanumeric
                          'Point Identifier' - ~10012A410000FDA (Just to make it easy when I set the point value manually)
                          'Value Index' - 0
                          'Value Regex' - (.*)

                          With the configuration above, every time I set the value of the sending point to 6, a command message is sent to the COM port, and a response message is returned.
                          Both messages can be seen from a serial monitoring tool. But the receiving point in Mango gets no value.
                          I've changed all the regex to (.*) , so it should show anything received from the COM port.
                          The wiki pages do not seem available now, so I'm not sure if there's anything wrong about that configuration. Can you guys give me some tips?

                          @phildunlap said:

                          Hi mebius,

                          I recompiled the module with debug logging statements.

                          1. Backup your serial data source module ([Mango Home]/web/modules/serial) and your log4j configuration files ([Mango Home]/classes debug-log4j.xml and log4j.xml).
                          2. Place the attached zip into your modules folder
                          3. Place the attached log4j into your classes folder, overwrite the version already in the folder (you should have it backed up).

                          Now if you start Mango with a serial source, it should log all traffic in both directions on your serial data source. Remember, all regular expressions need to match a whole message (terminator and all)!

                          1 Reply Last reply Reply Quote 0
                          • terrypackerT
                            terrypacker
                            last edited by

                            Can you ensure that the message being received by Mango is terminated by \r

                            Mango will not start parsing the message until it receives the terminator character.

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

                              It looks to me like the configuration is a bit off...

                              On the data source,

                              1. Point identifier index 0 means regular expression match index 0, which will be your entire match (specified match groups start at 1). So, if your response is 100 characters that whole 100 characters would need to be the Point Identifier of the receiving point. So, for testing, let's capture an easy point identifier,
                                Data Source Settings:
                                'Message Terminator' - \r
                                'Message Regex' - (~).*\r
                                'Point Identifier Index' - 1

                              2. The Point Identifier must match the capture through exact comparison, not regex. So,
                                Receiving Point
                                'Data Type' - Alphanumeric
                                'Point Identifier' - ~
                                'Value Index' - 1
                                'Value Regex' - ~(.*)\r

                              1 Reply Last reply Reply Quote 0
                              • mebiusM
                                mebius
                                last edited by

                                hi Phil. We tried as your instruction but failed to received anything. But the return message can be monitored by a monitoring tool on the same machine.

                                I did that successfully before in Mango 2.1 by replaced the original log4j with a new one which you gave me.

                                I know that was disturbed but it can work. Could you please help us out again? We are in late deployment phase of a real customer case.

                                BTW, Marc is my colleague. Thanks.

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

                                  I think that's a yes, Terry.
                                  I should have posted the log of COM monitoring tool. It shows clearly that mango receives the message which terminated by \r.
                                  Since Philips've given a set of new configurations, it's better that I offer you new logs. Will do that as soon as I get those logs.

                                  @terrypacker said:

                                  Can you ensure that the message being received by Mango is terminated by \r

                                  Mango will not start parsing the message until it receives the terminator character.

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

                                    Hi,Philips. We followed your instruction but Mango showed no value of the receiving point.
                                    The attachment is the log from COM monitoring tool, as same as last time with my configuration.
                                    Both sending and receiving messages can be seen. The "java.exe" means those are from and to the Mango thread. The suffix "." is the printable form of "\r", as the hexadecimal form of the message shows that's a "0D" charactor.

                                    I've also set ```
                                    <category name="com.infiniteautomation"><level value="all"/></category>

                                     
                                    Could you guys have a look and find what's wrong there?
                                    @phildunlap said:
                                    > It looks to me like the configuration is a bit off...
                                    >
                                    >On the data source,
                                    >1. Point identifier index 0 means regular expression match index 0, which will be your entire match (specified match groups start at 1). So, if your response is 100 characters that whole 100 characters would need to be the Point Identifier of the receiving point. So, for testing, let's capture an easy point identifier,
                                    >Data Source Settings:
                                    >'Message Terminator' - \r
                                    >'Message Regex' - (~).*\r
                                    >'Point Identifier Index' - 1
                                    >
                                    >2. The Point Identifier must match the capture through exact comparison, not regex. So,
                                    >Receiving Point
                                    >'Data Type' - Alphanumeric
                                    >'Point Identifier' - ~
                                    >'Value Index' - 1
                                    >'Value Regex' - ~(.*)\r 
                                    
                                     Attachment: [download link](http://archive.infiniteautomation.com/forum/posts/downloadAttach/276.page)
                                    1 Reply Last reply Reply Quote 0
                                    • phildunlapP
                                      phildunlap
                                      last edited by

                                      Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?

                                      As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.

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

                                        Hello, Philips.
                                        There are two machines: a working machine with mango core 2.2.2, serial 1.1.0, and with commercial mango license; the other is a notebook for testing, with the same version of mango but a free license.
                                        In the lib folder, no rxtx jar file, but a jssc-2.8.0.jar. I assume that's what it should be.

                                        The test results were confusing, but some things came out, I'll describe that in the next post.

                                        @phildunlap said:

                                        Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?

                                        As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.

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

                                          The tests on the working machine got nothing as before.
                                          But with the same configuration running on the testing notebook, it succeeded at the first time, as the receiving point had a value of "1001". Unfortunately, on every try after that we got only an event instead.

                                          In the test, we changed the message terminator to '2'. That made the sending message become "~10012A410000FDA62".
                                          And the response changed to "~10012A050000FDA6", which was actually a message telling us the sending message was malformatted. But it was good for the test.

                                          At the first time, we got a match, "1001", from the response, which became the point value. We could not tell if there was an event at that time.
                                          After that, we got no point values, but events saying "Recieved message: (~).*2 does not match pattern: A050000FDA6 ~10012".
                                          It seems the places of the received message and the pattern were switched in the event message.

                                          The serial port monitoring logs, screenshots of data source/points configuration and events are archived and attached. Please let us know if there's anything wrong. Thanks.
                                          @Marc said:

                                          Hello, Philips.
                                          There are two machines: a working machine with mango core 2.2.2, serial 1.1.0, and with commercial mango license; the other is a notebook for testing, with the same version of mango but a free license.
                                          In the lib folder, no rxtx jar file, but a jssc-2.8.0.jar. I assume that's what it should be.

                                          The test results were confusing, but some things came out, I'll describe that in the next post.

                                          @phildunlap said:
                                          Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?

                                          As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.

                                          Attachment: download link

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

                                            I'm not surprised. Unconsumed characters are lingering in the serial stream, and it isn't configured to discard anything. This is causing it to gunk up, but it's getting one value so we can be sure now that Mango is getting the data we're expecting...

                                            Which means the \r terminator character is likely incorrect on one of our ends... Ah, it appears we needed to unescape our terminator field in the code... Give this version a shot:

                                            Edit: Switched versions on ya... give this one a shot

                                            Attachment: download link

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