CAN connection basics
Duet 3 uses a CAN-FD bus to connect expansion and tool boards to the Duet 3 main board (currently Duet 3 MB6HC or Duet 3 Mini). We chose CAN-FD because it is highly tolerant of noise (in particular, the ground noise generated by stepper motors), well-supported by modern microcontrollers, and the FD variant has enough bandwidth to support the high movement command rates needed in 3D printing and some other motion control applications.
Wiring scheme
The CAN-FD bus is a two-wire bus with 120 ohm nominal impedance. The bus should be terminated by 120 ohm resistors at each end.
The Duet 3 MB6HC main board has a RJ11 CAN connector and permanent termination resistor, so it must be at one end of the CAN bus. Most Duet 3 expansion boards have two RJ11 connectors and two jumpers which can be fitted to provide termination. If the board is used at the other end of the CAN bus, only one of the RJ11 connectors will be used and the termination jumpers should be fitted. if the board is used at an intermediate position then both RJ11 connectors will be used and the termination jumpers should not be fitted. Although the two RJ11 connectors are labelled CAN_IN and CAN_OUT, they are connected in parallel and it doesn't matter if the cables to them are swapped.
The Duet 3 Tool Board is an exception, because it is too small to accommodate RJ11 connectors. Instead it has a single 4-pin JST ZH connector which is intended to be used for CAN_IN and CAN_OUT functionality. The Tool Distribution Board provides four similar JST ZH connectors. Preferably, connect each Tool Board to the Tool Distribution Board using two twisted pair cables, and remove the two jumpers on the Tool Distribution Board that are provided to bypass that connector. However, unless the cables are very long, you may get away with using a single twisted pair between the Tool Board and the Tool Distribution Board and leaving the jumpers in place.
If a Tool Distribution Board is at the end of the CAN bus, then leave the CAN_OUT RJ11 connector not connected, and fit the termination jumper. On the Tool Distribution Board, CAN_IN and CAN_OUT are not interchangeable.
The Duet 3 Mini has a 2-pin Molex connector instead of the RJ11 connector, and built-in termination.
The polarity of the connections between boards matters. In all cases, connect CAN_H on one board to CAN_H on the next board, and similarly connect CAN_L to CAN_L.
Cables
Unshielded twisted pair cable is normally used; however over the short cable lengths typical of desktop 3D printers and CNC machines, the cable type is not critical. On very large printers, twisted pair cable must be used.
Twisted pair cables terminated in RJ11 connectors are sold in some countries as "High Speed ADSL cables". One supplier of such cables is Kenable.
You can also make up your own cables. Kits of RJ11 (usually 6P4W) connectors and the corresponding assembly tool are readily available. For the cable, you can buy a length of twisted pair ribbon cable and separate it into individual pairs; or for short distances, use telephone cable. This image shows a cable made to connect a Duet 3 Mini to a Tool Distribution Board.
CAN addresses
In Duet 3 systems, each board has a CAN address, which is a number in the range 0 to 126. Each board must have a unique CAN address. The address of the main board is always 0. You can choose the addresses of the expansion and tool boards as you wish, however we suggest the following:
- Use addresses 1 to 15 for EXP3HC expansion boards
- Use addresses 20 to 39 for tool boards
- Use addresses 40 to 59 for external driver boards
Some boards have default addresses in the range 120 to 126. Therefore we advise against using addresses in this range. However, if you have just one board of a particular type (e.g. just one tool board) then you may leave it at the default address if you wish.
The Tool Distribution Board is purely passive and does not have a CAN address.
Setting CAN addresses
EXP3HC
The EXP3HC expansion board has a 4-bank DIP switch to set the address. The CAN address is set by the switches as follows:
1 | 2 | 3 | 4 | Address |
---|---|---|---|---|
off | off | off | off | 126 (board requests firmware on startup) |
on | off | off | off | 1 |
off | on | off | off | 2 |
on | on | off | off | 3 |
off | off | on | off | 4 |
on | off | on | off | 5 |
off | on | on | off | 6 |
on | on | on | off | 7 |
off | off | off | on | 8 |
on | off | off | on | 9 |
off | on | off | on | 10 |
on | on | off | on | 11 |
off | off | on | on | 12 |
on | off | on | on | 13 |
off | on | on | on | 14 |
on | on | on | on | 15 |
TOOL1LC, EXP1XD, EXP1HCE
These boards all have a default address as shipped, and revert to that address when the factory reset procedure is used. The default addresses are:
Board | Default address |
---|---|
TOOL1LC | 121 |
EXP1XD | 122 |
EXP1HCE | 123 |
If you have just one of these boards (or at most one of each type) in your system, you can leave the address set to the default. Otherwise you should change the addresses of every board. To do this:
- Connect just one of the board to the CAN bus (or you can leave the other boards connected to CAN but disconnect the power to them)
- Power up the system
- Verify that you can communicate with the board at its default address. For example, to verify a tool board you could send M115 B121 or alternatively M122 B121
- Use the M952 command to change the board address to the required one. For example, to change the address of a tool board to 20, use:
M952 B121 A20
- Power down the system and connect the next board to be configured
- Power up the system and use M952 again to set the address of the new board, choosing a different new address this time
- Repeat until you have configured all the boards
LED behaviour and error codes
All expansion and tool boards have a red LED. Some also have a green LED. On more recent boards, the red LED is labelled STATUS and the green on is labelled ACT (for Activity). On older boards the red LED is labelled DIAG.
The red LED behaviour is:
- Flashing once per second, in time with the red STATUS or DIAG LED on the main board: operating normally, in CAN communication with the main board
- Flashing continuously and rapidly: board is running but does not have CAN communication with the main board
- Flashing a number of times, pausing, and repeating: the bootloader is reporting a problem and the number of flashes represents an error code. Sometimes it may alternate between two error codes. The table below gives the meaning.
Number of flashes | Meaning |
---|---|
2 | Invalid firmware |
3 | Bad firmware CRC |
4 | The bootloader requested a firmware data block from the main board, but the main board didn't respond in time |
5 | The main board reported that it didn't have the correct firmware file in its /sys folder |
6 | The main board reported that the file offset requested by the bootloader was beyond the length of the file |
7 | The main board encountered some other error in trying to fetch and return a block of firmware data |
8 | Bootloader internal error (no buffer available) |
9 | Bootloader was unable to initialise the flash memory controller |
10 | Bootloader was unable to unlock flash memory |
11 | Bootloader was unable to erase flash memory |
12 | Bootloader was unable to write flash memory |
13 | Bootloader was unable to lock flash memory |
14 | The VIN voltage was too low to to be considered safe to flash the bootloader |
Factory resetting a tool or expansion board
If you need to factory reset a board:
- On EXP3HC, set all four address switches off
- On boards having two buttons (e.g. TOOL1LC), power the system up while holding both buttons down
- On those boards having a reset jumper (e.g. EXP1XD), fit the jumper and then power up the board
The board will reset its address and CAN bus speed to default and request firmware from the main board.
0 Comments