Cant program ESP32-S2

Electronics-noob
Posts: 8
Joined: Wed Jul 31, 2019 3:14 pm

Cant program ESP32-S2

Postby Electronics-noob » Mon Jul 20, 2020 8:32 am

Hello everyone!

I recently switched processor from ESP32 to ESP32-S2 in some hardware that I’m designing. I changed processor because the ESP32 lacked some functionality that I needed and it happened to exist in the ESP32-S2.

I can’t figure out why I’m not able to program the ESP32-S2, i followed the hardware design guidelines from Espressif.
The processor is configured in "Download Mode" to program it through RS232.
The RF side of the chip is not implemented in hardware/software.
4MB external flash memory is added according to the design recommendations (The same has worked for the ESP32).

If I open the serial monitor with a baud rate of 115200 I get the following error:

Code: Select all

5hESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
//And then it repeats  "invalid header: 0xffffffff" and spams the console with it.
I get the following error when I try to flash the processor

Code: Select all

esptool.py v2.8
Serial port COM12
Connecting....
Detecting chip type...

A fatal error occurred: Unexpected UART datecode value 0x00000500. Failed to autodetect chip type.
esptool.py failed with exit code 2
I have attached a stripped down version of my microcontroller schematic.
I’m not sure what’s going on but would appreciate any help!

Image
Attachments
Stripped-Microcontroller.pdf
PDF of above image
(46.86 KiB) Downloaded 50 times

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

Re: Cant program ESP32-S2

Postby ESP_Sprite » Mon Jul 20, 2020 9:30 am

'invalid header: 0xffffffff' is kind-of expected, as the flash still is empty and as such the ESP ROM sees an invalid image.

Not being able to program the chip is more strange... are you sure you did the 'idf.py set-target' step to make sure you're not accidentally trying to flash the chip as a non-S2 ESP32?

Electronics-noob
Posts: 8
Joined: Wed Jul 31, 2019 3:14 pm

Re: Cant program ESP32-S2

Postby Electronics-noob » Mon Jul 20, 2020 10:00 am

Hi,

I followed the getting started guide from Espressif https://docs.espressif.com/projects/esp ... rt-project

But I get "Error: No such command 'set-target'." whenever I try to "set target to ESP32-S2"
No idea why, I’ve tried it on two computer so far running Windows and Linux...


Image

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

Re: Cant program ESP32-S2

Postby chegewara » Mon Jul 20, 2020 10:54 am

Agree, it looks exactly what ESP_Sprite said.

User avatar
ESP_Roland
Posts: 93
Joined: Tue Oct 09, 2018 10:28 am

Re: Cant program ESP32-S2

Postby ESP_Roland » Mon Jul 20, 2020 11:41 am

If you don't have the "set-target" command then you have probably IDF v4.0 or earlier. Target "esp32s2beta" is supported in IDF v4.1 and "esp32s2" in IDF v4.2 or newer.

Note that you are browsing the "latest" documentation which is for the IDF "master" branch, i.e. v4.3 under development.

Electronics-noob
Posts: 8
Joined: Wed Jul 31, 2019 3:14 pm

Re: Cant program ESP32-S2

Postby Electronics-noob » Mon Jul 20, 2020 11:46 am

I just tried updating to the master branch and setting the target microcontroller. The update to Master was successful, was able to run install.bat and export.bat but now I get a CMake Error when running idf.py set-target.

I removed parts of the IDF path since my name is in the search path...

Code: Select all

-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32s2
CMake Error at esp-idf/tools/cmake/component.cmake:224 (message):
  CMake Error at build_properties.temp.cmake:2 (set):

    Syntax error in cmake code at



      esp-idf/examples/get-started/hello_world/build/build_properties.temp.cmake:2



    when parsing string



      .espressif\python_env\idf4.3_py3.7_env\Scripts\python.exe



    Invalid character escape '\U'.

  Call Stack (most recent call first):

   esp-idf/tools/cmake/scripts/component_get_requirements.cmake:2 (include)





Call Stack (most recent call first):
  esp-idf/tools/cmake/build.cmake:405 (__component_get_requirements)
  esp-idf/tools/cmake/project.cmake:395 (idf_build_process)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
See also "esp-idf/examples/get-started/hello_world/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1



User avatar
ESP_Roland
Posts: 93
Joined: Tue Oct 09, 2018 10:28 am

Re: Cant program ESP32-S2

Postby ESP_Roland » Mon Jul 20, 2020 2:49 pm

That is caused by another issue tracked here: https://github.com/espressif/esp-idf/issues/5606

Electronics-noob
Posts: 8
Joined: Wed Jul 31, 2019 3:14 pm

Re: Cant program ESP32-S2

Postby Electronics-noob » Wed Jul 22, 2020 10:41 am

Thanks!

