ESP32 S2 FH4 First factory upload

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

Re: ESP32 S2 FH4 First factory upload

Postby ESP_Sprite » Tue Sep 06, 2022 8:47 am

Honestly, I'm kinda scratching my head on that issue... from what you have told and shown here, it should work. Are you sure your PCB matches the schematic, as in, you don't have a short or anything that throws a wrench in the works? Can you try on another PCB?

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Wed Sep 07, 2022 7:08 am

The restart after 3 seconds prints:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x10 (RTCWDT_RTC_RST),boot:0xa (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x524
load:0x4004c000,len:0xa70
load:0x40050000,len:0x292c
SHA-256 comparison failed:
Calculated: 8dce998efc3eb6dc43f3799a489dbcfbd5ada9828beadf71017c05c4a8d32bc3
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x4004c18c
But what does

Code: Select all

rst:0x10 (RTCWDT_RTC_RST)
mean?
It keeps printing this on every reset. Also it seems to never to reach the setup() of the arduino ide program, because it does not print anything from serial.println().

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Wed Sep 07, 2022 9:00 am

ESP_Sprite wrote:
Tue Sep 06, 2022 8:47 am
Honestly, I'm kinda scratching my head on that issue... from what you have told and shown here, it should work. Are you sure your PCB matches the schematic, as in, you don't have a short or anything that throws a wrench in the works? Can you try on another PCB?
Yeah my pcb matches the schematic exactly and no shorts to be found on the boards.
I tried on a couple of pcb's and both go into a boot loop after flashing an program to th esp. Even a simple blink program or print to serial program gets them into the boot loop.

It looks like the esp never gets into the setup() function, since it does not print anything of the program to the serial console.

I just tried on a thirth pcb and it also resets the whole time.

I can only program the board via the uart tx and rx line which i also use for RS485, but the converter chip should not work since i don't switch the flow control pin.

Update:
After removing the rs485 convert chip, all transmision dissapeared. I used an 10k pullup resistor to the 3v3, but without succes.

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Wed Sep 07, 2022 10:25 am

This is my pcb, not sure it helps.

After i removed IC4 (the rs485 converter), all communication stopped. Tried to put an 10uF capacitor between gnd and EN, but nothing changed.
pcb.png
pcb.png (53.13 KiB) Viewed 4644 times
Update
Managed to flash a basic print to serial program, i needed to use a 10kohm pullup resitor on the RX line. Sadly i still have the same problem: keeps resetting. So was not the problem.

Also tried to connect the usb to 5V adapter and/or solder a 3v3 power line from a rpi 4B to the baord, but both things did not resolve anything.

I'm truly clueless on what is could be.

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Wed Sep 07, 2022 11:41 am

Do i need to connect another crystal of 32Khz to the esp maybe? I found one that uses it on an esp32 S2 wroom module, but don't know if this is also for me applicable.

https://github.com/eggsampler/ESP32-S2-Breakout

chegewara
Posts: 2375
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 S2 FH4 First factory upload

Postby chegewara » Wed Sep 07, 2022 1:20 pm

Ive been trying to reproduce boo mode and i have to admit i failed. I cant find combination of known bootstrap pins which is giving boot:0xa

I can reproduce this message when GPIO46 is high when trying to enter bootloader mode (IO0 + EN):

Code: Select all

rst:0x10 (RTCWDT_RTC_RST),boot:0x14 (SPI_FLASH_BOOT)
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x7 (TG0WDT_SYS_RST),boot:0x14 (SPI_FLASH_BOOT)
Saved PC:0x400160c5
this one with GPIO45 high when normal reset:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x18 (SPI_FAST_FLASH_BOOT)
invalid header: 0xffffff1f
invalid header: 0xffffff1f
invalid header: 0xffffff1f
normal bootloader mode(IO0 low, IO45 and IO46 also low):

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0/1/SPI))
waiting for download
and just normal boot:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x524
load:0x4004c000,len:0xa50
load:0x40050000,len:0x28cc
Sadly S2 documentation is missing this section available for old esp32:
https://docs.espressif.com/projects/esp ... de-message
Screenshot from 2022-09-07 15-20-05.png
Screenshot from 2022-09-07 15-20-05.png (13.96 KiB) Viewed 4605 times

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Wed Sep 07, 2022 2:04 pm

