PlatformIO: Cannot compile for Seeed Studio XIAO ESP32C3 because of missing soc/sens_reg.h

Works like a charm, thanks @1technophile !
For anyone that should be interested, here’s a working _env.ini for Seeed Studio XIAO ESP32C3 (basically, what @1technophile posted minus the Neopixel part that is not available on this module):


[platformio]
default_envs = esp32c3-dev-m1-ble

[env:esp32c3-dev-m1-ble]
	platform = ${com.esp32_c3_s3_platform}
	board = esp32-c3-devkitm-1
	board_build.partitions = min_spiffs.csv
	lib_deps =
	  ${com-esp.lib_deps}
	  ${libraries.wifimanager32}
	  ${libraries.ble}
	  ${libraries.decoder}
	  ${libraries.fastled}

	build_flags =
	  ${com-esp.build_flags}
	  '-DZgatewayBT="BT"'
	  '-DNO_INT_TEMP_READING=true' ; Internal temperature reading not building on ESP32 C3 or S3
custom_description = BLE gateway on the Seeed Studio XIAO ESP32C3
1 Like

Is it stable with the c3?

I’ve just put it up briefly, and so far it is working.
What should I look for? Hangs or reboots? (the first being easy to detect, less for reboots)

Reboots mainly, as I had instability with my m5stamp c3

I suppose that your C3 doesn’t have an RGB led ?
If not, the instability that we are seeing on other boards are due to the RGB management.

I’m using a Seeed XIAO C3
(really exciting board: cheap, has integrated battery charging circuit, great BLE/Wifi reception and it is also the smallest dev board around) (but no rgb)

You can see a couple of photos here
https://community.openmqttgateway.com/t/shocking-discovery-about-antenna-quality-of-esp32-modules/2228

So far no reboot, (at least judging by the “uptime” counter on SYStoMQTT topic)
I’ll keep an eye on it and report here

1 Like

I am new to OpenMQTTGateway and I am very impressed by its quality of documentation. It helped me to get a Seed Studio XIAO ESP32C3 running, leds and button external. I wrote a prod_env.ini based on the airm2m_core_esp32c3 environment, gpio pins changed. The XIAO is running rock solid.

2 Likes

It would be cool to publish this environment. Do you mind sharing it?

Ok here is my prod_env.ini:

[platformio]
default_envs = seeed_xiao_esp32c3

[env:seeed_xiao_esp32c3]
platform = ${com.esp32_c3_s3_platform}
board = seeed_xiao_esp32c3
board_build.partitions = min_spiffs.csv
monitor_speed = 115200
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.ble}
  ${libraries.decoder}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DLED_SEND_RECEIVE=10' ; GPIO: 2 - 10, 20, 21
  '-DLED_INFO=8'
  '-DLED_ERROR=9'
  '-DTRIGGER_GPIO=7'
  '-DNO_INT_TEMP_READING=true' ; Internal temperature reading not building on ESP32 C3 or S3
  '-DGateway_Name="OMG_xiao_c3.1"'
custom_description = BLE gateway on Xiao C3
custom_hardware = Seed XIAO ESP32C3 dev

Note, the Seed XIAO ESP32C3 has only a single power led.

2 Likes

@mrickma : I read your code and comment: you reference a number of LEDs, but as you say, this board has only one… what is the GPIO address of the onboard one? Thanks :slight_smile:

@1technophile: I would be pleased! You can publish everything which I post here under a open-source license without asking.
@ilgrank: I do not know at the moment. I guess it is either 0 or 1. The board sends errors when you set the pinMode for a GPIO not present.

1 Like

@1technophile : Alas, it seems you were right about instability. Today it was the first day I’ve put the C3 (running 1.4.0) in place of the previous ESP32 (running 1.2.0)

It ran fine for 6966 seconds, and then stopped responding.
Alas, it is in a remote location and it does not respond to MQTT restart commands, I’ll have to investigate further when I get back to it

btw, its last message in OpenMQTTGateway/SYStoMQTT had these values:
(showing just the ‘interesting’ ones)

"uptime":6966
"freemem":121140
"freestack":3348
"lowpowermode":-1
"interval":55555
"intervalcnct":3600000
"scnct":106
"modules":["BT"]

with freemem actually slightly growing over time and freestack staying constant after boot:


so I think this might not be a memory leak , nor a problem with the RGB LED Library after all?

Boards can restart after a few hours, we are suspecting a conflict between the wifi and ble coexistence but haven’t found the root cause yet. For example my Olimex Ethernet gateway is rock solid and nerver restart.
But on my regular ESP32 they never stay stuck.
I need to put my C3 sitting longer.

What was the configuration used when he got stuck?

My guess was wrong. I could not switch the on board led of the Seed C3 using GPIO. Then I looked into the Seeed Studio XIAO ESP32C3 schematic and found the led integrated into some power supply circuit but not connected to any GPIO of the C3. So I think that it can not be used for OMG led output.