I got some things working, I cloned branch v4.2 and was able to compile the code and flash the ESP32-S2.

The ESP32-S2 throws an error and crashes at boot, "failed to detect flash size" when using the serial monitor.
I am unable to compile the code if i change the flash size and turn of the auto detect flash size in menuconfig (CMake throws a lot of errors).

The serial output is below.

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40024f29
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe8100,len:0x4
load:0x3ffe8104,len:0x1848
load:0x40050000,len:0x14b0
load:0x40054000,len:0x210c
entry 0x400502dc
I (49) boot: ESP-IDF v4.2-dev-1856-g00148cd0c 2nd stage bootloader
I (49) boot: compile time 09:52:22
I (49) boot: chip revision: 0
I (52) boot.esp32s2: SPI Speed      : 80MHz
I (57) boot.esp32s2: SPI Mode       : DIO
I (62) boot.esp32s2: SPI Flash Size : 2MB
I (66) boot: Enabling RNG early entropy source...
I (72) boot: Partition Table:
I (75) boot: ## Label            Usage          Type ST Offset   Length
I (83) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (90) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (98) boot:  2 factory          factory app      00 00 00010000 00100000
I (105) boot: End of partition table
I (109) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f000020 size=0x04f38 ( 20280) map
I (123) esp_image: segment 1: paddr=0x00014f60 vaddr=0x3ffbcdd0 size=0x01eb0 (  7856) load
I (129) esp_image: segment 2: paddr=0x00016e18 vaddr=0x40024000 size=0x00404 (  1028) load
I (136) esp_image: segment 3: paddr=0x00017224 vaddr=0x40024404 size=0x089cc ( 35276) load
I (154) esp_image: segment 4: paddr=0x0001fbf8 vaddr=0x00000000 size=0x00420 (  1056)
I (155) esp_image: segment 5: paddr=0x00020020 vaddr=0x40080020 size=0x12c74 ( 76916) map
I (184) boot: Loaded app from partition at offset 0x10000
I (184) boot: Disabling RNG early entropy source...
I (184) cache: Instruction cache        : size 8KB, 4Ways, cache line size 32Byte
I (192) cpu_start: Pro cpu up.
I (195) cpu_start: Application information:
I (200) cpu_start: Project name:     hello-world
I (205) cpu_start: App version:      v4.2-dev-1856-g00148cd0c
I (212) cpu_start: Compile time:     Jul 21 2020 09:52:01
I (218) cpu_start: ELF file SHA256:  ceab943bacf619ab...
I (224) cpu_start: ESP-IDF:          v4.2-dev-1856-g00148cd0c
I (230) cpu_start: Single core mode
I (235) heap_init: Initializing. RAM available for dynamic allocation:
I (242) heap_init: At 3FFBF440 len 0003CBC0 (242 KiB): DRAM
I (248) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM
I (254) cpu_start: Pro cpu start user code
I (313) spi_flash: detected chip: generic
E (313) spi_flash: failed to get chip size
assertion "flash_ret == ESP_OK" failed: file "Documents/GitHub/esp-idf/components/esp32s2/cpu_start.c", line 359, function: start_cpu0_default

abort() was called at PC 0x40019fbe on core 0

Backtrace:0x4002703f:0x3fffe1c0 0x40027865:0x3fffe1e0 0x4002a57a:0x3fffe200 0x40019fbe:0x3fffe270 0x4001a42b:0x3fffe290 |<-CORRUPTED


ELF file SHA256: ceab943bacf619ab

Electronics-noob
Posts: 8
Joined: Wed Jul 31, 2019 3:14 pm

Re: Cant program ESP32-S2

Postby Electronics-noob » Thu Jul 23, 2020 6:52 am

Solved the issue.

Cloned the latest Master branch and compiled the Blink example using IDF version 4.3.
Used this guide to fix the PATH issue on windows https://github.com/espressif/esp-idf/issues/5512

Had to set "use legacy SPI driver" in the menu config.

It is now working!

Sharmilaa
Posts: 8
Joined: Thu Jul 23, 2020 7:19 am

Re: Cant program ESP32-S2

Postby Sharmilaa » Thu Jul 23, 2020 7:31 am

Hello everyone,

i m doing an iot project in which i m using esp32d0wdq6 controller. i have designed my own board and soldered an new bare ic, spi flash ic, etc... i m getting an error while buruning a boot loader. please suggest me the right way to buring a bootloader.
my connections are as follows between my pcb board and ttl converter,
vcc - 3.3v
gnd - gnd
tx - rx
rx-tx
en- 3.3v
gpio0 - gnd

and selected "esp dev module" in arduino ide & programmmer as AVRISP mk11 & then i tried to burn boot loader ..

Thanks in advance !!

Who is online

Users browsing this forum: No registered users and 10 guests