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

Switch I/O pins during macros?

Scheduled Pinned Locked Moved
Duet Hardware and wiring
6
15
779
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
    stevenim
    last edited by 24 Jul 2020, 15:59

    Can you switch I/O pins with the M42 command during a macro or home?

    1 Reply Last reply Reply Quote 0
    • undefined
      Phaedrux Moderator
      last edited by 24 Jul 2020, 17:42

      I believe so. What specifically are you trying to do?

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • undefined
        stevenim
        last edited by stevenim 24 Jul 2020, 19:25

        I'm just trying to set set a pin high during macros/homing routine by calling "M42 P0 S1" although I find that it isn't working.

        FYI, I'm sending HTTP GET requests over Ethernet with my Duet 3 MB6HC v1.01 board running Firmware version 3.1.1

        undefined 1 Reply Last reply 24 Jul 2020, 19:59 Reply Quote 0
        • undefined
          JoergS5 @stevenim
          last edited by 24 Jul 2020, 19:59

          @stevenim did you allocate the GPIO with M950?
          https://duet3d.dozuki.com/Wiki/Gcode#Section_M42_Switch_I_O_pin

          1 Reply Last reply Reply Quote 0
          • undefined
            stevenim
            last edited by 24 Jul 2020, 20:03

            Yup. Even with the DWC I can switch the pin but the moment I home, I can't switch until after the home.

            undefined undefined 2 Replies Last reply 24 Jul 2020, 20:05 Reply Quote 0
            • undefined
              JoergS5 @stevenim
              last edited by JoergS5 24 Jul 2020, 20:05

              @stevenim Moving may have higher priority than Http requests/M42. (generating the steps use interrupt requests which will be higher than the http). You could try a slower homing, so the lower priority interrupt has a chance.
              see dc42

              1 Reply Last reply Reply Quote 0
              • undefined
                dc42 administrators @stevenim
                last edited by dc42 24 Jul 2020, 20:11

                @stevenim said in Switch I/O pins during macros?:

                Yup. Even with the DWC I can switch the pin but the moment I home, I can't switch until after the home.

                Each GCode channel can only execute one command at a time. So if you send a G28 command followed by a M42 command over the same channel, it will complete the G28 command before it executes the M42 command. OTOH if you send G28 on one channel and then M42 from another, they will execute concurrently, subject to some locking mechanisms (e.g. only one channel can command movement at a time, the other will wait).

                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 26 Aug 2022, 10:59 Reply Quote 0
                • undefined
                  stevenim
                  last edited by stevenim 24 Jul 2020, 20:49

                  @dc42 Does this specifically pertain to macros? I'm able to switch i/o pins during regular moves such as G0/G1. As in, while the motor is moving, I can send an M42 command to a pin just fine.

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    Hugsy
                    last edited by 25 Aug 2022, 11:08

                    I'm trying the same thing, I need to get out of a while loop with a software trigger.
                    My current idea was to have "sensors.probes[1].value[0] == 0" as the while condition and have a i/o pin send current to the probe port.
                    But when in the macro that contains the while loop is being executed, it's impossible to send a M42 command to get out of the while loop.
                    Any ideas how could I get it done? I'm down to modify the firmware just to have it working if it means giving M42 the priority over a M98 command.

                    undefined 1 Reply Last reply 25 Aug 2022, 17:13 Reply Quote 0
                    • undefined
                      Phaedrux Moderator @Hugsy
                      last edited by 25 Aug 2022, 17:13

                      @hugsy Probably a good idea to create a new thread for your problem in the gcode meta command forum.
                      https://forum.duet3d.com/category/34/gcode-meta-commands

                      Z-Bot CoreXY Build | Thingiverse Profile

                      1 Reply Last reply Reply Quote 1
                      • undefined
                        Tinchus @dc42
                        last edited by 26 Aug 2022, 10:59

                        @dc42 How do you choose wich channel to use and what specifically a channel is?

                        undefined 1 Reply Last reply 26 Aug 2022, 17:22 Reply Quote 0
                        • undefined
                          dc42 administrators @Tinchus
                          last edited by 26 Aug 2022, 17:22

                          @tinchus a channel is an input source, normally one of: USB, http (e.g. from DWC) aux (e.g. PanelDue), SD card print, trigger (from a M581 trigger firing), daemon, or autopause (for executing the power fail script).

                          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 29 Aug 2022, 12:47 Reply Quote 0
                          • undefined
                            Tinchus @dc42
                            last edited by 29 Aug 2022, 12:47

                            @dc42 this is super usefull information. Lets see if I uderstood correctly. For example: if I have a print going on, wich is launch from the DWC interface, i guess that is HTTP channel, if I have a macro lauched from daemon.g, that would be a separate channel, so the execution of that macro will not stop or affect the execution of the gcode buffer in any way, is that corret? because both run in different channel so they are parallel processes, is that right?

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              dc42 administrators
                              last edited by 30 Aug 2022, 05:51

                              @tinchus that's correct, except that a print from SD card is executed by the File channel regardless of which channel launched it. The channels execute in parallel except when they compete for a resource such as the motion system.

                              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 1 Sept 2022, 14:42 Reply Quote 0
                              • undefined
                                Tinchus @dc42
                                last edited by 1 Sept 2022, 14:42

                                @dc42 When they compete with motion system... That explain my problem about this. My macro trigger the use of an extra stepper motor, which is connected to a driver on an expansion board. So depending on the printing speed, Im detecting strange "pauses" either on the gcode printing or in the time the extra motor moves..
                                Now I understand why, the re is a competition for the motion system even when this extra motor is not really part of the motion of the printer, it is just vor moving a heavy filament spool, but I guess since it is using a stepper driver, it is considered part of the motion system?

                                1 Reply Last reply Reply Quote 1
                                • undefined NeoDue referenced this topic 25 Sept 2023, 23:46
                                • First post
                                  Last post
                                Unless otherwise noted, all forum content is licensed under CC-BY-SA