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

    M-Code Request: Send CAN Message

    Scheduled Pinned Locked Moved
    Firmware wishlist
    4
    15
    742
    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.
    • jmlundefined
      jml
      last edited by jml

      Similar to how M260 exists for sending data over I2C, it would be great to have a similar command for CAN-FD.

      That would allow me to create a separate PCB to take care of some other things independently. Like an exotic extruder with some kind of custom functionality.

      T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
      • T3P3Tonyundefined
        T3P3Tony administrators @jml
        last edited by

        @jml what additional information would need to be passed to this board that was not already passed in existing canfd messages?

        www.duet3d.com

        jmlundefined 1 Reply Last reply Reply Quote 0
        • jmlundefined
          jml @T3P3Tony
          last edited by jml

          @T3P3Tony Is there a list of canfd messages I can see? I don't want to have to modify the firmware to send messages, so if I can do it with existing messages, that would be great.

          My theoretical external PCB/system on a custom extruder may take various CAN commands to do various things like: activatePump4, setPumpSpeed4, setPump4Duration, stopPump4, activateDAC1, setDAC1voltage, runDAC3VoltageSequence2, startCamera2, setCam2ExposureTime, runMachineVisionAlgorithm7, runValveActivationSequence5, setHumidity, etc

          Its useful for things that have already been set up externally outside of the Duet system, working fine, but now I just want the Duet to launch many of those things by just sending a message through CAN.

          For Example:
          M265 P3:2:444:5:1 ; runs 3rd custom command with parameters 444, 5, and 1
          (the 3rd command could be "runPump", the 2 could mean the 2nd pump, 444 means the speed, 5 is duration, etc)

          Or as a more extreme example, maybe I have a multi-channel DAC that needs to output a sinusoidal wave from its 2nd output at 10 Hz for 4 seconds with a 5V amplitude, then at 4 Hz for 1 second at 2V amplitude. And the needs might change from print to print because I am experimenting. It would be nice to be able to just write these two lines to do it:
          M265 P8:2:10:4:5 ; activate DAC, channel 2, 10Hz, 4 sec duration, 5V amplitude
          M265 P8:2:4:1:2 ; activate DAC, channel 2, 4 Hz, 1 sec duration, 2V amplitude

          Let me know if you have any ideas on how to do this without existing CAN messages. If not, it would be great to have an M265. I imagine this would be very useful for research labs developing new kinds of 3D printers or doing 3D printing related research.

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

            @jml I think you could use the M42 command and associated messages for most or all of these. You may also need the M950 message to configure things. You can find the message formats and message IDs in the CANlib project, specifically the files CanID.h and CanMessageFormats.h.

            If that's not suitable then we can add a "User defined" message type and reserve an ID for it.

            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

            jmlundefined 1 Reply Last reply Reply Quote 0
            • jmlundefined
              jml @dc42
              last edited by

              @dc42 Thanks for the quick replies both of you!

              I think M42 is not suitable since I would like to send more than a just a Yes/No or PWM signal. The "User Defined" sounds like its exactly what I'm looking for! I hope its not too difficult to implement.

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

                @jml how many parameters do you need to send in a single message?

                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

                jmlundefined 2 Replies Last reply Reply Quote 1
                • jmlundefined
                  jml @dc42
                  last edited by

                  @dc42 I would think 4 would be enough to cover most things. 5 or 6 would be enough for future flexibility. Maybe 256 just to be safe 🙂 just kidding.

                  1 Reply Last reply Reply Quote 0
                  • jmlundefined
                    jml @dc42
                    last edited by

                    @dc42 Based on your message, it sounds like it could make it into the next build? If so, thanks!

                    T3P3Tonyundefined 1 Reply Last reply Reply Quote 0
                    • o_lampeundefined o_lampe referenced this topic
                    • T3P3Tonyundefined
                      T3P3Tony administrators @jml
                      last edited by

                      @jml it is unlikely to be in the next beta release and still TBC if it will be in 3.5 We have a huge number of requests right now!

                      www.duet3d.com

                      jmlundefined 1 Reply Last reply Reply Quote 1
                      • jmlundefined
                        jml @T3P3Tony
                        last edited by

                        @T3P3Tony No worries, I figured! But I will keep my fingers crossed 🤞

                        1 Reply Last reply Reply Quote 1
                        • OpenDevundefined
                          OpenDev
                          last edited by

                          are there any news about the custom CAN-FD Message ? I already have my own hardware running with the duet 3 and would like to do the interaction with CAN-FD.

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

                            @OpenDev I should be able to implement this in time for the next 3.6 beta. I'll need to choose the parameter letters and their associated types. I'm thinking P unsigned integer, R and S signed integer, E and F floating point, and C string. Would this meet your needs?

                            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
                            • OpenDevundefined
                              OpenDev
                              last edited by

                              Hello dc42,

                              oh, great to hear. I think these data types could be good for testing, I'm looking forward to it. Thank you!

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

                                @OpenDev this is implemented in 3.6beta3. https://reprap.org/wiki/G-code#M655:_Send_request_to_custom_CAN-connected_expansion_board

                                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

                                OpenDevundefined 1 Reply Last reply Reply Quote 0
                                • OpenDevundefined
                                  OpenDev @dc42
                                  last edited by

                                  @dc42 Thank you very much, that looks perfect 😊

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