Deploying Code to a Wemos D1 Mini with an FT232R USB-to-Serial Converter on an ARM64-Based Computer
/Update: Turns out I’m an idiot. You can get ARM drivers for the CH340 device. You just have to look in the right place:
https://wch-ic.com/downloads/CH341SER_EXE.html
This is still a good read, and you can use this technique with any device which doesn't have a USB to serial adapter. But I'm now very pleased to be able to report that my Snapdragon powered Copilot laptop is one step closer to perfection.
Sometimes we tech enthusiasts find ourselves on a slightly unconventional path — such as using an ARM64-based computer, like a Snapdragon-powered Windows PC. Here’s where things get interesting: while the Wemos D1 Mini, an ESP8266-based board, is fantastic for IoT projects, it typically comes with a CH340 USB-to-serial converter chip. And here’s the catch: as of now, CH340 doesn’t have ARM64-compatible drivers for Windows. This leaves us in a bit of a bind.
The solution? We’re using an FT232R USB-to-serial adapter as a workaround, since FTDI (the maker of the FT232R) does provide ARM64 drivers. So, we’ll connect the Wemos to our computer through the FT232R and deploy code without needing native support for the CH340. Let’s walk through how to set this up.
Step 1: Download and Install the FTDI Drivers
To start, let’s make sure we have the ARM64 drivers installed for the FT232R.
- Go to FTDI’s VCP Drivers page.
- Download the ARM64 driver under the “Windows (Desktop)” section.
- Install the driver, following the on-screen instructions. This driver will allow your ARM64-based computer to recognize the FT232R as a COM port.
After installation, plug in the FT232R USB-to-serial adapter, and you should see it listed as a new COM port in your device manager. With this setup, we’ve successfully created a bridge to work with the Wemos D1 Mini on ARM64 Windows.
Step 2: Connecting the FT232R to the Wemos D1 Mini
Now let’s handle the wiring. This is where we make the magic happen, letting us put the Wemos D1 Mini into programming mode without needing native CH340 support. Here’s how to connect each pin:
Required Pins
FT232R Pin | Wemos D1 Mini Pin |
---|---|
TX | RX (D10) |
RX | TX (D9) |
GND | GND |
DTR | D3 (GPIO0) |
RTS | RST |
Explanation of the Connections:
- TX (on FT232R) to RX (on Wemos) — Data is sent from the FT232R to the Wemos.
- RX (on FT232R) to TX (on Wemos) — Data is received from the Wemos to the FT232R.
- GND (on FT232R) to GND (on Wemos) — Both devices share a common ground.
To enter programming mode:
- DTR (on FT232R) to D3 (GPIO0) — The DTR line pulls GPIO0 low during reset, which signals the Wemos to enter programming mode.
- RTS (on FT232R) to RST — The RTS line pulls the RST (reset) pin low, resetting the Wemos and kicking it into programming mode when DTR is also low.
Step 3: Programming the Wemos D1 Mini
With everything wired up, it’s time to program the board. Here’s how you can do it:
Using the Arduino IDE:
- Open the Arduino IDE and select Wemos D1 Mini under Tools > Board.
- Select the newly recognized COM port under Tools > Port.
- Write a simple sketch, such as the
Blink
example, and click Upload. The Arduino IDE will handle the DTR and RTS signals automatically to put the Wemos into programming mode, so you don’t need to press any buttons.
Using PlatformIO:
PlatformIO can be used for uploading code, but it sometimes leaves the DTR and RTS lines in a state that holds the Wemos in reset or bootloader mode, preventing it from running normally. Here’s the straightforward fix:
Remove the DTR and RTS cables after upload.
It’s a bit messy but reliable. Once the code upload completes, simply disconnect the DTR and RTS cables from the Wemos. This lets the board reset itself and run the uploaded code without being held in bootloader mode.
Using
esptool.py
:- If you’re comfortable with the command line, use
esptool.py
:
Replaceesptool.py --port COMx write_flash 0x00000 firmware.bin
COMx
with your port andfirmware.bin
with your firmware file. This should automatically handle DTR and RTS toggling as well, but again, you may need to remove the DTR and RTS cables afterward to let the Wemos run normally.
- If you’re comfortable with the command line, use
Troubleshooting Tips
If the Wemos isn’t entering programming mode or starting correctly after upload, try these steps:
- Check Connections: Ensure your wiring matches the table above.
- Verify the Correct COM Port: Confirm the right COM port is selected in your software.
- Remove the DTR/RTS Cables: After uploading, simply disconnect the DTR and RTS cables from the Wemos to prevent the board from staying in bootloader mode.
Wrap-Up
Using an FT232R USB-to-serial converter on an ARM64-based PC with a Wemos D1 Mini lets you sidestep the lack of CH340 support on ARM. Once set up, you’ll have a reliable way to deploy code to your Wemos, gaining the flexibility to use ARM64 computers for your IoT projects without limitations.
ChatGPT wrote this. But in the “style of Rob Miles”