USB connection

Hi All,

So I'm trying to create my own PCB board based off of the Arduino ATmega 2560 design. I'm using the ATmega 640-16AU as my main microcontroller and want to have a USB, bluetooth and an sd card attached to it. I'm having trouble trying to understand if the D+ and D- pins from the USB connector can go to any digital pin on the ATmega640 chip or if I have to add an ATmega16U2-MU chip as used in the Arduino uno and the 2560 design. I've attached my schematic for better understanding. Any help would be very appreciated.

Moved your topic to it's current location as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.

Bob.

The ATmega2560 doesn't have native USB support. It is possible to do USB purely in the firmware. The popular solution for this approach is V-USB:

But this is a bit of a hack. Here's Adafruit's statement on why they are no longer using it:

Deprecation Warning: The Trinket bit-bang USB technique it uses doesn't work as well as it did in 2014, many modern computers won't work well. So while we still carry the Trinket so that people can maintain some older projects, we no longer recommend it.

The manufacturers of Arduino boards don't put expensive chips like the ATmega16U2 on their boards for the fun of it. They do it because they determined this is the best approach. I would recommend you to follow their lead. If you want to save a little money, and not have to deal with flashing the firmware, you could use the CH340 instead of the ATmega16U2. The CH340 is used on many of the Chinese derivatives of the Arduino Mega.

But if you want to go the V-USB route, I'm sure it will be an educational experience if nothing else. Most likely it will end up working for you. In addition to the original Adafruit Trinket, there are a ton of those DigiSpark boards out there that use this technique. I've never seen it done with an ATmega2560 board though. I guess once people are slapping a big, high end chip like that on a board, the cost and space savings of omitting the USB chip are not so significant.

Dam thanks for the help very educational too! :slight_smile:

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per