Micropython on ESP32-C3

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
ralbix
Posts: 2
Joined: Thu Oct 14, 2021 9:38 am

Re: Micropython on ESP32-C3

Post by ralbix » Thu Oct 14, 2021 9:51 am

Hi guys,

I did the firmware upload on a ESP32-C3-devkit02 without errors following your instructions and would like t
verify the REPL interface through serial.
Altough I can get some messages through the terminal, I'm not seeing a stable interface as expected.
I'm using Termite 3.4 as suggested above and what I see is an infinite message list of "invalid header: 0xffff" with some
debug print inside:

Code: Select all

invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid headerþESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x10 (RTCWDT_RTC_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
Is there something in software that I can do to unblock the situation?
To speed up the situation I'm getting an usb-uart converter as I read above to try to get the REPL interface,
my plan is to enable the WEBREPL interface to go through Wifi instead of UART.

Assuming that I'll get the interface and I have my three pins TX, RX and GND coming from the converter, where do you hook them on the tiny ESP32-C3-devkit02 board? Before the CP2102 converter?

https://dl.espressif.com/dl/schematics/ ... 10126A.pdf

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

Re: Micropython on ESP32-C3

Post by hcet14 » Fri Oct 15, 2021 7:30 pm

Hello ralbix,
I think, you want to flash a 4MB firmware to a 2MB chip. Check the flash size of your ESP32-C3.
You may have a look at this thread viewtopic.php?f=18&t=11025&p=60918&hilit=c3#p60918
hcet14
I'm a beginner with this stuff and no programmer at all.

ralbix
Posts: 2
Joined: Thu Oct 14, 2021 9:38 am

Re: Micropython on ESP32-C3

Post by ralbix » Sat Oct 16, 2021 12:00 pm

Hi hcet14,

thanks for the suggestion, I checked that and:

Code: Select all

> esptool.py --chip esp32-c3 --port COM4 flash_id
esptool.py v3.1
Serial port COM4
Connecting....
Chip is unknown ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:af:4f:f4
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...
 
It seems like 4MB !
Moreover I don't get any error during the flashing process ..

User avatar
cederom
Posts: 16
Joined: Tue Oct 26, 2021 1:37 am
Contact:

Re: Micropython on ESP32-C3

Post by cederom » Tue Oct 26, 2021 1:52 am

Hello world :-)

What is the current status of MicroPython on ESP32-C3 chip? Is it production ready? :-)

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

Re: Micropython on ESP32-C3

Post by reppad » Tue Oct 26, 2021 8:28 am

cederom wrote:
Tue Oct 26, 2021 1:52 am
What is the current status of MicroPython on ESP32-C3 chip? Is it production ready? :-)
The release notes for v1.17 (latest stable to date) says "initial support for ESP32-C3 chips".
If we look at the bugtracker, some peoples seem to have problems with I2C and BLE because of a timer issue.

So I don't know what your expectations are for a "production ready" version but I would tend to think that this is not the case yet.

User avatar
cederom
Posts: 16
Joined: Tue Oct 26, 2021 1:37 am
Contact:

Re: Micropython on ESP32-C3

Post by cederom » Tue Oct 26, 2021 3:05 pm

reppad wrote:
Tue Oct 26, 2021 8:28 am
If we look at the bugtracker, some peoples seem to have problems with I2C and BLE because of a timer issue.

So I don't know what your expectations are for a "production ready" version but I would tend to think that this is not the case yet.
Thank you, I thought so, just wanted to clarify with someone close to current works :-)

I am considering porting and running MicroPython on ESP32-C3 on NuttX RTOS. Some work is already done with MP and it worked before with previous releases.

So far I will get familiar with MP on ESP32 boards, it seems to work like a charm. One thing is that it does not mount as USB Storage Device and I cannot really edit `main.py` is there any other way to do that except edit from interpreter on the UART? :-)

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

Re: Micropython on ESP32-C3

Post by reppad » Wed Oct 27, 2021 1:04 pm

cederom wrote:
Tue Oct 26, 2021 3:05 pm
One thing is that it does not mount as USB Storage Device and I cannot really edit `main.py` is there any other way to do that except edit from interpreter on the UART? :-)
The easiest way I know is to use the Thonny IDE, it allows you to connect to REPL, transfer files to and from the microcontroller (menu View->Files), and create and edit files directly from the microcontroller memory.
This is not the only solution, there are other ways: uPyloader, mpremote, ampy, rshell ...

User avatar
cederom
Posts: 16
Joined: Tue Oct 26, 2021 1:37 am
Contact:

Re: Micropython on ESP32-C3

Post by cederom » Wed Oct 27, 2021 1:28 pm

reppad wrote:
Wed Oct 27, 2021 1:04 pm
The easiest way I know is to use the Thonny IDE, it allows you to connect to REPL, transfer files to and from the microcontroller (menu View->Files), and create and edit files directly from the microcontroller memory.
This is not the only solution, there are other ways: uPyloader, mpremote, ampy, rshell ...
Wow thank you Reppad! There is a Thonny port on FreeBSD so it works out of the box. Also mpremote and rshell can be installed and executed directly from pip in VirtualEnvironment allowing various automations! Man I Love Python! :-)
--
CeDeROM, SQ7MHZ, https://www.tomek.cedro.info

jhaand
Posts: 1
Joined: Tue Jan 04, 2022 12:53 pm

Re: Micropython on ESP32-C3

Post by jhaand » Tue Jan 04, 2022 1:35 pm

reppad wrote:
Wed Aug 18, 2021 10:02 am
In most serial app I tested the board is set in programming mode because serial terminal programs asserts both RTS and DTR when opening the serial port, even if flow control is disabled (screen, putty, thonny, arduino ide, mobaxterm).
The program "Termite" does not have this behavior so all works with this software.
Personally I'm not fan of this tool so I prefer using an external USB to UART dongle to avoid this issue, with this solution I can use any serial termnal program because dongle RTS & DTR pins are not connected to ESP pins.

Hope this will help someone !
Yes this helped me a lot.

I use the program picocom to disable flow control and that already helps me a bit further.

Code: Select all

picocom /dev/ttyUSB0 -b 115200 --lower-rts --lower-dtr 
I still see the following errors coming by after flashing to address 0x10000. I use a NodeMCU with ESP32-C3-32S.

Code: Select all

invalid header: 0xffffffff
invalid heade�ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4004d1f8
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff

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

Re: Micropython on ESP32-C3

Post by reppad » Tue Jan 04, 2022 2:35 pm

Hi jhaand,

ESP32-C3 (RISC-V) has a different memory layout than ESP32-S series (Xtensa), it should be flashed at address 0x0 instead of 0x1000.
(I'm guessing 0x10000 in your post is a typo)
jhaand wrote:
Tue Jan 04, 2022 1:35 pm
I still see the following errors coming by after flashing to address 0x10000. I use a NodeMCU with ESP32-C3-32S.

Code: Select all

invalid header: 0xffffffff
In general when you see 0xffffffff it means the memory is empty at address read (= full of 1)

See: viewtopic.php?f=18&t=11025#p62411

Post Reply