Problem with custom PCB with ESP32 WROOM E and sketch uploading

Peanut_Butcher
Posts: 7
Joined: Wed Dec 04, 2024 12:12 pm

Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby Peanut_Butcher » Wed Dec 04, 2024 12:57 pm

Hi guys,

I feel ashamed to ask such a question. I am trying to make a custom PCB design for a project. I made the schematics, ordered the board but when I solder all components, I am unable to upload my Arduino sketches to my ESP32.

Here are the components I am using : USB C (16 pins), CH340C (USB to Serial converter), AMS1117 (for 5V to 3.3V), transistors (2N2222), resistors and ESP32-WROOM-E.

Here is my schematic (simplified in order to only show connectivity between USB C, CH340C and ESP32 WROOM E).
Capture d'écran 2024-12-04 133339.png
Capture d'écran 2024-12-04 133339.png (200.79 KiB) Viewed 2064 times
When I saw that my sketches wont upload (It recognized the ESP32 module, but I got this error : "A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x65): Possible serial noise or corruption."), I tried to create a small prototype just to upload sketches using an USB C and CH340C module, here is the schematic I got from Chat-GPT :
Capture d'écran 2024-12-04 134944.png
Capture d'écran 2024-12-04 134944.png (782.71 KiB) Viewed 2064 times
But when I try to upload my sketch, I get the same error as the first one. I can't find the documentation of the module "USB C and CH340C" so impossible to see if what I am doing is correct...


If you have any idea of what is going on and what can be the solution, I would appreciate you help.

ESP_Sprite
Posts: 9835
Joined: Thu Nov 26, 2015 4:08 am

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby ESP_Sprite » Thu Dec 05, 2024 1:56 am

- Check signals. What do EN and IO0 do when you try to upload? Are they pulsing and is EN high when the upload is started (and/or failed)?
- Start a terminal program on the serial port, settings 115200,n,8,1. Reset the ESP32. Do you see a signon message?

Peanut_Butcher
Posts: 7
Joined: Wed Dec 04, 2024 12:12 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby Peanut_Butcher » Thu Dec 05, 2024 8:11 pm

Hello,

Both IO0 and EN are flashing while uploading (I measured voltage on those pins).

When I open Serial Monitor on Arduino IDE and I plug my PCB, I get this :
Capture d'écran 2024-12-05 203713.png
Capture d'écran 2024-12-05 203713.png (31.26 KiB) Viewed 1995 times
Strangely, I discovered that if I connect EN to IO23 using jumpers while uploading, it seems to work, and I can get a working Serial.print reading. But if my sketch is too big, I get "A serial exception error occurred: Write timeout" using this technique. I guess it is not a solution, but I feel I had to let you know.

ESP_Sprite
Posts: 9835
Joined: Thu Nov 26, 2015 4:08 am

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby ESP_Sprite » Fri Dec 06, 2024 2:10 am

Is the ESP32_EN line connected to anything else besides the ESP32-Wroom-E? (You need a RC network on it as well, if not the ESP won't get a good power-on reset and probably will reset at random times.)

username
Posts: 555
Joined: Thu May 03, 2018 1:18 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby username » Fri Dec 06, 2024 4:33 am

On the USBC connector. You didn't connect both A7 & B7 together, along with connecting both A6 & B6 together. If you dont make these contentions when you flip and re-insert the USB-C cable it wont work.

Or you can just use the ESP32-S3 chip and avoid all that extra hardware ;)

Peanut_Butcher
Posts: 7
Joined: Wed Dec 04, 2024 12:12 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby Peanut_Butcher » Fri Dec 06, 2024 7:55 am

@ESP_Sprite
EN of ESP32 is connected to nothing else but the collector of a transistor.
I have seen schematics using RC network (for newbies, it means resistor and capacitor network. It ensure a stable power-on reset), and other not using it. I doubt this is the reason of my problem but I may be wrong.

----------------------------------------------
@username
You are right, if I flip my USB-C, it is not detected by my PC anymore. This is my current USB-C connection :
Capture d'écran 2024-12-06 084733.png
Capture d'écran 2024-12-06 084733.png (208.61 KiB) Viewed 1836 times
We can see my A7 pin is D+, which I need to connect to CH340C D+. But I have floating A8, B6, B7, B8. Do you think this could be the problem ?

The reason why I do not use ESP32 S3 chip is because the dev board of this chip I tried won't work with my program, and eventually crashed. I would like to stay with ESP32, at least for now. But I will keep that piece of advice in mind.

ESP_Sprite
Posts: 9835
Joined: Thu Nov 26, 2015 4:08 am

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby ESP_Sprite » Sat Dec 07, 2024 1:47 am

Peanut_Butcher wrote:
Fri Dec 06, 2024 7:55 am
@ESP_Sprite
EN of ESP32 is connected to nothing else but the collector of a transistor.
I have seen schematics using RC network (for newbies, it means resistor and capacitor network. It ensure a stable power-on reset), and other not using it. I doubt this is the reason of my problem but I may be wrong.
You need the RC for a power-on reset, but the R also has the secondary effect of pulling the EN pin up to a defined level (3.3V). If you don't do that and have nothing else on the line that does something similar, you're getting weird behaviour. In general, all ESP32 schematics must have either the RC network or something similar (e.g. dedicated voltage monitor) to work properly.

I'd suggest adding a RC network to the EN pin and seeing if that solves the issue.

username
Posts: 555
Joined: Thu May 03, 2018 1:18 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby username » Sat Dec 07, 2024 5:43 am

We can see my A7 pin is D+, which I need to connect to CH340C D+. But I have floating A8, B6, B7, B8. Do you think this could be the problem ?
No, because you can see info from the terminal. But if you plug in the USB cable 180 Deg you wont.

Peanut_Butcher
Posts: 7
Joined: Wed Dec 04, 2024 12:12 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby Peanut_Butcher » Sat Dec 07, 2024 2:21 pm

@ESP_Sprite
Well, I added a RC network and it worked. As I did it "quick and dirty" in order to test, I sometimes get a write timeout error, but it eventually works. I would think that if I include this part to my custom PCB, it would work every time. A big thank for this helpful answer.
----------------------------------------------
@username
This would be really nice if I could have both USB-C sides working when I plug it.

================================

To be sure that I can upload my sketches on the new PCB I will order soon, and that it will work on both USB-C sides, I post my new configuration. If you have any comment / piece of advice about my schematic, I will read it with pleasure.
Capture d'écran 2024-12-07 150647.png
Capture d'écran 2024-12-07 150647.png (139.67 KiB) Viewed 1669 times
Pink zones is what I added. Not really sure for the connection between SBU1 and SBU2 on USB-C.
For the red zone ; is it mandatory to keep this part ?

username
Posts: 555
Joined: Thu May 03, 2018 1:18 pm

Re: Problem with custom PCB with ESP32 WROOM E and sketch uploading

Postby username » Sat Dec 07, 2024 6:07 pm

You really need some caps on the input and output on the 3.3v regulator.
you should put a 0.1uf & at least a ~10uf on the input. The 0.1uf should be as close to the input pin as possible.
The same should be done on the output as well.
You should also add a 0.1uf to pin 16 of the CH340.

Who is online

Users browsing this forum: cdollar, Majestic-12 [Bot], ok-home and 48 guests