So, I am trying to understand how USB's work in conjuction with UART and USART and or the CH340g. Like the ATmega16u2.
I have already looked over the specs for the chip. im still not to sure if i am miss-understanding some part of the process. So, i have made a couple of boards with the mega16u2 and CH340g. when i plug in the USB cable to the PC i get an error (error code 43) already looked up all info on this done everything to fix the prob. For the atmega i am using an external crytsal 16 mhz. the crystal in a SMD with a built in cap. for the CH340g i used a 12 mhz with 22pf caps. with no luch cant get it accepted by the computer.
I am trying to learn how to use the USB in a controller. here for knowledge
This sounds like an interesting project. I have done the same with my own version of the Arduino Mega and I did see the same error. Can you provide me with the following information?
Pcb layout and schematic files
A few pictures of the 16u2 and the CH340G as they sit on the pcb
What computer OS you have (Windows, MAC, or Linux)
What OS aversion (Windows 10, Sierra)
What type of USB port (2.0 or 3.0)
What programming has been done to the 16u2 or the CH340G
In addition, it may be helpful to download Nick Gammon’s Atmega_Board_Programmer for future testing.
I have windows 10 home edition, 64 bit op, 64 processor
I have standard enhanced usb.
I have not done any programming, because i thought the computer would sort that out. But I did download some of the files for both microchips, and tried to update that through Device manager. nothing.
an error code comes up and says
(Windows has stopped this device because it has reported problems. (Code 43)A request for the USB device descriptor failed)
also this shows up- Universal Serial Bus controllers
-(Standard USB Host Controller)
-Port_#0001.Hub_#0001
Device instance path- USB\VID_0000&PID_0002\5&E535C4E&0&1
this is for both boards i get this message and tried everything and nothing worked
The board that has the 16u2 is an SMD external crystal 16 MHz with a built in cap looked at the data sheet for the 16u2 just lost on what i exactly have to do
same with the CH340g
I tried finding YT videos on building USB, couldn't find any that explains to why there are doing in in such a way to make it work i am a visual and audible learner.
its easy just to use a chip usb to serial converter lol thats not the point.
i would like to know where my mistakes are on building such project ( this message is towards everyone else).
I looked at your pictures. The first thing that strikes me is that you mentioned using a 16u2, but the pcb lists a 32u2. They have the same pinouts according to the datasheet, but which specifically are you using?
The layout looks decent as far as I can tell. There seem to be a lot of redundant traces, and the fuse appears to be shorted out. I’m going to open it on my version of Eagle and see what I can find.
The main problem for my board was that the computer I wanted to program with would not see or utilize the correct drivers for the factory 16u2 QFP chips I used. The solution occurred to me after I had left my board plugged into my laptop for maybe an hour while I soldered a second of my pcb. At first I would get “unknown device” and various error codes, but then I got a notification that drivers were installed correctly when I returned from soldering. My suggestion would be to plug the board into the computer and attempt to install drivers for the 16u2 or 32u2. If/when that fails, leave the device plugged in and go watch a good movie on Netflix, afterwards, come back and see what’s happened.
I would recommend downloading Atmel Flip 3.4.7 from Microchip. It may be helpful later. The drivers for the 16u2 are located in C/Program Files (x86)/Atmel/Flip 3.4.7/usb if you choose to download Flip.
Here are the files I modified. Basically it is just cleaning up traces that are non-functional and making other traces more in-line with accepted standards. Traces that carry high speed signals such as MOSI,MISO,SCK, and the USB lines should be parallel with their counterparts and should be the same overall length (<200 mil difference between them).
I also added a component called a varistor to each of the USB lines to ground. A varistor is a diode with varying resistance depending on the amount of voltage applied to it. It can help to stabilize the signals.
I also added a 1 megaohm resistor across the two resonator pins, which helps stabilize it.
I moved some capacitors to be closer to the power pins of the 16u2 chip. These are called decoupling capacitors and they help to clean up the power trace that goes to the pin, and the capacitor should be as close to the pin as possible.
I also had to change the pin headers, as the oval shape was blocking some of the polygons.