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

    External trigger on duet 3 6hc

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    3
    6
    355
    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.
    • Alessandro Giustiundefined
      Alessandro Giusti
      last edited by

      Hi, I have created a physical keyboard with the main functions of the 3d printer.
      The momentary buttons have been connected to the duet 3 6hc board both in the inputs and outputs called "io_x".
      For now everything works perfectly.

      But I have any questions:

      Can it create a problem if I detect an input on a pin born to be an output?
      (For example momentary button connected to "io3_out")

      Could it create a problem if I used a common ground for all buttons?

      Can I use another pin on the card other than "io_x"?

      I also attach text config.g to check if everything is ok:

      ; Input/Output
      M950 J0 C"^!io0.out"
      M950 J1 C"^!io1.out"
      M950 J2 C"^io2.in"
      M950 J3 C"^!io2.out"
      M950 J4 C"^io3.in"
      M950 J5 C"^!io3.out"
      M950 J6 C"^io4.in"
      M950 J7 C"^!io4.out"
      M950 J8 C"^io5.in"
      M950 J9 C"^!io5.out"
      M950 J10 C"^io6.in"
      M950 J11 C"^!io6.out"
      M950 J12 C"^io8.in"
      M950 J13 C"^!io8.out"

      M581 P0 T0 R0 ; reset
      M581 P1 T1 R1 ; Pause
      M581 P2 T2 R0 ; resume
      M581 P3 T3 R0 ; motori off
      M581 P4 T4 R0 ; g28
      M581 P5 T5 R0 ; g32
      M581 P6 T6 R0 ; retraction
      M581 P7 T7 R0 ; extrude
      M581 P8 T8 R0 ; centerbed
      M581 P9 T9 R0 ; z-
      M581 P10 T10 R0 ; z+
      M581 P11 T11 R0 ; x-
      M581 P12 T12 R0 ; x+
      M581 P13 T13 R0 ; y +20210407_075128.jpg
      20210407_075140.jpg

      dc42undefined o_lampeundefined 2 Replies Last reply Reply Quote 3
      • dc42undefined
        dc42 administrators @Alessandro Giusti
        last edited by dc42

        @alessandro-giusti, common ground for all the buttons is OK.

        It's OK to use an IO_x_OUT pin as an input on the 6HC. Enable the pullup resistor (by using ^ at the start of the pin name) when using a output pin as an input, or alternatively add an external pullup resistor.

        Note, using IO_x_OUT pins on the Duet 3 Mini will not work in future firmware revisions, because those pins do not support interrupts.

        There are no other suitable pins to use as inputs on the 6HC, however you can use a SAMMYC21 connected via CAN to add additional inputs.

        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
        • o_lampeundefined
          o_lampe @Alessandro Giusti
          last edited by

          @alessandro-giusti
          Thanks for posting this, I always wanted to have babystepping and pause button on my printer. But all I could find were discussions about CNC-pendants or external Arduinos sending gcode.

          Do you experience bouncing when you push a button, or do you take care of that in the code?
          Or is the interupt routine behind M581 debounced, @dc42?

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

            @o_lampe said in External trigger on duet 3 6hc:

            Or is the interupt routine behind M581 debounced, @dc42?

            The definition of M581 is that until the trigger macro has completed, the macro can't be triggered again. That provides sufficient debouncing.

            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
            • Alessandro Giustiundefined
              Alessandro Giusti
              last edited by

              I bought and connected the sammy-c21 card, followed the guide and connected the card in can bus with duet 3 6hc.
              The sammy-c21 communicates with duet, with the command m115 I have the following answer: m115 b124
              Duet SAMMYC21 firmware version 3.3beta2 (2021-03-10 10:08:39).

              Are there any special pins I need to use for a momentary button or is any pin okay?

              When I declare them in the config.g do I have to specify the bus address of the card?

              Thanks in advance.

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

                @alessandro-giusti said in External trigger on duet 3 6hc:

                I bought and connected the sammy-c21 card, followed the guide and connected the card in can bus with duet 3 6hc.
                The sammy-c21 communicates with duet, with the command m115 I have the following answer: m115 b124
                Duet SAMMYC21 firmware version 3.3beta2 (2021-03-10 10:08:39).

                Are there any special pins I need to use for a momentary button or is any pin okay?

                When I declare them in the config.g do I have to specify the bus address of the card?

                Thanks in advance.

                Here's an extract from the pin table for the standard SAMMYC21 build in firmware 3.3beta:

                Nx,	nullptr		},	// PA00 not on board
                Nx,	nullptr		},	// PA01 not on board
                Nx,	"temp0"		},	// PA02
                Nx,	"temp1"		},	// PA03
                4,	"pa04"		},	// PA04
                5,	"pa05"		},	// PA05
                6,	"pa06"		},	// PA06
                7,	"pa07"		},	// PA07
                Nx,	"pa08"		},	// PA08
                Nx,	nullptr		},	// PA09 driver EN
                Nx,	nullptr		},	// PA10 driver DIR
                Nx,	nullptr		},	// PA11 driver STEP
                12,	"pa12"	 	},	// PA12
                13,	nullptr		},	// PA13 accelerometer INT1
                Nx,	nullptr		},	// PA14 crystal
                Nx,	nullptr		},	// PA15 crystal
                Nx,	nullptr		},	// PA16 SPI
                Nx,	nullptr		},	// PA17 SPI
                Nx,	nullptr	 	},	// PA18 SPI
                3,	"pa19"		},	// PA19
                Nx,	"pa20"		},	// PA20
                Nx,	"pa21"		},	// PA21
                Nx,	nullptr		},	// PA22 I2C
                Nx,	nullptr		},	// PA23 I2C
                Nx,	"pa24"		},	// PA24
                Nx,	"pa25"		},	// PA25
                Nx,	nullptr		},	// PA26 not on chip
                Nx,	nullptr		},	// PA27 CAN transceiver standby
                Nx,	nullptr		},	// PA28 LED 0
                Nx,	nullptr		},	// PA29 not on chip
                Nx,	nullptr		},	// PA30 swclk
                Nx,	nullptr		},	// PA31 swdio
                
                
                Nx,	nullptr		},	// PB00 not on chip
                Nx,	nullptr		},	// PB01 not on chip
                Nx,	nullptr		},	// PB02 USB interface (SERCOM5 pad 0)
                Nx,	nullptr		},	// PB03 USB interface (SERCOM5 pad 1)
                Nx,	nullptr		},	// PB04 not on chip
                Nx,	nullptr		},	// PB05 not on chip
                Nx,	nullptr		},	// PB06 not on chip
                Nx,	nullptr		},	// PB07 not on chip
                8,	"pb08"		},	// PB08
                9,	"!^button0"	},	// PB09 button recognised by bootloader
                

                You can use any pin that has an interrupt number in the first column (i.e. not "Nx") and a name in the second column. So 9 pins available in total. If you use PB09 then it must not be grounded when power is applied unless you want the SAMMYC21 to reload the firmware over CAN.

                You do need to specify the CAN address, also you will need to enable the pullup resistor unless you add an external one. For example: "^124.pb08".

                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