Micro USB for UART and Power

Thread Starter

Diana Jokic

Joined Oct 19, 2017
1
Hi everyone!

I'm making a custom board based on the ATSAMD21 MCU, which is also used in the Arudino Zero. I would like to incorporate a Micro USB connector, primarily for UART communication with a computer. I'll program the chip using Cortex debug with the Atmel ICE debugger, so the USB connection doesn't need to be used for that. I also would like to make use of the connection for 5V and 3.3V supply.

I've been looking at the schematic of Sparkfun's SAMD21 Dev Breakout Board, but cannot fully understand the schematic. I've attached relevant sections of the schematic. What is the purpose of the tri-state buffer? Is it so that setting USB_HOST_EN on/off somehow allows power to flow to the voltage regulator? I can't seem to understand how USB_ID and USB_HOST_ENABLE work together along with the buffer. Is this part even needed? If you get rid of it, does it mean that the board will always be on when plugged in?

My second question is regarding USB_D+ and USB_D-. I understand the basics of what they are, but I'm not sure how to implement them. In the schematic, they are linked to specific pins on the MCU (PA24 and PA25). I'm assuming that these pins are somehow enabled to program the MCU via the on board debugger in the firmware. If I only want to use USB for UART, do I connect D- and D+ to the RX / TX pins used for UART, or is that over simplifying?

Thanks in advance for any guidance! I'm having trouble finding written documentation on how to connect USB on a custom board.
 

Attachments

philba

Joined Aug 17, 2017
959
USB is a separate protocol from Serial (er, NRZ Serial). There may be code out there but the USB stack is kind of big and, iirc, the protocol makes some significant demands on timing. Have you though of just using a USB to serial chip? It's a common and easy solution. There are lots out there and they aren't that expensive. Take a look at the FT232 family.

The SFE circuit look like they are using it to switch between USB power and other power (battery, I would guess). The extra pin on the micro USB connector is to support USB on the go where the device becomes a master. iirc, it is pulled to ground. I think the "floating" comment is just to cover all bases.
 
Top