u/public_void_kee

Custom PCB- unable to initialize fuel gauge and accelerometer
▲ 3 r/circuitpython+2 crossposts

Custom PCB- unable to initialize fuel gauge and accelerometer

Hi all,

I had custom PCBs designed and fabricated using an ESP32-S3-WROOM-1 and various Adafruit components. However, I'm getting errors when trying to initialize the fuel gauge (MAX17048G+T10) and accelerometer (LSM6DS3TR):

"Gauge Init Failed: No I2C device at address: 0x36

IMU Init Hard Fail: Failed to find LSM6DS3 - check your wiring!"

I'm using CircuitPython 10.2.1. I will attach some schematic screenshots and my initialization code. I've tried adjusting the I2C frequency and using bitbangio with no luck. The RTC seems to be working fine. Can anyone tell me if this is a software issue, or if the hardware is defective?

Thanks!

https://preview.redd.it/gonigcmu6g9h1.png?width=742&format=png&auto=webp&s=5bf567c37cb31ff77fb754c5972e135555237aab

https://preview.redd.it/cgf8p8zw6g9h1.png?width=388&format=png&auto=webp&s=691afd3d833e37aed15440d8b4d451e8c67add76

https://preview.redd.it/s54gbdkz6g9h1.png?width=511&format=png&auto=webp&s=e48970f46f8cf611eeb59a8c8519b96be518d74d

https://preview.redd.it/qws18w827g9h1.png?width=253&format=png&auto=webp&s=2ee5cad1b258bce9216207d66adb2e6e612c8a18

import
 gc
import
 struct
import
 array
import
 microcontroller
import
 board
import
 displayio
import
 time
import
 math
import
 random
import
 terminalio
import
 digitalio
import
 pwmio
import
 neopixel
import
 touchio
import
 busio
import
 adafruit_st7789
from
 adafruit_display_text 
import
 label
from
 adafruit_lsm6ds.lsm6ds3 
import
 LSM6DS3
import
 adafruit_ds3231
import
 adafruit_max1704x
from
 micropython 
import
 const



try
:
    i2c 
=
 busio.I2C(I2C_SCL, I2C_SDA, 
frequency
=
50000)
    print("I2C bus initialized successfully.")
except
 
Exception
 
as
 e:
    print("I2C Bus Init Error:", e)
    i2c 
=
 None


# Pre-define variables
battery_monitor 
=
 None
imu 
=
 None
ds3231 
=
 None


if
 i2c:
    # --- Battery Gauge ---
    
try
:
        battery_monitor 
=
 adafruit_max1704x.MAX17048(i2c)
    
except
 
Exception
 
as
 e:
        print("Gauge Init Failed:", e)


    # --- RTC ---
    
try
:
        ds3231 
=
 adafruit_ds3231.DS3231(i2c)
    
except
 
Exception
 
as
 e:
        print("RTC Init Failed:", e)


    # --- IMU (Strict Locked Access & Soft Reset) ---
    
try
:
        
while
 
not
 i2c.try_lock():
            
pass
        # Soft Reset
        i2c.writeto(
0x
6A, 
bytes
([
0x
12, 
0x
01]))
        time.sleep(0.2)
        # Wake-up
        i2c.writeto(
0x
6A, 
bytes
([
0x
10, 
0x
40])) 
        i2c.unlock()
        time.sleep(0.1)
        # Initialize
        imu 
=
 LSM6DS3(i2c, 
address
=
0x
6A)
        print("IMU Initialized Successfully!")
    
except
 
Exception
 
as
 e:
        
try
: i2c.unlock()
        
except
: 
pass
        print("IMU Init Hard Fail:", e)
        imu 
=
 None
else
:
    print("Skipping peripherals: I2C bus failed.")
reddit.com
u/public_void_kee — 11 days ago