chegewara wrote:
Wed Sep 07, 2022 1:20 pm
Ive been trying to reproduce boo mode and i have to admit i failed. I cant find combination of known bootstrap pins which is giving boot:0xa

I can reproduce this message when GPIO46 is high when trying to enter bootloader mode (IO0 + EN):

Code: Select all

rst:0x10 (RTCWDT_RTC_RST),boot:0x14 (SPI_FLASH_BOOT)
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x7 (TG0WDT_SYS_RST),boot:0x14 (SPI_FLASH_BOOT)
Saved PC:0x400160c5
this one with GPIO45 high when normal reset:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x18 (SPI_FAST_FLASH_BOOT)
invalid header: 0xffffff1f
invalid header: 0xffffff1f
invalid header: 0xffffff1f
normal bootloader mode(IO0 low, IO45 and IO46 also low):

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x0 (DOWNLOAD(USB/UART0/1/SPI))
waiting for download
and just normal boot:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe6100,len:0x524
load:0x4004c000,len:0xa50
load:0x40050000,len:0x28cc
Sadly S2 documentation is missing this section available for old esp32:
https://docs.espressif.com/projects/esp ... de-message
Screenshot from 2022-09-07 15-20-05.png
My lilygo esp32 S2 also has the "boot: 0xa".
I did saw a "boot: 0x8" mode on the diy board when i powered the esp directly on the +3v3 power plain. Sadly this happend only once and never again.

