Ai-Thinker ESP-C3-12F-Kit with 4MB SPI Flash, but without DTR/RTS

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
SunWukong
Posts: 11
Joined: Thu Jan 16, 2020 2:22 pm
Contact:

Ai-Thinker ESP-C3-12F-Kit with 4MB SPI Flash, but without DTR/RTS

Post by SunWukong » Mon Jan 17, 2022 1:03 pm

I bought 3 Ai-Thinker ESP-C3-12F-Kit at Banggood, which cost only 13.00 Euros with 4MB Flash. In contrast, the 2 Waveshare ESP-C3-32S-Kit, with 2MB Flash, which I had bought before, cost 18.99 Euros. That was the good news, now for the bad.

For testing, I have uploaded a simple, already existing Arduino sketch. In the sketch, only a secure logon to the local network, a query of the time at the local NTP and the output of the time in the serial monitor should take place.

Code: Select all

void setup(){
  // Initilize hardware serial:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  //Connect to the WiFi network
  connectToWiFi(ssid, pass);
}

void loop(){
  //only send data when connected
  if(connected){
    //Send a packet
    udp.beginPacket(udpAddress,udpPort);
    udp.printf("Seconds since boot: %lu", millis()/1000);
    udp.endPacket();
  }
  //Wait for 1 second
  delay(1000);
}
Compiling and uploading were problem-free, but as soon as I opened the serial monitor, the white LED went out and nothing else happened. Since I actually wanted to use the board under MicroPython anyway, I didn't investigate any further at this point.

A check to see if the board really has 4MB of flash was positive.

Code: Select all

T:\Entwicklung\Espressif\MicroPython\ESP-C3-12F-Kit Ai-Thinker\GENERIC_C3>c:esptool --chip auto --port COM27 flash_id
esptool.py v3.2
Serial port COM27
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 84:f7:03:3a:19:c4
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...
I next flashed the current Release.
As with Arduino IDE, this was again trouble-free.

Code: Select all

T:\Entwicklung\Espressif\MicroPython\ESP-C3-12F-Kit Ai-Thinker>c:esptool --chip esp32c3 --port COM27 --baud 460800 write_flash -z 0x0 esp32c3-20210902-v1.17.bin                        
esptool.py v3.2
Serial port COM27
Connecting....
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 84:f7:03:3a:19:c4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00168fff...
Compressed 1475488 bytes to 855215...
Wrote 1475488 bytes (855215 compressed) at 0x00000000 in 25.7 seconds (effective 458.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
But as soon as I start Thonny, the white LED goes out and I only get this error message.

Code: Select all

Device is busy or does not respond. Your options:

  - wait until it completes current work;
  - use Ctrl+C to interrupt current work;
  - use Stop/Restart to interrupt more and enter REPL.
When I start the Mu Editor, the LED stays on, but I get the following message and REPL does not work here either.

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0x4 (DOWNLOAD(USB/UART0/1))
waiting for download
Since I suspected problems with the UART, the USB to UART Bridge Controller CH340, or its connection, I commented out the waiting for the serial in my Aurduino sketch. The board then dialled itself in and fetched the time as long as I did not open the serial monitor.
I found out that there are options for the Arduino IDE that affect the monitoring of RTS and DTR.
C:\Users\mike\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.2\boards.txt

Code: Select all

...
esp32c3.serial.disableDTR=true
esp32c3.serial.disableRTS=true
...
Now I could call the Serial Monitor, but the output of the Serial.print() statements is no longer available. Only when I press the reset button do I get a one-time output.

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000
When comparing the schematic diagrams of the two C3 boards, I discovered that 2 NPN transistors for a FlipFlop were left out of the ESP-C3-12F kit. On the photos I took, you can see the missing of the 2 transistors. On the Waveshare ESP-C3-32S-Kit, these NPN transistors were soldered in.
DTR-RTS Flipflop Ai-Thinker ESP-C3-12F-Kit.png
DTR-RTS Flipflop Ai-Thinker ESP-C3-12F-Kit.png (41.37 KiB) Viewed 12112 times
https://docs.ai-thinker.com/_media/esp3 ... cation.pdf
DTR-RTS Flipflop Waveshare ESP-C3-32S-Kit.png
DTR-RTS Flipflop Waveshare ESP-C3-32S-Kit.png (13.37 KiB) Viewed 12112 times
https://www.waveshare.com/w/upload/4/46 ... matics.pdf
ESP-C3 kits top.png
ESP-C3 kits top.png (261.73 KiB) Viewed 12112 times
ESP-C3 kits bottom.png
ESP-C3 kits bottom.png (223.05 KiB) Viewed 12112 times
My guess is that because the flipflop is missing, this board can be reset by DTR/RTS or by pushbutton, or put into DFU mode, but the UART is no longer allowed to use DTR/RTS.

I'll probably open issues on MicroPython, Thonny and Mu Editor in GitHub later today, but I'm not sure if abandoning DTR/RTS can be implemented without side effects.

MaxMin
Posts: 6
Joined: Mon Aug 22, 2022 4:41 am

Re: Ai-Thinker ESP-C3-12F-Kit with 4MB SPI Flash, but without DTR/RTS

Post by MaxMin » Mon Aug 22, 2022 10:47 am

A fix for the Arduino serial monitor disabling the board (/Enable Wired to RTS on some boards)

One can patch the Arduino boards.txt file, replacing false with true:

Code: Select all

esp32c3.serial.disableDTR=true
esp32c3.serial.disableRTS=true
This worked on my MacOS system where the USB interface has 2 instances:

/dev/cu.usbserial-1410
/dev/cu.wchusbserial1410

I had to switch to one for compile/download, switching to the other port for Serial monitoring.
Tried removing a ch340 driver, got one USB instance that didn't work right for either function.

Surprisingly, the cleanest Arduino operation for the ESP32-C3 was had using the internal JTAG/serial USB connection (io18/19) which worked perfectly in Arduino, same result with the M5 StampC3u variation (the white package) that has no USB interface chip.
The internal USB connector also worked fine for flashing code. The internal USB appeared on my system as /dev/cu.usbmodem14101

Post Reply