Minimum configuration with Raspberry Pi
- Duet 3 main board
- Raspberry Pi. Initially this has to be Model 3B or 4 but we may support some other models in the future.
- Ribbon cable to connect the Raspberry Pi to the Duet. If using the version 0.5 Duet 3 main board, this must be 40-pin. If using a version 0.6 and later Duet main board, use 26-pin to 40-pin. Recommended length is 100 to 150mm. Longer cables will degrade the SPI signal between the Raspberry Pi and the Duet.
- Power supply (min. 12V. max 32V, recommended 24V) and cables
- Stepper motors, heaters, thermistors, endstop switches etc. as required
- Duet 3 expansion board(s) and/or tool boards
- RJ11 twisted pair cables to connect the expansion board(s). When connecting a version 0.5 Duet 3 main board to an expansion board, the wires must be crossed. When connecting a version 0.6 or later Duet 3 main board to an expansion board, or connecting two expansion boards together, the cable wiring must be straight-through. Only a single twisted pair is required, connected to pins 3 and 4 (the middle 2 pins) of the connector. Pins 2 and 6 on the version 0.6 Duet 3 main board are the connections for the secondary CAN bus, but the firmware does not use this yet.
- 2-core red/black cable to daisy chain power to the expansion board(s)
Connecting it up
See here for the Duet 3 Mainboard 6HC Wiring Diagram
A more detailed wiring guide will follow.
Here is a photo showing a bench setup comprising a version 0.5 Duet 3 main board, Raspberry Pi 3B+, and one early prototype Duet 3 expansion board. Caution! Note the orientation of the 40-pin ribbon cable. The connector on the Raspberry Pi is not keyed, so be very careful to connect the ribbon cable the right way round and in the correct position. Caution! Note the order of the VIN + and - terminals on the Duet 3 main board (the red wire is +ve), which is not the same as on Duet 2!
The position of the ribbon cable may appear awkward. However, our intention is that the Raspberry Pi be mounted below or above the Duet, so that the USB and Ethernet connectors on the Raspberry Pi line up with the right hand edge of the Duet. It's also possible to position the Pi on the opposite side of the Duet and run the ribbon cable underneath the Duet, but this requires a 200mm long cable.
On the version 1.0 and 0.6 board, jumpers are provided to allow you to select whether the Duet powers the Pi, the Pi powers the Duet, or neither.
If you connect one or more expansion boards via CAN as shown in the photo, you must install the two CAN termination jumpers on the last board in the chain, but not on any additional boards in the middle of the chain.
Running in standalone mode
Version 0.6 and Version 1.0 main boards have the ability to run without the Raspberry Pi, by inserting a micro SDHC card in the socket on the Duet and using the local Ethernet port to connect to your router. We do not supply this SD card. The SD card must be populated with configuration files, homing files and web server files exactly as for a Duet 2 running RepRapFirmware 3. The board will run in standalone mode if the SD card is present and contains a sys/config.g file; otherwise it will wait to be contacted by the Raspberry Pi or other single board computer.
A PanelDue can be connected to connector IO_0 using a 4-core cable wired like this.
Updating Duet 3 main board firmware
There are three ways of updating the main board firmware:
- If using an attached RPi, you can update the firmware in Duet Web Control as usual
- If running standalone using the Ethernet port on the Duet to provide the network interface, you can update the firmware in Duet Web Control as usual
- Via USB
To update via USB (using a Windows host):
- You will need to install Bossa 1.9.1 from https://github.com/shumatech/BOSSA/relea... on your PC.
- Place a jumper across the ERASE pins on the Duet 3 and power it up to erase the firmware. The Bossa port should appear on your PC (if it doesn't, try pressing the Reset button).
- The erase jumper is located in the center of the board near the large CPU chip.
- Remove the ERASE jumper, load Bossa and select the correct COM port. It should identify the device as ATSAM70x20.
- Check the Erase All, Boot to Flash and Lock boxes
- Download the latest RRF V3 from here: https://github.com/dc42/RepRapFirmware/r...
- Browse to the firmware binary, and select Write.
- When that completes, select Verify.
- When that completes successfully, press the Reset button on the Duet 3 to restart the Duet in normal mode.
To update via USB (using a Raspberry Pi host):
Part1: Install bossa on the Pi with these commands:
sudo apt update && sudo apt install -y libwxgtk3.0-dev libreadline-dev git clone https://github.com/shumatech/BOSSA cd BOSSA make
Part 2: Connect the Duet to the Pi.
- Use a data capable USB cable from any port on the Pi to the Duet.
- It is OK to power the Duet from only the USB (which implies the Pi has its own power)
- It is OK to power the Duet with VIN
- Do one or the other; do not power both ways.
- If the Pi is part of a Duet 3 with ribbon cable, it is OK to leave this attached.
Part 3: Obtain firmware
- If the Pi is part of a Duet 3, firmware will be in /opt/dsf/sd/sys/Duet3Firmware_MB6HC.bin
- If your Pi is not part of a Duet, obtain firmware from https://github.com/dc42/RepRapFirmware/r...
Part 4: Run bossa
- Be sure Duet board is erased and reset. (see above)
~/BOSSA/bin/bossac -e -w -v -b /opt/dsf/sd/sys/Duet3Firmware_MB6HC.bin
- This should take about one minute to run. If it hangs, try reset and/or reset erase again on the Duet board.
Updating Duet 3 expansion board firmware
Unless the bootloader has been corrupted, the expansion board firmware can be updated over CAN.
- Ensure that the correct expansion board firmware binary (for example, Duet3Firmware-EXP3HC.bin for the 3-driver high current expansion board) is present in the /sys folder (on the RPi if using it, or on the SD card if running standalone)
- If the expansion board is already communicating with the main board, send M997 B# where # is the address of the expansion board. The expansion board will commence a firmware update and the DIAG LED will go out for a while. When the update is complete, it will flash and re-sync with the main board.
- Alternatively, set the expansion board address to zero (switches all off) and press the Reset button on the expansion board to commence the firmware update (or power down, change the switches, and power up again). When re-syncing is complete, change the switches back to the correct board address and press Reset again (or power down, change the switches, and power up again).
- You can check the firmware version installed on an expansion board by sending M115 B# where has is the board number.
Note: after updating expansion board firmware, you must restart the main board or at least re-run config.g in order to create any sensors, heaters, fans etc. that you have configured on that board in config.g.
The bootloader flashes the following error codes on the DIAG LED on the expansion board:
- 2 flashes: invalid firmware
- 3 flashes: bad firmware CRC
- 4 flashes: the bootloader requested a firmware data block from the main board, but the main board didn't respond in time
- 5 flashes: the main board reported that it didn't have the correct firmware file in its /sys folder
- 6 flashes: the main board reported that the file offset requested by the bootloader was beyond the length of the file
- 7 flashes: the main board encountered some other error in trying to fetch and return a block of firmware data
- 8 flashes: bootloader internal error (no buffer available)
- 9 flashes: bootloader was unable to initialise the flash memory controller
- 10 flashes: bootloader was unable to unlock flash memory
- 11 flashes: bootloader was unable to erase flash memory
- 12 flashes: bootloader was unable to write flash memory
- 13 flashes: bootloader was unable to lock flash memory
If the bootloader becomes corrupted
The bootloader can be reprogrammed using the SWD connector. If using an Atmel ICE to do the programming:
- Connect the following 5 wires from the SAM output cable to the corresponding pins on the expansion board SWD connector: Reset, Gnd, VccRef, SWCLK, SWDIO
- Provide VIN power to the expansion board
- Load Atmel Studio (requires Windows)
- Select Tools -> Device Programming, and select the Atmel ICE from the list of connected tools
- Set the processor type to ATSAME51N19A, the interface to SWD, and click Apply.
- Click on the Read button next to Device Signature to verify connection with the target MCU.
- Under Memories, browse to the Duet3Bootloader_EXP3HC.bin file. You must use the .bin file not the .elf file, because if you use the .elf file then you will get verify errors.
- Check that the Erase Flash and Verify Flash boxes are checked, then click program.
- Immediately after programming, the Diag LED on the expansion board should resume blinking to indicate that the firmware is running.
Duet 3 Expansion board, 3-channel
Duet 3 RepRapFirmware notes
Duet 3 runs RepRapFirmware 3, which supports flexible pin allocations so that any output pin can be used to drive a heater, fan or other device. No temperature sensors, heaters, fans, endstop switches or Z probes are defined by default; so you must define the ones you want using appropriate commands in config.g. See RepRapFirmware 3 overview.
Duet Software Framework on Raspberry Pi
Duet Software Framework is the bundle of software programs running on the Raspberry Pi that connects to and controls the Duet 3.
DuetPi is the official Debian image based on Raspbian that is customised for the Duet 3. If you are not very familiar with the Raspberry Pi, it is strongly recommended to use it instead of the stock Raspbian image.
There are two versions of DuetPi available, one with and another one without GUI:
These versions are targeted at ARMv7 processors like the Raspberry Pi 3 or 4.
Once downloaded, use a flashing application like Win32DiskImager or baleanaEtcher. You can follow the official Raspberry Pi instructions for further details.
When the image of your choice has been flashed, the Duet 3 can be connected to via the hostname "duet3". It comes preconfigured with mDNS enabled (via avahi), SSH activated and the standard credentials "pi" and "raspberry". To set up WiFi, you can edit "wpa_supplicant.conf" on the SD card (first partition).
As soon as your Raspberry Pi has established an internet connection, it is recommended to install the latest updates. To do so, connect via SSH (e.g. via PuTTY) to your Raspberry Pi or open a terminal and run
sudo apt-get update sudo apt-get upgrade
This will install the latest software components and the latest RepRapFirmware version on your Duet 3.
Raspbian Setup Guide
If you have the latest Raspbian image installed on your Raspberry Pi, follow these instructions to get started with DSF. These steps are obsolete if you are using DuetPi.
To provide a controller base for the Duet, the first SPI port on the Linux controller board is used. If Raspbian operating system is used, the SPI driver can be enabled by doing the following steps:
2. Navigate to 5 Interface options
3. Go to P4 SPI
4. Confirm to enable the SPI interface
This will ensure the SPI driver is loaded and Duet Software Framework can use it for communication to the Duet board.
Once done, run
and verify that /dev/spidev0.0 has been created. This device node is required for DuetControlServer. If you wish to use another SPI device, adjust the SPI values in /opt/dsf/conf/config.json before starting DuetControlServer.
Please note that DCS uses SPI buffer sizes of 8KiB whereas the default Raspbian buffer size is limited to 4KiB. In order to change it, you can adjust the boot arguments by creating a new file /etc/modprobe.d/spidev.conf:
echo "options spidev bufsiz=8192" | sudo tee /etc/modprobe.d/spidev.conf
After that, restart your system to apply the new buffer size.
To obtain the required software packages on a Debian-based distribution running an ARMv7 processor (RaspPi 3 or newer) execute the following commands:
wget -q https://pkg.duet3d.com/duet3d.gpg wget -q https://pkg.duet3d.com/duet3d.list sudo mv duet3d.gpg /etc/apt/trusted.gpg.d/ sudo mv duet3d.list /etc/apt/sources.list.d/duet3d.list sudo chown root:root /etc/apt/trusted.gpg.d/duet3d.gpg sudo chown root:root /etc/apt/sources.list.d/duet3d.list
If you wish to use the latest unstable DSF components, you can run the following commands instead:
wget -q https://pkg.duet3d.com/duet3d.gpg wget -q https://pkg.duet3d.com/duet3d-unstable.list sudo mv duet3d.gpg /etc/apt/trusted.gpg.d/ sudo mv duet3d-unstable.list /etc/apt/sources.list.d/duet3d-unstable.list sudo chown root:root /etc/apt/trusted.gpg.d/duet3d.gpg sudo chown root:root /etc/apt/sources.list.d/duet3d-unstable.list
Please be aware that the unstable repository is meant for beta testers and that it can contain experimental code. For production use, the stable repository is strongly recommended.
In case you are coming from chrishamm's package feed, make sure to remove it:
sudo rm /etc/apt/sources.list.d/chrishamm.list
Once there, you can install HTTPS support for APT, update the package feeds, and install the DSF bundle:
sudo apt-get install apt-transport-https sudo apt-get update apt-get install duetsoftwareframework
Duet Control Server
Now you have installed Duet Software Framework, but none of the services has been started yet. As a first step, it is important to start the main application of DSF called Duet Control Server. To do this, make sure you have the Duet 3 connected to your Linux board via the ribbon cable and run
sudo systemctl start duetcontrolserver
This should complete without an error. If it fails, check why it did so by running
sudo journalctl -u duetcontrolserver
To make it start automatically on boot, run
sudo systemctl enable duetcontrolserver
If you wish to change parameters of the DCS configuration, edit /opt/dsf/conf/config.json. To revert to factory defaults, you may delete this file as well and restart DCS. In this case, DCS will restore it automatically.
Duet Web Server
Once DCS has been started, you can start the web server which provides the web interface. This can be achieved by running
sudo systemctl start duetwebserver
If that fails for some reason, run
sudo journalctl -u duetwebserver
to figure out why. Once it has been started, you can make it start on boot as well by running
sudo systemctl enable duetwebserver
If you wish to change parameters of the DWS configuration, edit /opt/dsf/conf/http.json.
Duet Web Control
For your convenience, Duet Web Server serves the user interface, Duet Web Control, from the /www folder of the virtual SD card directory (see below). This effectively mimics the old behaviour of previous Duet controllers. Once DWS has been started, open a browser of your choice and go to http://127.0.0.1. If you do not wish to connect manually every time you do this, you can specify the hostname of your Linux board instead of 127.0.0.1 as well (e.g. rasperrypi on Raspbian).
Virtual SD card
The first SD card (0:/) is emulated by DCS and its default directory is /opt/dsf/sd. It may changed by editing the BaseDirectory value in /etc/dsf/config.json.
Firmware update on recent versions (DCS >= 220.127.116.11)
Before you can update DSF, it is important to install the latest RepRapFirmware version first. If you are using recent DCS (>= 18.104.22.168) and RRF versions, you can put the updated Duet3Firmware.bin file in the /sys directory and run "M997". This will trigger a firmware update. For convenience, you can simply upload Duet3Firmware.bin on the System page of DWC2 and confirm the update.
The latest firmware file can be obtained here: https://github.com/dc42/RepRapFirmware/r...
Firmware update on older versions and fallback method
If you are upgrading from older DSF/RRF versions, you have to put the Duet 3 into flashing mode before you can proceed. To do this, run "M999 PERASE" (without quotes) either from the web interface or from localhost (you may use /opt/dsf/bin/CodeConsole for this). That will put the Duet 3 into flashing mode.
If you already updated DSF and DCS cannot connect to RepRapFirmware any more, you can use a serial terminal (e.g. minicom on the RaspPi -> /dev/ttyACM0) to send "M999 PERASE". This step presumes the Duet 3 is connected to a USB port on the RaspPi. Alternatively, you can use your computer to perform the same step.
To install the latest firmware version, execute the following commands:
rm -f ./Duet3Firmware.bin wget https://chrishamm.io/Duet3Firmware.bin /opt/dsf/bin/bossac -u /opt/dsf/bin/bossac -e -w -v -b ./Duet3Firmware.bin -R
Since DSF is provided as a standard Debian package feed, the update is quite trivial. To update it, run a standard system update on the attached SBC:
sudo apt-get update sudo apt-get upgrade
This will automatically install the latest DSF components.
If you start DuetControlServer and DuetWebServer in terminals then the debug output is available for monitoring. Run these two commands in separate terminals:
sudo /opt/dsf/bin/DuetControlServer sudo /opt/dsf/bin/DuetWebServer
In case you get a message saying DCS is already started, make sure to stop it first as well as the web server:
sudo systemctl stop duetwebserver sudo systemctl stop duetcontrolserver
Please use the forum to report any issues: