esp32s2-cookbook icon indicating copy to clipboard operation
esp32s2-cookbook copied to clipboard

The programmer does not switch VDDxxx_EN as described.

Open DanSkareda opened this issue 11 months ago • 6 comments

I'm not very familiar with compilation, so I programmed (only with a minor modification due to WIN11 - UART connection with ESP32) the ESP32s2-solo2-4 as recommended by the precompiled BIN files: esptool -p COM7 write_flash --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 build/bootloader/bootloader.bin 0x10000 build/usb_sandbox.bin 0x8000 build/partition_table/partition-table.bin Then I connected the CH32V003 to the ESP32s2 as recommended:

  • Connect SWIO (Pin D1) to ESP32s2 GPIO6.
  • Use a 10k pull-up on SWIO.
  • VCC output to GPIO11/12 on the ESP32S2.

I connect GPIO11 for 3V3 using a dedicated switching circuit AP22802AW5-7, so I don't load the output with a large current supplying the ch32v003 circuit (7mA + LED). Then I connected the ESP32s2 to the computer via USB. But the programmer doesn't work. Using the command "./minichlink -3w myproject.bin flash -b" doesn't turn on the VCC voltage (although I verified with my own blink project that the GPIO11/12 output is fine). However, when I connect the power supply of the CH32V003 circuit directly to 3V3, the programmer programs the CH32V003 circuit correctly.

So I looked in pindefs.h and on line 4 I found that the board BOARD_CNLOHR_REV3 is defined, which has VDD3V3_EN on pin 5. But I already built a programmer with the VDD3V3_EN output on GPIO11, which corresponds to the BOARD_CNLOHR board. Can the author please compile the bin files for programming the ESP32S2 for the original BOARD_CNLOHR board (VDD3V3_EN/VDD5V_EN on GPIO11/12) to match what is described in the manual? Thanks.

DanSkareda avatar Jan 03 '25 15:01 DanSkareda

Can someone please verify if compiling with cmake from the resources available here works? I've been studying cmake all weekend, but it keeps saying "/tools/cmake/project.cmake" is missing. I try this by going into BUILD directory and typing "cmake ..".

DanSkareda avatar Jan 05 '25 09:01 DanSkareda

  1. This tool uses the IDF, only. You must use the IDF, which deals with all the CMAKE junk.
    (Unless you're using the other runfromram, etc. stuff, then it's just make).

  2. Sorry just seeing this now. But, please I implore you to just install the normal ESP32-S2 devkit install as outlined here and build whatever specific firmware you need. https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/get-started/index.html

If you still encounter difficulties, I can build out a few binaries.

cnlohr avatar Jan 07 '25 18:01 cnlohr

I downloaded ESP-IDF 5.0 and installed it. Then I ran ESP-IDF 5.0 CMD and followed the instructions on Expressif: cd users\dan\esp
(I uploaded the ch32v003programmer project here) idf.py set-target esp32s2 idf.py menuconfig (I set up USB there and saved the configuration) idf.py build

It worked for a while and then it ended with an error: C:/Users/dan/esp/main/main.c:9:10: fatal error: tinyusb.h: No such file or directory 9 | #include "tinyusb.h" | ^~~~~~~~~~~ compilation terminated. ninja: build stopped: subcommand failed.

DanSkareda avatar Jan 08 '25 17:01 DanSkareda

I just upgraded the programmer to v5.2.3 you should be able to build now.

I also switched the build target to CNLOHR_BOARD.

Charles

cnlohr avatar Jan 10 '25 00:01 cnlohr

I did a fresh install of toolchain 5.2.3 and downloaded the updated project. This time the compilation almost succeeded, but there is still a missing header file.

C:/Users/dan/esp/ch32v003programmer/main/main.c:23:10: fatal error: ulp_riscv.h: No such file or directory 23 | #include "ulp_riscv.h" | ^~~~~~~~~~~~~ compilation terminated. [963/969] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/programmer.c.obj ninja: build stopped: subcommand failed. Missing "ulp_riscv.h" file name found in the following component(s): ulp(C:\Espressif\frameworks\esp-idf-v5.2.3\components\ulp\ulp_riscv\include\ulp_riscv.h), ulp(C:\Espressif\frameworks\esp-idf-v5.2.3\components\ulp\ulp_riscv\include\esp32s2\ulp_riscv.h), ulp(C:\Espressif\frameworks\esp-idf-v5.2.3\components\ulp\ulp_riscv\include\ulp_riscv\ulp_riscv.h). Maybe one of the components needs to add the missing header directory to INCLUDE_DIRS of idf_component_register call in CMakeLists.txt. ninja failed with exit code 1, output of the command is in the C:\Users\dan\esp\ch32v003programmer\build\log\idf_py_stderr_output_16112 and C:\Users\dan\esp\ch32v003programmer\build\log\idf_py_stdout_output_16112

DanSkareda avatar Jan 10 '25 15:01 DanSkareda

Sorry, I missed this. You should go to your esp-idf folder and perform a git checkout v5.2.3 git submodule update --init --recursive ./install.sh and try again.

cnlohr avatar Apr 21 '25 10:04 cnlohr