Posted on

How to Get Your CH340 USB to Serial Device Working

Many of our Arduino compatible devices contain a CH340 USB to Serial IC instead of the much more expensive FTDI chip.  The CH340 is common in Chinese product, but not as common in products designed in the rest of the world.  What this ends up meaning is, it is sometimes problematic getting them working on your computer.  To make things easier, the following drivers have been tested by us:

Translated Datasheet

Windows Driver (2016-09-27)
Official Mac Driver (May have troubles 10.9 and later)
Signed Mac Driver (Should work with 10.9+)

Note that Windows 10 appears to include the driver, as does Linux.  One extremely edge case, though, to be aware of: As of this writing, the Linux driver for the CH340 does not support parity.  The STM32Duino we sell requires parity when installing the bootloader.  To save yourself hours of hair-pulling, know that you will either need to use a different USB to Serial adaptor, or a different OS, or patch your kernel driver.

Posted on

Loading a Bootloader on the STM32 Blue Pill

Here is how I loaded the bootloader on a new STM32 Blue Pill.

Installed Arduino 1.8.5

 

Tools->Boards->Boards Manager

Install SAM Cortex-M3

Download:

https://github.com/rogerclarkmelbourne/Arduino_STM32/archive/master.zip

Unzip to My Documents->Arduino->Hardware

Rename folder. (Remove -master, so it is simply Arduino_STM32)

Navigate into drivers->win

Execute install_drivers.bat as administrator. (Right-click, run as administrator)

 

Visit:

https://github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries

And select:

Generic_boot20_pc13.bin

Save it in “tools/win/”

 

Set the Boot0 jumper to 1

Wire up the CH340 USB to TTL-232, G-G, TX-A10, RX-A9

USB (for power)

stm32flash.exe -w generic_boot20_pc13.bin COM4 (whatever com port your CH340 is on)

Put jumper back to 0

Reset

Use Arduino to upload a sketch to test. (Blink, for example)

 

Posted on

ESP-12F and Breakout Board

The ESP8266 module is a cheap and relatively easy way to build an Arduino-style project with WiFi capabilities.  It’s not without its quirks, though.  The following should help you get up to speed quickly.

The ESP is a power hungry device.  It requires a solid 3.3V DC power supply.  (Probably in the 1A range, depending on what else you are powering from the same supply. It doesn’t draw this much steadily, but it draws bursts while transmitting.)  Make sure you have appropriate capacitors mounted as close to the module as possible.  Also note, this module is 3.3V and is NOT 5V tolerant.  If you apply 5V to any of the pins, you will destroy it.  Use something like this http://sktechworks.ca/product/quad-logic-level-converter/ to interface to any 5V devices.

Minimal Setup:
In order to operate, the ESP-12F module requires the following:

Pin Resistor Connection
VCC 3.3V DC
GND GND
GPIO0 Pull Up
GPIO15 Pull Down
CH_PD Pull Up

The breakout boards we have contain the resistors for GPIO15 and CH_PD.  The only connection you need to worry about is GPIO0, which toggles between “Run” and “Bootloader.”  (A pullup on Reset is not a bad idea, but not entirely required.)

Minimal for programming:
In order to program the ESP module, you need to pull GPIO0 low and have control of the reset line.

Pin Resistor Connection
VCC 3.3V DC
GND GND
TX RX on serial adaptor
RX TX on serial adaptor
Reset Pull Up RTS on serial adaptor or pushbutton to GND
GPIO0 Pull Up DTR on serial adaptor or jumper/button to GND
GPIO15 Pull Down
CH_PD Pull Up

If your USB-UART adaptor has RTS and DTR, you can program this module as easily as an Arduino.  If you don’t have those pins, don’t sweat it.  Simply wire GPIO0 Pulled UP, then jumper it to GND for programming.  Do the same with Reset. (Use a pushbutton for easier access.)  When you are ready to upload your new program, you will need to press and release the reset button. (or ground and unground a jumper.)

In your Arduino IDE, the current best package for ESPs is:
https://github.com/esp8266/Arduino

The installation instructions are fairly clear on that page.