@ilgrank:
In a different thread argafal and I have exchanged C3 experiences. argafal has a Lolin C3 mini v2.1.0 board. There were three problems,

  1. terrible slowdown by overrun of serial output
  2. complete crash
  3. random reboots

The slowdown was fixed by suppressing serial logging when our boards were not connected to a terminal. For me it also decreased frequency of reboots in that situation.
Complete crashes could be avoided by changing OMG’s standard ${com.esp32_c3_s3_platform} to a newer version. After using espressif32@5.3.0 and newer we had no more complete crash.
argafal is still suffering from occasional reboots. In contrast my Seed C3 is running pretty stable now: “uptime”:84483 without serial connection and logging, “uptime”:48007 with logging and serial connection enabled. In both cases I stopped the C3 manually.
I repost my current configuration because it belongs into this thread:

; Custom configuration file for the Seed XIAO ESP32C3 dev
; Wed, 01 Mar 2023 20:10:45 +0100
;
; Currently there were two problems
; 1.  In long term runs ESP32C3 terminate with an assert failure.
;     Therefore the standard platform is overridden with a currently newer one.
;     One may have to repeat Wifi and MQTT configuration after changing platform.
; 2.  Serial output if no terminal is connected slows down everything else.
;     For this situation chose the xxx_no_serial variant for default_envs.
; -------------------------------------------------------------------------

[platformio]
default_envs = seeed_xiao_esp32c3

[env:seeed_xiao_esp32c3]
;platform = ${com.esp32_c3_s3_platform} ; standard, problems
platform = espressif32@5.3.0  ; override
board = seeed_xiao_esp32c3
board_build.partitions = min_spiffs.csv
monitor_speed = 115200
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.ble}
  ${libraries.decoder}
build_flags =
  ${com-esp.build_flags}
  '-DZgatewayBT="BT"'
  '-DLED_SEND_RECEIVE=10' ; GPIO: 2 - 10, 20, 21
  '-DLED_INFO=8'
  '-DLED_ERROR=9'
  '-DTRIGGER_GPIO=7'
  '-DNO_INT_TEMP_READING=true' ; No internal temperature on ESP32 C3 or S3
  '-DGateway_Name="OMG_xiao_c3.1"'
custom_description = BLE gateway on Xiao C3
custom_hardware = Seed XIAO ESP32C3 dev

[env:seeed_xiao_esp32c3_no_serial]
extends = env:seeed_xiao_esp32c3
build_flags =
  ${env:seeed_xiao_esp32c3.build_flags}
  '-DLOG_LEVEL=LOG_LEVEL_SILENT'  ; shut up
  '-DWM_DEBUG_LEVEL=0'

Give it a try.

1 Like

I was posting my current config when I noticed that while I had removed the LEDs from the build flags, I had forgotten to remove ${libraries.fastled} :man_facepalming:
So I have recompiled just now with this config:

[platformio]
default_envs = esp32c3-dev-m1-ble

[env:esp32c3-dev-m1-ble]
	platform = ${com.esp32_c3_s3_platform}
	board = esp32-c3-devkitm-1
	board_build.partitions = min_spiffs.csv
	lib_deps =
	  ${com-esp.lib_deps}
	  ${libraries.wifimanager32}
	  ${libraries.ble}
	  ${libraries.decoder}
	 

just wanted to give the no-fastled esp32c3-dev-m1-ble config a try before trying @mrickma config (btw: Thanks for your config, going to try it soon!)

While waiting to try your config (again, thanks!) I wanted to point that while I came to the same conclusion as you for the red LED (i.e., that it is hardwired to the charging circuit, and not* to a GPIO), there’a line in the official docs that seems to suggest otherwise:

The XIAO ESP32C3 will not have any LED on when it is battery powered (unless you have written a specific program), please do not judge whether the XIAO ESP32C3 is working or not by the condition of the LED, please judge it reasonably by your program.

…that’s why I had hope to be able to control it (or at lest turn it off :slight_smile: )

Just a quick update: after removing ${libraries.fastled}, I’m at more than 56000 seconds of uptime, and no sign of hangs or reboots so far! Hurray! :star_struck:
(strangely, I always experienced hangs and not reboots as @1technophile described)

I do still plan to experiment with turning off as much as unnecessary (serial logging) as possible, in order to consume as little power as possible (being that the system runs on solar-powered batteries), so I will do some more test on this matter…

1 Like

If you don’t need continuous scanning you could also activate the low power mode

Feel free to open a new thread if you have questions about low power

Thanks @1technophile , in fact I was going a little too OT here :slight_smile:

Another update: the C3 arrived at 57490 seconds of uptime (roughly 16 hours) and then hang again.
Now trying @mrickma suggestions :slight_smile:

Of course, I’ll have to wait for 16+ hours to tell if it has solved the problem or not, but for now I can tell the average power consumption stayed the same (usually, this is a good indicator of “how much stuff is going on”) at roughly 75mA