Skip to content

Commit fb3a009

Browse files
cateimjgriffiths
authored andcommitted
power: release PMU devices before deleting the i2c bus on M5CoreS3
Since ESP-IDF v5.5 i2c_del_master_bus() refuses to delete a bus that still has devices attached and returns ESP_ERR_INVALID_STATE. On the M5CoreS3, power_init() attaches the axp2101 and aw9523 devices and then deletes the bus without releasing them, so under IDF 5.5.4 the deinit fails, power_init() propagates the error and the JADE_ASSERT in main.c aborts the boot. Same root cause as the touchscreen fix in the previous commit (#306). Remove both devices from the bus before deleting it. Not tested on hardware (none available); the change mirrors the touchscreen fix validated on the Waveshare S3 Touch LCD 2.
1 parent 36776fe commit fb3a009

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

main/power/m5stackcores3.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ esp_err_t power_init(void)
4848
axp2101_init();
4949

5050
vTaskDelay(100 / portTICK_PERIOD_MS);
51+
// Since IDF 5.5 the i2c bus cannot be deleted while devices are still attached
52+
I2C_CHECK_RET(i2c_master_bus_rm_device(axp2101));
53+
I2C_CHECK_RET(i2c_master_bus_rm_device(aw9523));
5154
I2C_CHECK_RET(_i2c_deinit(NULL));
5255

5356
return ESP_OK;

0 commit comments

Comments
 (0)