My lilygo esp32-S2 print this with the same example problem where it prints to the console

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0xa (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
The diy pcb only prints this in the terminal after powering up:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0xa (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
....

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x10 (RTCWDT_RTC_RST),boot:0xa (SPI_FAST_FLASH_BOOT)	<-- after 3 second first time.
SPIWP:0xee
mode:DIO, clock div:1
....

When putting my diy pcb into boot mode i get this message (which is the same as my lilygo esp32-S2):

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x2 (DOWNLOAD(USB/UART0/1/SPI))
waiting for download

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

Re: ESP32 S2 FH4 First factory upload

Postby ESP_Sprite » Thu Sep 08, 2022 2:09 am

The ESP32-S2 does have some docs on the GPIO_STRAPPING in the TRM, but bit 1:0 are undefined there. From what I can find if I dig in the archives (it's been 3 years since we worked on that chips design), those bits *may* be defined by the state of U0TX and U0RX (GPIO1/2), but the doc I have isn't that clear on it. What I can tell you is that those bits shouldn't matter at all if you keep to the states in the datasheet: either with IO0=1 to boot into 'normal' mode or with IO0=0&IO46=0 to boot into download mode, the lower bits are ignored in ROM code. Given that, 0xA should give you a normal boot; I think the differences in boot mode between PCBs are a red herring.

Re the 32KHz crystal: it has use in deep sleep modes, but it's not necessary for basic operation of the chip at all.

Two more (somewhat related) things you can try. First of all, maybe there's some madness going on with the internal flash. If you can compile a project in ESP-IDF, can you try lowering the flash speed? Should be in menuconfig, under 'serial flasher config'. I think you have it set to 80MHz, you can try lowering it to see if that changes anything.

The other one is that you don't have any external capacitors on VDD_SPI. Looking at the datasheet of one of our modules that use the same chip, there's an 1uF plus a 0.1uF capacitor on the VDD_SPI pin. Perhaps adding those fixes your problem?

(Btw: you do know that there's no need to connect that RS485 chip specifically to U0RxD and U0TxD? All our ESP chips have multiple UARTS, and you can route those UARTS to any IO pin, and by using an uart different from UART0, you don't get the issue that the chip will try to emit boot messages there.)

_Rens_
Posts: 25
Joined: Fri Mar 25, 2022 10:04 am

Re: ESP32 S2 FH4 First factory upload

Postby _Rens_ » Thu Sep 08, 2022 2:08 pm

ESP_Sprite wrote:
Thu Sep 08, 2022 2:09 am
The ESP32-S2 does have some docs on the GPIO_STRAPPING in the TRM, but bit 1:0 are undefined there. From what I can find if I dig in the archives (it's been 3 years since we worked on that chips design), those bits *may* be defined by the state of U0TX and U0RX (GPIO1/2), but the doc I have isn't that clear on it. What I can tell you is that those bits shouldn't matter at all if you keep to the states in the datasheet: either with IO0=1 to boot into 'normal' mode or with IO0=0&IO46=0 to boot into download mode, the lower bits are ignored in ROM code. Given that, 0xA should give you a normal boot; I think the differences in boot mode between PCBs are a red herring.
I cannot hardset the state of IO46 due to how small the pin is, but if it is pulled down by default. Also i am able to put my diy board into download mode, so i think this pin is pulled down correctly.

ESP_Sprite wrote:
Thu Sep 08, 2022 2:09 am
Re the 32KHz crystal: it has use in deep sleep modes, but it's not necessary for basic operation of the chip at all.
Good to know that i didn't miss an crystal.

ESP_Sprite wrote:
Thu Sep 08, 2022 2:09 am
Two more (somewhat related) things you can try. First of all, maybe there's some madness going on with the internal flash. If you can compile a project in ESP-IDF, can you try lowering the flash speed? Should be in menuconfig, under 'serial flasher config'. I think you have it set to 80MHz, you can try lowering it to see if that changes anything.

The other one is that you don't have any external capacitors on VDD_SPI. Looking at the datasheet of one of our modules that use the same chip, there's an 1uF plus a 0.1uF capacitor on the VDD_SPI pin. Perhaps adding those fixes your problem?
I am using the arduino ide v2 where i program with the esptool v3.3. I tried setting the speed to 40MHz, but nothing different happend.

The vdd_spi pin capacitors would be a good last option, sadly i need this out tomorrow. I only have 2 diy boards with me and ruined both since the pins are so small.

Alternative route:
We are thinking about switching to the module instead of the chip due to time and deadlines. This way we know for certain that all pins for the chip are connected and easier to solder to while trouble shooting with the bigger pads. The module we order to test out is the: ESP32-S2-WROVER.

ESP_Sprite wrote:
Thu Sep 08, 2022 2:09 am
(Btw: you do know that there's no need to connect that RS485 chip specifically to U0RxD and U0TxD? All our ESP chips have multiple UARTS, and you can route those UARTS to any IO pin, and by using an uart different from UART0, you don't get the issue that the chip will try to emit boot messages there.)
Good suggestion, did not thought about the boot message on UART0. I will connect the RS485 chip to UART1 (IO 17 and 18). On the initial diy pcb i designed the board to be programmed via usb in boot download mode, but switched to serial when i could not connect to it via usb.

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

Re: ESP32 S2 FH4 First factory upload

Postby ESP_Sprite » Fri Sep 09, 2022 12:27 am

Alternative route:
We are thinking about switching to the module instead of the chip due to time and deadlines. This way we know for certain that all pins for the chip are connected and easier to solder to while trouble shooting with the bigger pads. The module we order to test out is the: ESP32-S2-WROVER.
That should work just fine; from what I recall that module only needs a proper power supply and the reset RC network to be usable over USB.

Good suggestion, did not thought about the boot message on UART0. I will connect the RS485 chip to UART1 (IO 17 and 18). On the initial diy pcb i designed the board to be programmed via usb in boot download mode, but switched to serial when i could not connect to it via usb.
IO17/18 will work, but those are merely the default pins for that UART. On ESP32 chips, with the exception of some high-speed peripherals, thanks to the GPIO matrix you could have chosen any free IO pin to route the UART1 signals over. Just saying, as in my experience knowing that can make PCB design a lot easier!

Who is online

Users browsing this forum: Google [Bot] and 177 guests