Arduino USB-UART with CP2102N does not upload sketch [SOLVED] - Page 1
Forum section: electronics / projects

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 20, 2018, 01:59:36 pm
content: Hi All,My Atmega328P cannot take sketch via the USB on a prototype PCB. I tested the CP2102N via putty if the communication was ok. It is working and i can see the Atmega reset pin is held high via a 1K resistor to +5v. I was able to upload the Arduino bootloaded via the ICSP pin from an Ardunino Board.Checked to see the if RX and TX are correct. The connection is as belowArdunio CP2102N (https://www.silabs.com/documents/public/data-sheets/cp2102n-datasheet.pdf)TX RXRX TXReset RTS Via a 0.1uf cap.What more would i need to verify ? Would appreciate any help. Schematic attached

author: TK
author_rank: Super Contributor
timestamp: February 20, 2018, 02:23:11 pm
content: Maybe RX / TX signals are inverted. If you look the CP2102 datasheet, RXD is UART receive and it should go to Arduino RX, and TXD is UART transmit and it should go to Arduino TX.EDIT: I checked again and RX and TX are connected correctly on the original schematics provided by OP.

author: Peabody
author_rank: Super Contributor
timestamp: February 20, 2018, 02:44:17 pm
content: It looks like RX and TX are correct. Two possible things:Are you actually seeing the reset pulse on the RTS pin of the CP2102N, and at the processor? You have reset driven by the RTS output of the CP2102N, but are you sure the software isn't using the DTR output for that?The VBUS resistor divider as shown in the schematic looks wrong. The datasheet shows 22K and 47K, but you have 22R and 47R. Drawing lots and lots of current just in the divider. But more important, the divider may not be providing a high enough voltage at VBUS to be recognized as a high. The chip won't turn on unless the VBUS input registers as high, and it's looking for 5V. The datasheet shows the divider used only for a self-powered CP2102N. You are using bus-powered. I think VBUS should be connected directly to USB V+ with no divider.The datasheet is confusing because Notes can refer to stuff on the next page.

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 20, 2018, 02:45:41 pm
content: The cp2102 and CP2102N are different. I did swap the pins to see if that was the problem but that did not work either.Www.Georgehobby.wordpress.comEquipments: DSO104z, Hakko FX888D, Brymen BM869s

author: jm_araujo
author_rank: Regular Contributor
timestamp: February 20, 2018, 05:43:47 pm
content: Reset should connect to DTR, not RTS.

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 20, 2018, 07:02:36 pm
content: Quote from: Peabody on February 20, 2018, 02:44:17 pmThe resistors used are actually 22Ohms as seen in the schematic but i misread that, none the less they seem to be working will change that to 22k and 47K latter and stick to the datasheet. Thank you for pointing it out to me.So i had the PCB's ground plane of the USB side to be isolated from the main GND plane. Now added merged the two GND and all seems to be working now.

author: Peabody
author_rank: Super Contributor
timestamp: February 20, 2018, 11:12:57 pm
content: I'm glad it's working. But for the benefit of anyone else reading this in the future, you should not be using a divider on VBUS if you are in bus-powered mode. That's only for self-powered mode. You should be using the circuit shown in Figure 2.5 of the CP2102N datasheet. You are using Figure 2.6, which does not apply to your situation. You should be connecting VBUS directly to USB V+ as shown in Figure 2.5.

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 23, 2018, 09:28:27 am
content: I just connected RESET of the ATmega238P to DTR and followed fig 2.5 and connected VREGIN to VBUS. Now windows detects the USB device as "Unknown USB Device (Device Descriptor Request Failed)"Not sure why this is happening ? It started when moving the RTS to DTR.

author: TK
author_rank: Super Contributor
timestamp: February 23, 2018, 12:12:35 pm
content: Something happened to the CP2102N chip or the D+ or D- connections from the chip to the USB connector.

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 23, 2018, 12:15:00 pm
content: But when connecting the RTS of the CP to RESET of the arduino. It seemed to be working.Www.Georgehobby.wordpress.comEquipments: DSO104z, Hakko FX888D, Brymen BM869s

author: Peabody
author_rank: Super Contributor
timestamp: February 23, 2018, 03:15:42 pm
content: The use of DTR or RTS, or both, is a question of what your flashing software does. I think in the past the Arduino software has used RTS, but switched over to DTR at some point. But it may do both to preserve backwards compatibility. If you find that one of them works, use that one. If you have a scope, you should be able to see the line go low briefly.Otherwise all I can suggest is that you double check the COM port you're set for, and its settings. Actually I think the software handles the settings once you select the port. And make sure you've specified the right Atmega part.

author: anishkgt
author_rank: Frequent Contributor
timestamp: February 23, 2018, 03:49:17 pm
content: yea i will just stick to RTS for now as it had been working earlier.