-
Notifications
You must be signed in to change notification settings - Fork 9
Flashing ESP
Printrboard hosts an ESP8266 module. Its firmware can be updated using the provided FTDI header located at the top left corner of the PCB.
As the following text references signals and pins have a look at this image which shows where the signals could can be found on the board.
- Board must be powered with enough current (500 mA, better 1A)
- MK20 must be disabled (short RESET_B with GND)y
- PlatformIO software installed
Most FTDI cables provide (some) power. You can try to just connect the board with the FTDI breakout board or cable. If ESP flashing does not work it's likely that the ESP does not get enough current and crashes due to voltage dropping below 3V. AS USB (2) is only able to deliver 500mA this might not be enough. Some FTDI cable do not even provide this amount of current. Best way to ensure enough power is to connect a steady 5V power supply with enough current (1A) to the Printrboard.
There are various pins located on the board for that. Best place is the header for the printer at the top right corner of the board. See the image provided below for the exact location of the pins.
You can provide power on both the FTDI header and through the printer header.
MK20 and ESP share the same serial connection as the ESP with the FTDI header. If MK20 is working and listening to serial connections it will interrupt the flash process and it will fail. So we need to disable MK20. This is easy to do.
On the bottom left corner is an expansion header that exposes both the GND and RESET_B (RES_B) signal. RESET_B must be pulled LOW, i.e. connected with GND. This way MK20 will be disabled. Just connect both signals with a jumper cable. The display should turn off once you have shorted the signal.
Printrboard also hosts numerous test points that can also be used to flash the whole board by using some pogo pins.
PlatformIO (core) must be installed. It's not required to install the PlatformIO IDE, just the command line tools are enough. There is a good guide here: http://docs.platformio.org/en/latest/installation.html
There are different cables and breakout boards available. It's important to choose the 3.3V versions! Power supply would not be an issue, but logic level will be different and could damage the ESP module as it's a 3.3V device. So make sure you select the correct cable or breakout board. This one works great and can be directly connected to the FTDI header (https://www.sparkfun.com/products/9873).
Make sure you align the breakout board so that the signals are connected this way:
FTDI Printrboard
RX <---> TX
TX <---> RX
GND <---> GND
3.3V <---> VIN`
Once the device is prepared (powered up, FTDI cable connected to the PC/Mac and RES_B shorted to GND) you can start with the flash process.
First, you need to get the current software. Download it from this repository or clone it with Git. Simplest way is to just download the current master branch with this link: https://github.com/Printrbot/Printrhub/archive/master.zip
Extract the ZIP file in a folder and you are ready to go to install the firmware update
Open a terminal or command line prompt and navigate to the "esp"-folder in the folder that you just created and extracted the content.
Enter this command to build the current firmware:
> platformio run
This will compile and build the ESP firmware binary. It will output quite a lot of text, but if it closes with something like this everything went fine:
Building .pioenvs/esp12e/firmware.bin
text data bss dec hex filename
323432 16836 30912 371180 5a9ec .pioenvs/esp12e/firmware.elf
========================= [SUCCESS] Took 2.66 seconds =========================
That means that the current binary (firmware.elf) could be created. If it fails it's most likely an issue that you are in the wrong folder (make sure you navigated in the esp folder. Running a dir
(Windows) or ls
(macOS) should show you the files shown here: https://github.com/Printrbot/Printrhub/tree/master/esp.
Now that you have built the firmware it can be uploaded to the board.
Although we have connected the board and supplied it with power we need to set the ESP module in DFU mode so it reads a new firmware via the FTDI header. To do that, you must do this in sequence:
- Press and hold the GPIO0 button in the bottom right corner of the board
- Press the RESET button (left of GPIO0 button) once
- Release the GPIO0 button
The small LED in the bottom right corner will dim (barely visible in bright light conditions) and indicate DFU mode.
Now run this command:
platformio run --target upload
After a few seconds you should see a progress bar indicating that the flash progress started. LEDs will also blink on the ESP module.
Just make sure to not interrupt the process and that RESET_B stays connected to GND.
If it does not work, it's perhaps PlatformIO could not find the correct COM port. Sometimes, if a lot of devices are connected to USB this can happen.
Run this command to find the correct device port:
platformio device list
It will list all devices. FTDI breakout boards often have strange names, so the best way to find the correct device is to unplug it, run the device list command, reconnect it and run the device list again. Compare both lists to find the correct device.
Once you know the correct device name, i.e. /dev/cu/ASLED-3432, then run this command:
platformio run --target upload --upload-port=/dev/cu/ASLED-3432
Make sure that the LED is still dimming. ESP stops DFU mode automatically after some time. You can do that button sequence to set the ESP in DFU mode anytime, even if it already is in DFU mode. So I recommend you just do that everytime before starting the command.
After the flash upload sequence finished remove the jumper cable that shorted RESET_B signal. If ESP previously had a WiFi connection to your local network you should be able to see it in the Printrbot Cloud. If not, connect your mobile phone or PC/MAC to the printrbot WiFi and run http://printrbot to setup the WiFi connection.