Author Topic: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]  (Read 3082 times)

0 Members and 1 Guest are viewing this topic.

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« on: February 20, 2018, 01:59:36 pm »
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 below
Ardunio    CP2102N (https://www.silabs.com/documents/public/data-sheets/cp2102n-datasheet.pdf)
  TX             RX
  RX             TX
Reset          RTS Via a 0.1uf cap.

What more would i need to verify ? Would appreciate any help. Schematic attached
« Last Edit: February 20, 2018, 06:55:15 pm by anishkgt »
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: Arduino USB-UART with CP2102N does not upload sketch
« Reply #1 on: February 20, 2018, 02:23:11 pm »
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.
« Last Edit: February 20, 2018, 11:34:07 pm by TK »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 1995
  • Country: us
Re: Arduino USB-UART with CP2102N does not upload sketch
« Reply #2 on: February 20, 2018, 02:44:17 pm »
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.
 
The following users thanked this post: anishkgt

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: Arduino USB-UART with CP2102N does not upload sketch
« Reply #3 on: February 20, 2018, 02:45:41 pm »
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.com

Equipments: DSO104z, Hakko FX888D, Brymen BM869s
 

Offline jm_araujo

  • Regular Contributor
  • *
  • Posts: 72
  • Country: pt
Re: Arduino USB-UART with CP2102N does not upload sketch
« Reply #4 on: February 20, 2018, 05:43:47 pm »
Reset should connect to DTR, not RTS.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #5 on: February 20, 2018, 07:02:36 pm »
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.

The 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.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 1995
  • Country: us
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #6 on: February 20, 2018, 11:12:57 pm »
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.



 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #7 on: February 23, 2018, 09:28:27 am »
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.
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #8 on: February 23, 2018, 12:12:35 pm »
Something happened to the CP2102N chip or the D+ or D- connections from the chip to the USB connector.
 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #9 on: February 23, 2018, 12:15:00 pm »
But when connecting the RTS of the CP to RESET of the arduino. It seemed to be working.


Www.Georgehobby.wordpress.com

Equipments: DSO104z, Hakko FX888D, Brymen BM869s
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 1995
  • Country: us
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #10 on: February 23, 2018, 03:15:42 pm »
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.

 

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: Arduino USB-UART with CP2102N does not upload sketch [SOLVED]
« Reply #11 on: February 23, 2018, 03:49:17 pm »
yea i will just stick to RTS for now as it had been working earlier.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf