CAN development possibilities
-
Hey everyone,
I'm looking into ways of connecting/building my own toolboards and also to explore what's possible with CAN-FD on the Duet 3!
I recently followed the documentation on the sammy-c21 boards and so far I understood that the board has pins available, but I don't understand how I could include these pins in gcode.
For example, there's a pin called pa04, would I then set its PWM to 50% by calling :
M950 P0 C"XX.pa04" Q500
and
M42 P0 S0.5
?Is it possible to save functions on the chip and then call the whole functions via gcode?
Same goes for Arduino! The CanDIY shield looks really nice, but I'm quite unsure how to use it.
Would I be able to call subroutines that execute arduino code and once it's done return to the "main printjob"?
Does anyone have an overview of what's possible and what's not?
Looking forward to some input from everyone
-
Have you tried the method you outlined:
For example, there's a pin called pa04, would I then set its PWM to 50% by calling :
M950 P0 C"XX.pa04" Q500
and
M42 P0 S0.5 -
@hauschka said in CAN development possibilities:
For example, there's a pin called pa04, would I then set its PWM to 50% by calling :
M950 P0 C"XX.pa04" Q500
and
M42 P0 S0.5
?Yes you can do that, although I can't remember offhand whether port PA04 supports PWM.
Is it possible to save functions on the chip and then call the whole functions via gcode?
Unless you extend the CAN protocol, you would need to use an existing CAN message. For example, you could alter that code so that M42 commands to a particular port ran your function.
-
Thanks a lot for those answers!
Unless you extend the CAN protocol, you would need to use an existing CAN message. For example, you could alter that code so that M42 commands to a particular port ran your function.
Are the "existing/available CAN messages" documented somewhere?
I would expect them to be in
CANlib
?Where/ How would I modify the protocol?
Would I have to add a custom M-code with the function's name in it?@dc42 any guidance is highly appreciated!
-
Yes they are documented in CANLib. An overview of the CAN protocol is at https://github.com/Duet3D/CANlib/blob/master/doc/Duet 3 CAN protocol.odt, the message type numbers are in https://github.com/Duet3D/CANlib/blob/master/src/CanId.h, and the formats of the messages in https://github.com/Duet3D/CANlib/blob/master/src/CanMessageFormats.h.
Currently there is no provision for user-defined messages, but I may add a few for users such as yourself to use.
-
@dc42 said in CAN development possibilities:
Currently there is no provision for user-defined messages, but I may add a few for users such as yourself to use.
That would be really cool!
I'm not familiar with C++, unfortunately