• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Support for RS485 on Duet 6XD and 6HC

Scheduled Pinned Locked Moved
General Discussion
3
36
1.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.
  • undefined
    developeralgo222 @dc42
    last edited by developeralgo222 12 Aug 2024, 22:44

    @dc42 , i managed to have it working at 115200. Need to go through simple tests

    1198df21-8910-4817-9c64-d909f61fca52-image.png

    As per your statement above so far Function Code:

    0x03 (Read Holding registers ) and 0x04 (Read input registers ) are working and i can also write to a single Register but i can't seem to be able force a single coil to ON (1) or OFF (0) directly

    undefined 1 Reply Last reply 13 Aug 2024, 19:02 Reply Quote 0
    • undefined
      developeralgo222 @developeralgo222
      last edited by developeralgo222 13 Aug 2024, 19:02

      @developeralgo222 FX3U MODBUS Serial Communication Edition.pdf

      If you review pages 55 - 75 & 95 on the PDF that has Modbus Format & address mapping for the device i have FX3U

      FX3U_ModBus_Address_Mapping.png . I am trying to Write a single Coil to turn it ON(1) of OFF (0)

      ; Write to a single coil Mxxx e.g M41 (which has address 0x0029) in order to turn it ON(1) = FF00 or OFF(0) = 0000
      M260.1 P1 A1 R0x0029 B1
      ; Read a single coil M41 (which has address 0x0029) in order to turn it ON(1) = FF00 or OFF(0) = 0000
      M260.1 P1 A1 R0x0029 B1

      i don't seem to be able to format it correctly with Duet 6XD, any help on the formatting. i don't get errors but seem to be writing to correct Register


      M260.1: Modbus write registers
      Supported from firmware version 3.6

      Write data to a Modbus slave device.

      Parameters

      • Pnn -- Serial port to send/receive through, numbered as in M575 (1 = first aux port, 2 = second aux port). The port must already have been set to Modbus mode using M575.
      • Ann -- Modbus slave device address
      • Rnn -- First Modbus register number to send data to
      • Bnn:nn:nn... --- 16-bit words to send

      is the register number Rnn in Hexadecimal or decimal ? i presume it should be in Hex format ? what is the correct format , can you give an example using Coil M41 in my case . Note: i am able to turn it ON or OFF using Modbus RTU connection from my laptop or manually on the FX3U config app

      Screenshot 2024-08-13 151345.png

      Here is some snapshot captures (Request & Response ) of the MODBUS communications between MODBUS Master (Open Modscan on a PC ) and Slave ( Mitsubishi FX3U-48MR PLC with FX3U-485ADP-MB Adapter) when testing various functions:

      Jabit_FX3U_Modbus_Comms_Capture.pdf

      undefined 1 Reply Last reply 13 Aug 2024, 19:49 Reply Quote 0
      • undefined
        dc42 administrators @developeralgo222
        last edited by 13 Aug 2024, 19:49

        @developeralgo222 RRF doesn't yet support writing coils or reading discrete inputs, I only implemented writing registers, reading input registers, and reading holding registers.

        Your document gives register numbers in hex. RRF takes parameters in decimal by default, but you can use hex numbers like this:

        M260.1 P1 A1 R{0x0029}  B1
        

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        undefined 1 Reply Last reply 13 Aug 2024, 21:24 Reply Quote 0
        • undefined
          developeralgo222 @dc42
          last edited by 13 Aug 2024, 21:24

          @dc42 Fantastic.

          When do you think you will be able to get to implementing the coils part , The SMT feeders i am testing it on needs to be able to Read/Write Coils to turn the Feeder triggers ON or OFF ?

          undefined 1 Reply Last reply 14 Aug 2024, 13:32 Reply Quote 0
          • undefined
            dc42 administrators @developeralgo222
            last edited by 14 Aug 2024, 13:32

            @developeralgo222 I've attempted to add Modbus coil support but I don't have a Modbus device that implements coils to test it on. I've put a new MB6XD binary at https://www.dropbox.com/scl/fo/gwhkwjg232hd6us8yvr0k/ABiZ84dcbZEb9PYiznBRMZU?rlkey=whab6c638wj8w4hyo2jyvjign&dl=0.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            undefined 1 Reply Last reply 14 Aug 2024, 14:46 Reply Quote 0
            • undefined
              developeralgo222 @dc42
              last edited by 14 Aug 2024, 14:46

              @dc42 i will try and test the coils with the new binary now

              undefined 1 Reply Last reply 14 Aug 2024, 17:29 Reply Quote 0
              • undefined
                dc42 administrators @developeralgo222
                last edited by 14 Aug 2024, 17:29

                @developeralgo222 M260.1 now takes a F parameter to specify the Modbus function number. See https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m2601-modbus-write-registers-or-coils.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                undefined 1 Reply Last reply 14 Aug 2024, 19:05 Reply Quote 0
                • undefined
                  developeralgo222 @dc42
                  last edited by developeralgo222 14 Aug 2024, 19:05

                  @dc42 First tests on R/W to a single Coil ( M42 = Coil Address(Hex) is 0x002A ) and also multiple coils:

                  • Single READ = Works & Single WRITE = Doesn't work -- can't write to single coil

                  • Multiple READ = Works & Multiple WRITE = Doesn't Work and come back with an error even though it writes the Value to those multiple coils . i also tried writing to a single coil using F15 and i am able to write it but Duet responds with an Error even though it write to the Single coil

                  Note: For single READ test , i turned the coil to ON = 1 manually and read it to see if it was reading from the correct coil and then changed it back to OFF = 0 and read it again

                  Also i think there is a mix up between Read & Write functions on Multiple coils . When you send a WRITE function (F15 or F{0x0F} ) it comes back with an error but when you send READ function (F1 or F{0x01} ) command for multiple Coils it shows that the coils values have been updated from 0 (OFF) to 1(ON)

                  RW_Coils.png

                  Is there a way to get the debug logs easily to see what its sending and the format ?

                  undefined 1 Reply Last reply 14 Aug 2024, 21:23 Reply Quote 0
                  • undefined
                    dc42 administrators @developeralgo222
                    last edited by 14 Aug 2024, 21:23

                    @developeralgo222 thanks for your feedback. So it looks as though it was sending the correct data for WriteSingleCoil and WriteMultipleCoils even though it returned failure. I've updated the binary at https://www.dropbox.com/scl/fo/gwhkwjg232hd6us8yvr0k/ABiZ84dcbZEb9PYiznBRMZU?rlkey=whab6c638wj8w4hyo2jyvjign&dl=0 with a possible fix.

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    undefined 1 Reply Last reply 15 Aug 2024, 01:06 Reply Quote 0
                    • undefined
                      developeralgo222 @dc42
                      last edited by 15 Aug 2024, 01:06

                      @dc42 fantastic ,
                      i will give the new update a try again

                      undefined 1 Reply Last reply 15 Aug 2024, 12:50 Reply Quote 0
                      • undefined
                        developeralgo222 @developeralgo222
                        last edited by developeralgo222 15 Aug 2024, 12:50

                        RW_Coils.png

                        i run the following commands from the console for tests :

                        Write / Read Single Coil using Functions 5 & 1
                        M260.1 P1 A1 F{0x05} R{0x002A} B1
                        M261.1 P1 A1 F{0x01} R{0x002A} B1
                        Write / Read multiple Coils using Functions 15 & 1
                        M260.1 P1 A1 F{0x0F} R{0x002A} B1:1:1:1
                        M261.1 P1 A1 F{0x01} R{0x002A} B4
                        M260.1 P1 A1 F{0x0F} R{0x002A} B0:0:0:0
                        M261.1 P1 A1 F{0x01} R{0x002A} B4
                        Write / Read Single Coil using Functions 15 & 1
                        M260.1 P1 A1 F{0x0F} R{0x002A} B1
                        M261.1 P1 A1 F{0x01} R{0x002A} B1
                        M260.1 P1 A1 F{0x0F} R{0x002A} B0
                        M261.1 P1 A1 F{0x01} R{0x002A} B1

                        From the R/W Coil tests, Only Single WRITE (Command below) to the coil using Function 5 does not work. It actually doesn't WRITE anything at all to the coil .

                        M260.1 P1 A1 F{0x05} R{0x002A} B1
                        
                        undefined 1 Reply Last reply 15 Aug 2024, 17:13 Reply Quote 0
                        • undefined
                          dc42 administrators @developeralgo222
                          last edited by 15 Aug 2024, 17:13

                          @developeralgo222 please try the latest binary at https://www.dropbox.com/scl/fo/gwhkwjg232hd6us8yvr0k/ABiZ84dcbZEb9PYiznBRMZU?rlkey=whab6c638wj8w4hyo2jyvjign&dl=0.

                          Duet WiFi hardware designer and firmware engineer
                          Please do not ask me for Duet support via PM or email, use the forum
                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                          undefined 1 Reply Last reply 15 Aug 2024, 19:04 Reply Quote 0
                          • undefined
                            developeralgo222 @dc42
                            last edited by 15 Aug 2024, 19:04

                            @dc42 great , let me give it a try

                            undefined 1 Reply Last reply 15 Aug 2024, 19:32 Reply Quote 0
                            • undefined
                              developeralgo222 @developeralgo222
                              last edited by developeralgo222 15 Aug 2024, 19:32

                              RW_Coils.png

                              i tried the following tests from the console and everything seems to be working ok.

                              ;Write / Read Single Coil using Functions 5 & 1
                              M260.1 P1 A1 F{0x05} R{0x002A} B1
                              M261.1 P1 A1 F{0x01} R{0x002A} B1
                              M260.1 P1 A1 F{0x05} R{0x002A} B0
                              M261.1 P1 A1 F{0x01} R{0x002A} B1
                              ;Write / Read Single Holding Registers using Functions 6 & 3
                              M260.1 P1 A1 F{0x06} R{0x002A} B1
                              M261.1 P1 A1 F{0x03} R{0x002A} B1
                              ;Write / Read multiple Holding Registers using Functions 16 & 3
                              M260.1 P1 A1 F{0x10} R{0x002A} B1:1:1:1:1
                              M261.1 P1 A1 F{0x03} R{0x002A} B5
                              M260.1 P1 A1 F{0x10} R{0x002A} B0:0:0:0:0
                              M261.1 P1 A1 F{0x03} R{0x002A} B5

                              Please can you generate all the 3.6.Alpha4 binaries including WebControl so that i don't get Version mismatch for the other boards and i can continue working & testing this version as you work to finish it and resolve any bugs if any

                              undefined 1 Reply Last reply 15 Aug 2024, 20:09 Reply Quote 0
                              • undefined
                                dc42 administrators @developeralgo222
                                last edited by 15 Aug 2024, 20:09

                                @developeralgo222 you can find 3.6 alpha 4 binaries for expansion boards at https://www.dropbox.com/scl/fo/cckwiq91gn16hvl1zdjnp/AF0SMEtkVfiArSPeYaBDGPY?rlkey=kqkknk9q1kiq684u4s55ce8d4&dl=0. There isn't an alpha 4 DWC yet.

                                Duet WiFi hardware designer and firmware engineer
                                Please do not ask me for Duet support via PM or email, use the forum
                                http://www.escher3d.com, https://miscsolutions.wordpress.com

                                undefined 1 Reply Last reply 15 Aug 2024, 22:27 Reply Quote 0
                                • undefined
                                  developeralgo222 @dc42
                                  last edited by developeralgo222 15 Aug 2024, 22:27

                                  @dc42 The tests are great . No errors so far . Looks good

                                  1 Reply Last reply Reply Quote 0
                                  30 out of 36
                                  • First post
                                    30/36
                                    Last post
                                  Unless otherwise noted, all forum content is licensed under CC-BY-SA