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

    Additional outputs using a SX1509B Expander

    Scheduled Pinned Locked Moved
    Accessories and Add-ons
    4
    20
    1.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.
    • alankilianundefined
      alankilian
      last edited by

      Maybe use M122 and look for the I2C debugging information to see if your I2C is running properly?

      I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
      

      SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

      1 Reply Last reply Reply Quote 0
      • t0biasundefined
        t0bias
        last edited by

        Good point!
        Unfortunately no luck here either..

        I2C nak errors 0, send timeouts 0, receive timeouts 0, finishTimeouts 0, resets 0
        
        1 Reply Last reply Reply Quote 0
        • alankilianundefined
          alankilian
          last edited by

          @t0bias Are the outputs set to open-drain by default or something?

          (I'll go take a peek at the firmware to see how they are initialized next.)

          SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

          1 Reply Last reply Reply Quote 0
          • t0biasundefined
            t0bias
            last edited by

            Not that I was aware of..
            However, I just checked the datasheet and according to it, all pins are configured as inputs upon power-on, so I think I would need to configure them as outputs. I don't really know what the duet firmware is doing internally here.. 😕

            1 Reply Last reply Reply Quote 0
            • alankilianundefined
              alankilian
              last edited by alankilian

              @t0bias said in Additional outputs using a SX1509B Expander:

              I think I would need to configure them as outputs

              When you say P5 instead of J5 it is configured as an output (I think).

              Maybe add the "^" character to the M950 would do it?

              C"name" Pin name(s) and optional inversion status, see Pin Names. Pin name "nil" frees up the pin. A leading '!' character inverts the input or output. A leading '^' character enables the pullup resistor. The '^' and '!' characters may be placed in either order.
              

              SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

              1 Reply Last reply Reply Quote 0
              • t0biasundefined
                t0bias
                last edited by

                I may be wrong, but I think pull-up resistors can only be enabled on ports of the Duet board itself.
                There are source-files specifically for this expansion chip (here), however I have no idea what the "DuetNG" denomination is about to be honest. Also, this branch seems to be of the 2.x firmware only?

                1 Reply Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @t0bias
                  last edited by dc42

                  @t0bias, which firmware version are you using? In particular, part of that code was rewritten between versions 3.2.2 and 3.3beta1, so what works in one might not work in the other.

                  I can increase the number of available GpOut ports in the next 3.3beta. Would 20 be sufficient?

                  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

                  1 Reply Last reply Reply Quote 0
                  • t0biasundefined
                    t0bias
                    last edited by

                    @dc42 thanks for your reply. I am using version 3.1.1, would a upgrade fix the issue?
                    yes, 20 would be sufficient, maybe a bit more would be even better still? 😉

                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @t0bias
                      last edited by dc42

                      @t0bias said in Additional outputs using a SX1509B Expander:

                      @dc42 thanks for your reply. I am using version 3.1.1, would a upgrade fix the issue?

                      An upgrade to 3.3beta1 might possibly fix it, if it doesn't then let me know and I'll implement a fix in 3.3beta2.

                      yes, 20 would be sufficient, maybe a bit more would be even better still? 😉

                      Memory is rather tight on the Duet 2, so I'll set it to 20 in 3.3beta2. It's already 32 on Duet 3 and 3 Mini.

                      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

                      1 Reply Last reply Reply Quote 0
                      • t0biasundefined
                        t0bias
                        last edited by

                        I upgraded to 3.3beta1 today, but it still doesn't work unfortunately

                        1 Reply Last reply Reply Quote 0
                        • dc42undefined
                          dc42 administrators
                          last edited by

                          Thanks, this is on my list to test/investigate.

                          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

                          1 Reply Last reply Reply Quote 0
                          • dc42undefined
                            dc42 administrators
                            last edited by dc42

                            I have just tested this, and ports sx1509b.0, .1 and .2 all work for me using RRF 3.2.2 and also using RRF 3.3beta1. I didn't test the other ports.

                            Points to note:

                            1. M115 will report the SX1509B if it is detected:
                            04/03/2021, 11:17:06 	m115
                            FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.3beta1 ELECTRONICS: Duet WiFi 1.02 or later + DueX5 + SX1509B expander FIRMWARE_DATE: 2021-02-14 16:00:49
                            
                            1. My test system includes a very old DueX5. On these old boards, the TWC and TWD pins are labelled the wrong way round on the 10-pin expansion header. They are also labelled incorrectly on the wiring diagrams at https://duet3d.dozuki.com/Wiki/Duex_wiring_diagrams for the 0.6 and 0.7 boards. On all DueX revisions, TWC (aka SCL) is next to the ground pin at the end of the header.

                            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

                            1 Reply Last reply Reply Quote 0
                            • t0biasundefined
                              t0bias
                              last edited by

                              Strange, the SX1509B is in fact detected:

                              FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 3.3beta1 ELECTRONICS: Duet WiFi 1.02 or later + SX1509B expander FIRMWARE_DATE: 2021-02-14 16:00:49
                              

                              however the pins don't get driven high (or low) using the M42 commands.
                              I am confident the I²C-Wiring is correct, since I tried using a MCP23017 based relay board that responds to I²C-Commands just fine.

                              Any suggestions or ideas are highly appreciated!

                              DIY-O-Sphereundefined dc42undefined 2 Replies Last reply Reply Quote 0
                              • DIY-O-Sphereundefined
                                DIY-O-Sphere @t0bias
                                last edited by DIY-O-Sphere

                                @t0bias
                                Have you checked the I2C address?
                                It has to be set to 0x71

                                Here some code to test it directly with M260
                                https://forum.duet3d.com/topic/13911/sx1509-on-maestro-does-it-work/3

                                (UTC+1)

                                1 Reply Last reply Reply Quote 0
                                • dc42undefined
                                  dc42 administrators @t0bias
                                  last edited by dc42

                                  @t0bias, if the board is detected then the I2C pins are connected correctly and the slave address is set correctly.

                                  How are you testing the outputs of the SX1509B? I have connected each output through a 100 ohm resistor to one of the cathodes of a 2-digit common anode 7-segment display, with the anodes connected to +3.3V.

                                  2021-03-09 21.15.43.jpg

                                  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

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