REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    Echo on RS485

    Modbus RTU
    2
    14
    2.1k
    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
      MikeyH
      last edited by

      Thanks for the reply Jaroslav. How do I go about editing that? Is it through Linux, or a separate program?

      Cheers

      Mike

      1 Reply Last reply Reply Quote 0
      • jaroslav_sobotaJ
        jaroslav_sobota
        last edited by

        Hi Mike,
        sorry for the confusion. The *.rio file is part of your project, you can find it in the same folder as your source *.mdl files. Therefore you can edit it on your Windows PC with your preferred plain text editor.

        Kind regards
        Jaroslav

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

          Hi Jaroslav,

          This seems to work, however I now get this error.

          0_1579226697205_4bf51cf7-bda2-4124-9aa4-106af5cada4e-image.png

          Also I only seem to received the first register, is that related to the above error?

          0_1579226876391_d135ea3d-ca0b-443e-bfd5-8943d88286ca-image.png

          Cheers

          Mike

          1 Reply Last reply Reply Quote 0
          • jaroslav_sobotaJ
            jaroslav_sobota
            last edited by

            Hi Mike,
            yes it can be related. Please upload the project source files so I can inspect details of timing, Modbus baudrate etc.

            Try the following and observe if the problem persists:

            • Read only 1 register, no writing. Delete all the other items from Modbus configuration.
            • Read 2 registers, no writing.
            • Read 4 registers, no writing.
            • Read 4 registers, write 1 register.

            Let me know.

            Jaroslav

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

              Hi Jaroslav,

              Files enclosed, I will try your suggestions by the end of the day hopefully. I have noticed if I use a larger block (INQUAD or INHEXD) I randomly pick up more registers further down.

              This is also the same project I asked about best timing practice, https://forum.rexygen.com/topic/89/project-timing

              Cheers

              Mike

              3_1579570165365_WDTL_HIL_exec.mdl 2_1579570165365_modbus_write_task.mdl 1_1579570165364_modbus_read_task.mdl 0_1579570165364_master_cfg.rio

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

                Hi Jaroslav,

                Trying what you suggested has mixed results. I remembered something you showed me awhile ago and looked at the log for just the driver read/write. See below for what the log is saying. This was done with no writing and three registers being read, 0x1000, 0x1010 and 0x1020.

                0x1010 seems to return the same value as 0x1000. This shouldn't be the case, 0x1000 is correct though. I changed the read order in the configuration settings and 0x1010 started reading correctly, 0x1000 now does not and returns the same value as 0x1010. It seems hit or miss whether 0x1020 reads the correct value or not, the longer I run the simulation the more chance that 0x1020 reads correctly.

                Why would changing the read order have an affect?

                Could the CRC errors could also be causing this? The last byte is missing or being cut off. I still receive the correct value though.

                3 registers being read (0x1000, 0x1010, 0x1020)
                0_1579656632656_d80a1250-8ebb-42ee-ab9b-246c8bd931c8-image.png

                1 register being read (0x2010)
                0_1579663483507_9605c977-6b1d-4eb9-aa9a-7d0aedaff0bb-image.png

                Cheers

                Mike

                1 Reply Last reply Reply Quote 0
                • jaroslav_sobotaJ
                  jaroslav_sobota
                  last edited by

                  Hi Mike,
                  thanks for the screenshots. This is very nonstandard and would require detailed analysis with the hardware on our testbench, possibly analyzing a record from oscilloscope etc. There is no way to do it remotely, sorry.

                  Still, you can try to run the project on a Windows PC, you'll just have to replace /dev/ttyUSB0 with COMx in Modbus configuration. Just to know if anything changes. Please stick to reading a single register.

                  If the end device allows it, you can also try lowering the baudrate to 9600, just to see if the behavior changes.

                  You can also write a test application using REXLANG, sending a single Modbus request (8 bytes: 0x01 0x03 0x20 0x10 0x00 0x01 0x8E 0x0F) and receiving the response, just to know if you receive a valid echo and a valid Modbus response from the device. See example 0401-01 for inspiration.

                  Hope it helps at least a bit.

                  Kind regards
                  Jaroslav

                  1 Reply Last reply Reply Quote 0
                  • M
                    MikeyH
                    last edited by jaroslav_sobota

                    Thank you for the help Jaroslav, I will try both the REXLANG and Windows solutions to see what happens.

                    How do I run the project on a Windows PC?

                    Cheers

                    Mike

                    1 Reply Last reply Reply Quote 0
                    • jaroslav_sobotaJ
                      jaroslav_sobota
                      last edited by

                      Hi Mike,
                      just exclude the Raspberry Pi driver from your project and enter "localhost" as Target address in the Download dialog and click Download. Local runtime core (RexCore) will be started on your Windows PC, allowing you to run your algorithms. Quite useful for testing and debugging.

                      2-hour demoversion is available just like in all the other REXYGEN-enabled platforms.

                      Hope this helps, let me know.

                      Kind regards
                      Jaroslav

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

                        Thank you Jaroslav, you learn something every day! That will help more than you know with all of my projects. especially ones with process models 🙂

                        Cheers

                        Mike

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

                        This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

                        There is also an outdated REXYGEN community forum.

                        Powered by NodeBB.