Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
hcet14
Posts: 34
Joined: Sat Dec 19, 2020 12:59 am

Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by hcet14 » Tue Aug 24, 2021 2:55 am

This is inspired by reppad viewtopic.php?f=18&t=10104&start=10#p60480

Hopefully self-explaining.

I bought the board here https://de.aliexpress.com/item/10050029 ... 4c4d980EOo called ESP-C3-32S-Kit(2M). I don't recommend it. Buy one with 4MB.

Ai-Thinker schematics slightly corrected to be readable, you may find the original schematics here https://www.waveshare.com/wiki/File:Nod ... matics.pdf: [Nodemcu-esp-c3-32s-kit-schematics_corr.pdf]
Picture of an Internet picture of a similar board with placement (violet circles indicate differences of placement compared to my board, green parts are modifications (EN pull-up, LED to indicate voltage VDD3V3): [esp-c3-32s-kit_placement.jpg]
Picture of my modified board: [my_ecp32_c3.jpg]

Schematics differences to my board:
R9=R10=R5=R7=22 Ohm
C4 probably 100µF

The NPN-transistors plus R1 and R2 are missing (NC). DTR and RTS are directly connected to pins IO9 (GPIO0) (R6) and EN (CHP_PU) (R4), like reppad already mentioned.

to get it booting...

- Unsolder R6 and R4.
- Place 10k (0402) to R1 and R2.
- Pull-up for EN. This modification is copied from ESP32-C3-DEVKITM-1_V1 and/or ESP32-C3-DEVKITC-02_V1_1.
Place 10k (0402) between Pin 3 and 2 on the ESP-32S_Module. Place a 1µF between Pin 3 and the shielding cage (just suggestions, where to place).
I don't know if the pull-up is really needed! Maybe someone who knows can give some input. The capacitor can be much smaller, 100nF might be enough.

I flashed a firmware from https://micropython.org/download/all with this command

Code: Select all

esptool.py --port /dev/ttyUSB0 write_flash 0x0 esp32c3-20210822-unstable-v1.16-236-gb51e7e9d0.bin
No REPL! Error: E (268) spi_flash: Detected size(2048k) smaller than the size in the binary image header(4096k). Probe failed.

I tried

Code: Select all

esptool.py --port /dev/ttyUSB0 write_flash 0x1000 esp32c3-20210822-unstable-v1.16-236-gb51e7e9d0.bin
No REPL! invalid header: 0xffffffff forever

Checked my SPI flash size with esptool, voila 2MB. So I had to try to build a FW for 2MB.

I copied everything together [GENERIC_C3_2MB.zip] and did a try (https://github.com/micropython/micropyt ... /README.md, esp-idf v4.3) with

Code: Select all

make BOARD=GENERIC_C3_2MB
There was a FW in the build folder.

Code: Select all

esptool.py --chip esp32c3 --port /dev/ttyUSB0 write_flash -z 0x1000 firmware_gereric_c3_2mb_210824.bin
No REPL! invalid header: 0xffffffff forever

Code: Select all

esptool.py --chip esp32c3 --port /dev/ttyUSB0 write_flash -z 0x0 firmware_gereric_c3_2mb_210824.bin
Works, REPL :o [firmware_gereric_c3_2mb_210824.bin]

You may find all files which are marked [] here: https://mega.nz/file/OwlSBA4S#_8ck3Q0sk ... dCwQ_7WDJI

Thanks to the developers, cool to have ESP32-C3!

PS: One good thing, I complained about the 2MB flash size, since it was supposed to come with 4MB and got the money back. So I recommend the seller.
I'm a beginner with this stuff and no programmer at all.

User avatar
reppad
Posts: 10
Joined: Mon Aug 16, 2021 10:46 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by reppad » Wed Aug 25, 2021 7:46 pm

Good job, it should not have been easy to solder 0402 resistors! :o
Thank you for your feedback and for the firmware, I should try to do the same on mine.

User avatar
hcet14
Posts: 34
Joined: Sat Dec 19, 2020 12:59 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by hcet14 » Fri Aug 27, 2021 6:07 pm

reppad wrote:
Wed Aug 25, 2021 7:46 pm
Good job, it should not have been easy to solder 0402 resistors! :o
My pleasure. Are you good with the soldering iron? Beginners should practice before. Make sure the soldering tip isn't hotter than 370°C. The pads are tiny and the PCB is cheap. I use two soldering irons to remove parts.
Thank you for your feedback and for the firmware, I should try to do the same on mine.
Don't put the pull-up on the board like I did. It should be already on the ESP32-C3S module https://docs.ai-thinker.com/_media/esp3 ... cation.pdf.
I have the impression, you got a 4MB module. So you may use the firmware from https://micropython.org/download/all. Good luck ;)
I'm a beginner with this stuff and no programmer at all.

User avatar
reppad
Posts: 10
Joined: Mon Aug 16, 2021 10:46 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by reppad » Thu Sep 02, 2021 1:04 pm

hcet14 wrote:
Fri Aug 27, 2021 6:07 pm
My pleasure. Are you good with the soldering iron? Beginners should practice before. Make sure the soldering tip isn't hotter than 370°C. The pads are tiny and the PCB is cheap. I use two soldering irons to remove parts.
I am not doing too badly but I admit that I do not play too much with SMD parts ;)
hcet14 wrote:
Fri Aug 27, 2021 6:07 pm
I have the impression, you got a 4MB module. So you may use the firmware from https://micropython.org/download/all. Good luck
When I say "I should try to do the same on mine" it's about fixing DTR/RTS circuitry, not building firmware, indeed the firmware from micropython.org CI works in my 4MB module.

I tested it with success on the TTGO T-OI Plus too, very good module, best quality price report I found for a C3 module.
Time to update to the fresh new v1.17 now !

User avatar
hcet14
Posts: 34
Joined: Sat Dec 19, 2020 12:59 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by hcet14 » Mon Sep 06, 2021 9:08 pm

I bought a new one with 4MB. Works flawless with esp32c3-20210906-unstable-v1.17-8-gbbbdef4cc.bin from https://micropython.org/download/all/
You don't need the pull-up for EN. It's already on the ESP32-C3S module https://docs.ai-thinker.com/_media/esp3 ... cation.pdf
Sorry my fault.
reppad wrote:
Thu Sep 02, 2021 1:04 pm
I tested it with success on the TTGO T-OI Plus too, very good module, best quality price report I found for a C3 module.
Time to update to the fresh new v1.17 now !
I had a look at the schematics of the TTGO T-OI Plus. It has the same circuitry to manage RTS & DTR. I couldn't find a price for your board (everywhere sold out). Is that really cheaper than my clone? It looks more expensive.
My clone is copied from https://docs.espressif.com/projects/esp ... itm-1.html or https://docs.espressif.com/projects/esp ... tc-02.html That's why I have chosen that one.
I'm a beginner with this stuff and no programmer at all.

User avatar
reppad
Posts: 10
Joined: Mon Aug 16, 2021 10:46 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by reppad » Fri Sep 10, 2021 10:38 am

I don't know if it is cheaper than your clone but still cheap (~5€).
I prefer it because it seems better quality and has more features like power switch, grove connector, D1 mini shields compatibility, functional RTS/DTR circuitry...

probably717rar
Posts: 2
Joined: Tue Nov 09, 2021 2:32 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by probably717rar » Tue Nov 09, 2021 2:42 am

First off, thank you for all this great work! I have successfully programmed various devices using Raspberry Pi Picos and TTGo T-Display chips. I doubt I would be much interested in microcontrollers without being able to leverage my existing knowledge of Python.

I picked up a TTGO T-OI chip, seemed perfect for my needs. Inexpensive ($4 USD) and small, with a reset and on/off switch and USB-C. It may have been a bridge too far for my knowledge though.

http://www.lilygo.cn/prod_view.aspx?Typ ... t3:50044:3

Flashing the board using esptool.py seems to work well (after finding and installing new drivers in windows):

Code: Select all

PS C:\Users\X> C:\Users\X\AppData\Local\Programs\Thonny\python.exe -u -m esptool --port COM10 erase_flash
esptool.py v3.1
Serial port COM10
Connecting....
Detecting chip type... ESP32-C3
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:b6:59:44
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 4.5s
Hard resetting via RTS pin...
PS C:\Users\Ryan> C:\Users\X\AppData\Local\Programs\Thonny\python.exe -u -m esptool --chip esp32-c3 --baud 460800 --port COM10 write_flash -z 0x1000 C:/Users/X/Downloads/esp32c3-20210902-v1.17.bin
esptool.py v3.1
Serial port COM10
Connecting....
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:b6:59:44
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00169fff...
Compressed 1475488 bytes to 855215...
Wrote 1475488 bytes (855215 compressed) at 0x00001000 in 21.4 seconds (effective 552.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
But I am not able to have Thonny connect to REPL. No prompt is displayed. Nothing happens. I also tried flashing with the latest nightly and the output window in Thonny would only scroll "invalid header: ..." over and over.

Any suggestions for further debugging would be appreciated!

User avatar
reppad
Posts: 10
Joined: Mon Aug 16, 2021 10:46 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by reppad » Tue Nov 09, 2021 11:09 am

probably717rar wrote:
Tue Nov 09, 2021 2:42 am

Code: Select all

C:\Users\X\AppData\Local\Programs\Thonny\python.exe -u -m esptool --chip esp32-c3 --baud 460800 --port COM10 write_flash -z 0x1000 C:/Users/X/Downloads/esp32c3-20210902-v1.17.bin
Hi,

On ESP32-C3, the firmware must be flashed at address 0x0 instead of 0x1000 as on ESP32 and ESP32-S2.
Just try to erase the flash memory again then re-write the firmware by simply replacing 0x1000 by 0x0.

C:\Users\X\AppData\Local\Programs\Thonny\python.exe -u -m esptool --chip esp32-c3 --baud 460800 --port COM10 write_flash -z 0x0 C:/Users/X/Downloads/esp32c3-20210902-v1.17.bin

Good luck Ryan (you forgot to hide one) ;)

probably717rar
Posts: 2
Joined: Tue Nov 09, 2021 2:32 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by probably717rar » Tue Nov 09, 2021 10:47 pm

Image

That did it. This appears to be a very nice dev board.

Thanks!

pvh
Posts: 3
Joined: Wed Jan 26, 2022 11:55 am

Re: Micropython on an Ai-Thinker ESP32-C3-32S_Kit (no original) from China with 2MB SPI flash

Post by pvh » Wed Jan 26, 2022 12:12 pm

Many thanks for your work on the "firmware_gereric_c3_2mb_210824.bin" FW, hcet14!
This is the only build that worked for me ("esp32c3-usb-20220125-unstable-v1.18-42-g30b6ce86b.bin", "esp32c3-usb-20220117-v1.18.bin", "esp32c3-20220117-v1.18.bin", and "esp32c3-20210902-v1.17.bin" all gave strange errors after flashing them to my 2Mb AT ESP32-C3-32S-Kit)

In my project, my board is out of WIFI reach and I'd like to experiment with the ESP-now functionality to overcome this challenge.
I seem to experience that this functionality is however not yet included in your build.

Is there a workaround for this? (I see that things are under development on Git (https://github.com/glenn20/micropython/tree/master), but as I'm not familiar enough with Git I wouldn't know how to leverage this work)

Many thanks!

Post Reply