Problems with light sleep, monitoring and battery power on XIAO ESP32-C6

I have developed a very simple Matter over Thread project, using esp-idf and esp-matter, by combining the generic_switch and icd_app examples. It works really well on an ESP32-H2 dev kit board, with a draw of 2.5mA (higher than I’d like, but I’m an amateur and it works!)

I’m a big fan of the XIAO board, so figured I’d try the C6, which has the same Thread support as the H2.

This is where my problems began!

Flashing the board is very problematic. Most of the time I have to hold boot and click reset before I can flash the using idf.py. I don’t know if this is down to the light sleep or what, but it’s very annoying!

When my code is running, the idf.py monitor keeps giving me this message:

“Error - device reports readiness to read but returned no data (device disconnected or multiple access on port?)”

The code is running in as I’m able to find the device using iOS HomeKit and pair into the Thread network. The momentary switch code I’ve written is also working. It just makes debugging very difficult!!

Lastly, the power draw from a battery seems very strange. When I use my multimeter on the H2, the draw is a steady 2.5mA. When I try the same battery on the C6, the reading hops around between 80mA and 57mA in a random fashion. Booting up perhaps?

Is there anything special I need to do to make the C6 work with a battery??

This has been a frustrating experience. Compared to developing with the C3 anyway!

Any advice or insights is welcome!

Hi there,

So I would recommend one of the Sleep Demo’s on here and test that. If your using the Serial port care must be taken, it will drop the port as it sleeps. FYI I think the dem I did on here got it down to 44ish ua in sleep. Also I don’t think it’s apples to apples to compare the H2 to C6 just saying the silicon is very different and some features are not present.

What file system partitions size are you using?

Post up the code , using the code tags above “</>” and others will comment as well.
HTH
GL :slight_smile: PJ :v:

1 Like

Thanks,

I guess the comparison to the H2 was to indicate the code worked as expected on it.

I’m using the USB connection for the idfy.py monitor. On the H2 this worked fine and it never dropped, hence the source of my initial confusion.

I started with the esp-matter icd_app example, using the c6 defaults

The partitions.csv is this

# Name,   Type, SubType, Offset,  Size, Flags
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
esp_secure_cert,  0x3F, ,0xd000,    0x2000, encrypted
nvs,      data, nvs,     0x10000,   0xC000,
nvs_keys, data, nvs_keys,,          0x1000, encrypted
otadata,  data, ota,     ,          0x2000
phy_init, data, phy,     ,          0x1000,
ota_0,    app,  ota_0,   0x20000,   0x1E0000,
ota_1,    app,  ota_1,   0x200000,  0x1E0000,
fctry,    data, nvs,     0x3E0000,  0x6000

When running off the USB connection, it does work as expected, but I will investigate the the XIAO Sleep samples. I will also setup by bench supply in case the battery is the problem.

I’m hoping to get the sleep draw down under 1mA at least (the capacitive button I’m using draws 1mA by itself and I’d like 6month battery life, so every little helps)

Hi there,

AOK, Looks correct… I have seen b4 the size of the partition be the culprit but sounds like your power could be at issue as well under low battery. If you don’t need OTA , opt for the bigger partition for the App.
I like the Battery life calculator from DigiKey Here. really slick for getting a grip on the Life.

I was able to down Size my Battery and shed some size and weight all while extending my run time by 28 days :+1: @msfujino has the Sleep and wake Power 411 on Lock for pretty much all the Xiao family. Check his test data threads Very good info their too! His system on Sleep threads a good starting point.
a few good tweaks can make all the difference.

HTH
GL :slight_smile: PJ :v:

1 Like

Turns out to user error :slight_smile:

Firstly, the battery in my multi-meter was low, leading to crazy readings and secondly, the current draw was so small, that the multi-meter was so small that I think the C6 just kept restarting. Once I moved to the 10A jack, the C6 appeared on Bluetooth and was available for commissioning.

It’s now working perfectly.

My multi meter just shows 2mA as I think that’s the lowest resolution it has, so I suspect the sleep current is actually tiny. When I toggle the GPIO button, it jumps, before dropping back down. I think I need a better multi meter :slight_smile:

Thanks for the pointers @PJ_Glasso

1 Like

Hi there,

Awesome, Nice work… :+1: I’m certain you can shrink the total power over the current battery life with some of those sleep enhancements. worth looking at. Glad you got it sorted way to stay on the horse and not get discouraged as many do. :muscle::smile:

GL :slight_smile: PJ :v:

Thanks. No point in throwing in the towel. Never learn anything that way :slight_smile: