Creating a CANBUS adapter for Duet 2



  • I've been looking at ways to minimise the wiring to a hotend to make swapping them out easier. One of my ideas was to use CAN, so the only cabling required is CAN+Power. A small board then on the hotend with a micro (with CAN support), an appropriate power regulator, and components needed to drive/read heater, thermistor, Z limits, fans.

    Maybe I2C or SPI could work too? How well do they do over distance?

    Advantages of this approach:

    • allow potential for autodetection of the attached hotend, so possibly reading in a different config.g (or macro) depending on what's connected
    • compact wiring
    • shorter paths for e.g. temp sensing means (if done correctly) less interference
    • more that I can't think of at the moment

    Disadvantages:

    • increase in complexity
    • extra hardware to mount on the hotend
    • more that I can't think of at the moment

    Looking at the Duet 2 schematic, and comparing to the SAM4E docs + eval board details, it looks like the necessary lines are taken by THERMISTOR1, THERMISTOR2, E2_STOP, and E3_STOP.

    According to page 14 of this it looks like only a handful of components are needed.

    I'm not sure how to handle the pullups on T0/1. Would it be easiest to just desolder the resistors, or is there a way to handle that without modifying the board?

    Then there's the question of software. I'm a software dev by trade, so that's where I'm most comfortable, but I've little experience in the world of microcontrollers, so I'd need advice on where to start (if the circuit based part is even feasable).

    Do people think this is a good/useful idea? I've seen mention of a new CAN Duet potentially coming in the future, should I just wait? Have I missed a better idea/better protocol to use?



  • Dc42 has already done some work in this direction for nextgen Duet.
    See this thread...
    I believe patience is in order 😉



  • @whosrdaddy said in Creating a CANBUS adapter for Duet 2:

    I believe patience is in order 😉

    But I want it now! 😛

    Yeah, maybe you're right. I should probably focus on getting my printer in optimal shape before going crazy! But still, if it possible/reasonable, I might go ahead anyway as a learning process for myself.


  • administrators

    I did some calculations, and I found that for the ways we want to use CAN in the Duet 3, basic CAN is too slow and we need CAN-FD. The SAM4E microcontroller in the Duet 2 boards only supports basic CAN, and even then only one of the CAN pins is available so a small modification to the Duet would be needed to access the other one. The next gen Duets will have CAN-FD.

    For low-bandwidth applications, LIN bus may be an attractive option.



  • @dc42 said in Creating a CANBUS adapter for Duet 2:

    I did some calculations, and I found that for the ways we want to use CAN in the Duet 3, basic CAN is too slow and we need CAN-FD. The SAM4E microcontroller in the Duet 2 boards only supports basic CAN, and even then only one of the CAN pins is available so a small modification to the Duet would be needed to access the other one. The next gen Duets will have CAN-FD.

    For low-bandwidth applications, LIN bus may be an attractive option.

    That's useful info, thanks! I'll wait for the Duet3 in that case 🙂

    Is the Duet 3 something we might see this year, or is it currently far off?


  • administrators

    @keyz182 we might have prototypes later this year but I doubt we will have production boards on general release this year. (on current plans any way)



  • @t3p3tony That's fair enough. I'll go back to the non-smart bulky connectors for now in eager anticipation of the next release 🙂



  • @dc42 said in Creating a CANBUS adapter for Duet 2:

    I did some calculations, and I found that for the ways we want to use CAN in the Duet 3, basic CAN is too slow and we need CAN-FD. The SAM4E microcontroller in the Duet 2 boards only supports basic CAN, and even then only one of the CAN pins is available so a small modification to the Duet would be needed to access the other one. The next gen Duets will have CAN-FD.

    For low-bandwidth applications, LIN bus may be an attractive option.

    @dc42 Does this mean that canopen is the "canbus" protocol being used?
    If support for canopen ds402, to allow external canopen stepper/servor drivers, added it would be an awesome addition to reprapfirmware.
    Although i am not sure if the majority of exisiting canopen ds402 stepper/servo drives will work with CAN-FD.


  • administrators

    @mabover said in Creating a CANBUS adapter for Duet 2:

    @dc42 said in Creating a CANBUS adapter for Duet 2:

    I did some calculations, and I found that for the ways we want to use CAN in the Duet 3, basic CAN is too slow and we need CAN-FD. The SAM4E microcontroller in the Duet 2 boards only supports basic CAN, and even then only one of the CAN pins is available so a small modification to the Duet would be needed to access the other one. The next gen Duets will have CAN-FD.

    For low-bandwidth applications, LIN bus may be an attractive option.

    @dc42 Does this mean that canopen is the "canbus" protocol being used?
    If support for canopen ds402, to allow external canopen stepper/servor drivers, added it would be an awesome addition to reprapfirmware.
    Although i am not sure if the majority of exisiting canopen ds402 stepper/servo drives will work with CAN-FD.

    Unfortunately canopen doesn't really support CAN-FD yet, also the protocol overhead would be too great for sending motion commands. UAVCAN is closer to what we need, but still not quite right.



  • I am guessing the overhead is to much for the processor used in both the duet gen 2s and the next gen duets along with all the other operations they are performing.
    Obviously the servo drives I have and the plc systems have more processor resources avilable to them and possibly extra hardware offload processing.

    Still if there is a chance that in duet gen 3 hardware or future versions could have support for canopen ds402 motion control that would be increadbly usefull.

    Thanks


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.