cannot access devices on second i2c bus (grove port) on m5stickc after rebooting. Can successfully read bus after the first flash, but then cannot read the bus after subsequent boots
log after first boot after flash
Leaving...
Hard resetting via RTS pin...
================================================================================ [SUCCESS] Took 13.69 seconds ================================================================================
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[14:09:19]\xff[I][logger:170]: Log initialized
[14:09:19][I][app:029]: Running through setup()...
[14:09:19][V][app:030]: Sorting components by setup priority...
[14:09:19][V][esp32-hal-i2c.c:1484] i2cInit(): num=0 sda=32 scl=33 freq=0
[14:09:19][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:09:19][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:09:19][V][esp32-hal-i2c.c:1484] i2cInit(): num=1 sda=21 scl=22 freq=0
[14:09:19][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[14:09:19][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:09:19][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=50000Hz
[14:09:19][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=50000Hz
[14:09:19][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:09:19][D][binary_sensor:034]: '${upper_devicename} Button A': Sending initial state OFF
[14:09:19][C][light:097]: Setting up light '${upper_devicename} Led'...
[14:09:19][VV][preferences:038]: LOAD 0: valid=YES, 0=0x00000001 1=0x3F800000 (Type=600188935, CRC=0x6CDD94DB)
[14:09:19][D][light:265]: '${upper_devicename} Led' Setting:
[14:09:19][D][light:274]: State: ON
[14:09:19][D][light:278]: Brightness: 100%
[14:09:19][VV][preferences:051]: SAVE 0: 0=0x00000001 1=0x3F800000 (Type=600188935, CRC=0x6CDD94DB)
[14:09:19][C][esp32_ble_beacon:040]: Setting up ESP32 BLE beacon...
[14:09:19][C][bmp280.sensor:056]: Setting up BMP280...
[14:09:19][VV][i2c:056]: Beginning Transmission to 0x76:
[14:09:19][VV][i2c:093]: Writing 0b11010000 (0xD0)
[14:09:19][VV][i2c:061]: Transmission ended. Status code: 0x00
[14:09:19][VV][i2c:083]: Requesting 1 bytes from 0x76:
[14:09:19][VV][i2c:113]: Received 0b01011000 (0x58)
[14:09:19][VV][i2c:056]: Beginning Transmission to 0x76:
[14:09:19][VV][i2c:093]: Writing 0b10001000 (0x88)
[14:09:19][VV][i2c:061]: Transmission ended. Status code: 0x00
[14:09:20][VV][i2c:083]: Requesting 2 bytes from 0x76:
[14:09:20][VV][i2c:126]: Received 0b1010111001101101 (0xAE6D)
[14:09:20][VV][i2c:056]: Beginning Transmission to 0x76:
[14:09:20][VV][i2c:093]: Writing 0b10001010 (0x8A)
[14:09:20][VV][i2c:061]: Transmission ended. Status code: 0x00
[14:09:20][VV][i2c:083]: Requesting 2 bytes from 0x76:
[14:09:20][VV][i2c:126]: Received 0b1011000101100110 (0xB166)
[14:09:20][VV][i2c:056]: Beginning Transmission to 0x76:
after second reboot
[14:11:43]\xff[I][logger:170]: Log initialized
[14:11:43][I][app:029]: Running through setup()...
[14:11:43][V][app:030]: Sorting components by setup priority...
[14:11:43][V][esp32-hal-i2c.c:1484] i2cInit(): num=0 sda=32 scl=33 freq=0
[14:11:43][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=100000Hz
[14:11:43][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[14:11:43][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:11:43][W][esp32-hal-i2c.c:1411] i2cCheckLineState(): invalid state sda(32)=0, scl(33)=0
[14:11:43][E][esp32-hal-i2c.c:1426] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=0, scl=0
[14:11:43][V][esp32-hal-i2c.c:1484] i2cInit(): num=1 sda=21 scl=22 freq=0
[14:11:43][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=100000Hz
[14:11:43][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=100000Hz
[14:11:43][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:11:43][V][esp32-hal-i2c.c:1680] i2cSetFrequency(): freq=50000Hz
[14:11:43][V][esp32-hal-i2c.c:1696] i2cSetFrequency(): cpu Freq=240Mhz, i2c Freq=50000Hz
[14:11:43][V][esp32-hal-i2c.c:1704] i2cSetFrequency(): Fifo delta=1
[14:11:43][D][binary_sensor:034]: '${upper_devicename} Button A': Sending initial state OFF
[14:11:43][C][light:097]: Setting up light '${upper_devicename} Led'...
[14:11:43][VV][preferences:038]: LOAD 0: valid=YES, 0=0x00000001 1=0x3F800000 (Type=600188935, CRC=0x6CDD94DB)
[14:11:43][D][light:265]: '${upper_devicename} Led' Setting:
[14:11:43][D][light:274]: State: ON
[14:11:43][D][light:278]: Brightness: 100%
[14:11:43][VV][preferences:051]: SAVE 0: 0=0x00000001 1=0x3F800000 (Type=600188935, CRC=0x6CDD94DB)
m5stickc.yaml
esphome:
name: m5stickc
platform: ESP32
board: m5stick-c
includes:
- custom_components/axp192/axp192.h
#- custom_components/st7735/st7735.h
platformio_options:
# upload_speed: 230400
# upload_speed: 115200
upload_speed: 1500000
#captive_portal:
# Enable logging
logger:
# level: DEBUG
level: VERY_VERBOSE
# Enable Home Assistant API
# api:
# password: !secret ha_api_pw
# ota:
# password: !secret ota_pw
binary_sensor:
- platform: gpio
pin:
number: GPIO37
inverted: true
name: ${upper_devicename} Button A
on_release:
then:
- light.toggle: led1
# internal LED
light:
- platform: monochromatic
output: builtin_led
name: ${upper_devicename} Led
id: led1
output:
- platform: ledc
pin: 10
inverted: true
id: builtin_led
esp32_ble_beacon:
type: iBeacon
uuid: '75febca7-0081-4201-b1f1-4a84d05d9f43'
i2c:
- id: bus_a
sda: 32
scl: 33
frequency: 100khz
scan: True
- id: bus_b
sda: 21
scl: 22
scan: True
sensor:
- platform: axp192
setup_priority: 200
address: 0x34
i2c_id: bus_b
update_interval: 30s
battery_level:
name: "M5Stick Battery Level"
id: "m5stick_batterylevel"
- platform: bmp280
i2c_id: bus_a
address: 0x76
update_interval: 10s
temperature:
name: "BMP280 Temperature"
oversampling: 16x
pressure:
name: "Pressure"
- platform: sht3xd
i2c_id: bus_a
address: 0x44
update_interval: 10s
temperature:
name: "SHT3xD Temperature"
humidity:
name: "Living Room Humidity"
line 6 - M5StickC.h which runs fine and i2c bus works fine after each reboot.
m5stickc esphome custom component to initialise the axp192:
[https://github.com/airy10/esphome-m5stickC/tree/master/components/axp192] esphome
similar issue: [esphome/issues#1132]