M-Code Request: Send CAN Message
-
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.
-
@jml what additional information would need to be passed to this board that was not already passed in existing canfd messages?
-
@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 amplitudeLet 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.
-
@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.
-
@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.
-
@jml how many parameters do you need to send in a single message?
-
@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.
-
@dc42 Based on your message, it sounds like it could make it into the next build? If so, thanks!
-
-
@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!
-
@T3P3Tony No worries, I figured! But I will keep my fingers crossed
-
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.