Dear web-surfer, after quite a long time designing the Freq_LF_HF board and preparing content, Pandauino? webiste is now launched! What do you think about our logo?
When I asked the potential users of the frequency counter I am working on their advice on the design, most of them wrote to me that they actually would prefer an Atmega328 based board to a cortex m0+ based board.
Indeed this chip has been so much used and the user community is so large that it appears to be the best choice to build an Arduino compatible board. The downside is that it does not natively support USB.
So I had to think about the best solution. In fact Arduino original boards and clones are equipped with different circuits that have different qualities. Here are the most common solutions to add USB support to a microcontroller.
Atmega8 / Atmega16U2
The original UNO and Mega 2560 board are using respectively Atmega8 / Atmega16U2 chips for USB support. These are programmed with a firmware that does convert UART signals (two wires Rx, and Tx) to USB signals.
The chips are programmed at the factory and the user might want to update the firmware using a DFU (Device Firmware Update) programmer. The procedure is presented on Arduino’s website.
- Building a board that is very close to the original Arduino design
- Possibility to change the firmware
- Expensive, particularly if you are using the Atmega16U2 chip only for this
- Large footprint with external crystal and other components required
- In my opinion this is a waste to use a microcontroller to provide this only functionality. This would be ok if you had a large stock of these microcontrollers which probably was the reason why Arduino made this choice.
FTDI is the “USB bridging solution specialist”. They have a complete offer of chips for bridging between USB and UART or I2C, SPI and other communication protocols. They offer the FT232R chip that is commonly used in standalone USB to UART modules that one can find at a relatively cheap price over Internet market places.
- Specific chip with full options and a complete documentation
- Integrated clock
- Simple circuit implementation
- Unfortunately I read some bad comments regarding the utilisation of this chip and had trouble myself while testing it. I would say this might be a very good solution for advanced users willing to master the USB protocol.
CH340G / CH341G
This chip is a Chinese solution for bridging USB to UART. Its price is very low as compared to other solutions, so it raises suspicion at first. The documentation is available here. The windows driver can be downloaded from here. I could make it work relatively easily. You need to provide a good 12 MHz clock signal with short traces and adapted capacitors and maybe a 1 MOhm resistor between the crystal pins.
- Specific solution
- Very cheap solution
- Working well
- Very large footprint with external crystal and other components required
Other chips are available on the market:
CP2102, affordable, without external crystal
PL2303, older chip not supported under Windows 8
MCP2200, the driver seems not so good, very large footprint, needs an external oscillator
MCP2221, smaller footprint without external crystal, relatively expensive
You might simply opt for a microcontroller with native USB support. This is of course the easiest solution. But if we consider the cortex m0+ case, we face a little problem because the chip is powered in 3.3V while USB Vcc pins requires 5 volts. So the implementation might not be this straighforward. In consequence Arduino MKR zero, Arduino M0, Arduino Zero and Arduino MKR1000 board have a relatively complex power circuit with logic signals to select the power source and provide both 5V and 3.3V. Regarding the data lines, the implementation is very straightforward.
- Cheapest / cost effective solution
- Space saving
- Directly supported by the microcontroller without other programming
- Might need a little more study than expected at first
- Limited to some microcontrollers
USB interface boards
You can find interface boards that usually implement an FT232 or CH340G or other chip on the main market places. This is very convenient and cost effective if your project does not absolutely needs a USB port on the board itself / permanently.
You might also program your MCU via ISP using a programmer. USB driver stability and Serial COM port mapping can be troublesome and it is very handy to program the board directly using a programmer like USBAsp. Plus you would not spare flash memory to store the bootloader.