0

Problem on ESP32-S3 LC709203
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problem on ESP32-S3 LC709203

by steve_s on Wed May 25, 2022 12:40 pm

I am having an issue with connecting to the onboard LC709203 .

(Esp32-S3 Link
https://circuitpython.org/board/adafrui ... 3_nopsram/)

From the link above, LiPoly battery monitor - LC709203 chip actively monitors your battery for voltage and state of charge / percentage reporting over I2C. I can't seem to get the I2C to find the module, running the scan i2c addresses show that there is something at 0xb however, I2C says it is empty. Scan code says there is something at 0xb.

Using:
adafruit-circuitpython-bundle-7.x-mpy-20220524.zip
adafruit-circuitpython-adafruit_feather_esp32s3_nopsram-en_US-7.3.0.uf2

I don't know if I am doing something completely wrong OR I found a hardware or software bug . Code and Output follows below.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Code from esp32-s2 that I am attempting to use on the esp32-s3 feather
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: Unlicense
"""
CircuitPython Simple Example for BME280 and LC709203 Sensors
"""
import time
import board
#from adafruit_bme280 import basic as adafruit_bme280
from adafruit_lc709203f import LC709203F, PackSize

from adafruit_bme280 import basic as adafruit_bme280
from adafruit_lc709203f import LC709203F, PackSize

# Create sensor objects, using the board's default I2C bus.
i2c = board.I2C()

# bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
battery_monitor = LC709203F(board.I2C())
battery_monitor.pack_size = PackSize.MAH400
'''
# change this to match your location's pressure (hPa) at sea level
#bme280.sea_level_pressure = 1013.25
'''
while True:
'''
print("\nTemperature: {:.1f} C".format(bme280.temperature))
print("Humidity: {:.1f} %".format(bme280.relative_humidity))
print("Pressure: {:.1f} hPa".format(bme280.pressure))
print("Altitude: {:.2f} meters".format(bme280.altitude))
'''
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
time.sleep(2)

OUTPUT FROM ABOVE
*********************************************************************************

Error shown in repl, The same problem occurs for the bme280 at a different address
code.py output:
Traceback (most recent call last):
File "code.py", line 18, in <module>
File "adafruit_lc709203f.py", line 117, in __init__
ValueError: No I2C device at address: 0xb

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

*********************************************************************************


Code to scan the i2c addresses in use
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""CircuitPython I2C Device Address Scan"""
# If you run this and it seems to hang, try manually unlocking
# your I2C bus from the REPL with
# >>> import board
# >>> board.I2C().unlock()

import time
import board

# To use default I2C bus (most boards)
i2c = board.I2C()

# To create I2C bus on specific pins
# import busio
# i2c = busio.I2C(board.SCL1, board.SDA1) # QT Py RP2040 STEMMA connector
# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040

while not i2c.try_lock():
pass

try:
while True:
print(
"I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()],
)
time.sleep(2)

finally: # unlock the i2c bus when ctrl-c'ing out of the loop
i2c.unlock()

OUTPUT FROM ABOVE
******************************************************
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
I2C addresses found: ['0xb']
I2C addresses found: ['0xb']
I2C addresses found: ['0xb']
Traceback (most recent call last):
File "code.py", line 31, in <module>
KeyboardInterrupt:

******************************************************
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks for your assistance.
Steve Schaefer

steve_s
 
Posts: 24
Joined: Fri Aug 10, 2012 4:31 pm

Re: Problem on ESP32-S3 LC709203

by mikeysklar on Wed May 25, 2022 8:12 pm

Can you post a photo of your setup? How you connected the ESP32-S3 to the LC709203 and any soldering you might have done.

Is there BME280 also on the i2c bus when running the LC709203 code?

mikeysklar
 
Posts: 7752
Joined: Mon Aug 01, 2016 8:10 pm

Re: Problem on ESP32-S3 LC709203

by steve_s on Thu May 26, 2022 8:42 am

I think there is a misunderstanding here. I am trying to access the LC709203 that is built into the board. I have nothing wired other than the usb connector that is plugged in.

see Feather ESP32-S3 No PSRAM (https://circuitpython.org/board/adafrui ... 3_nopsram/)

LiPoly battery monitor - LC709203 chip actively monitors your battery for voltage and state of charge / percentage reporting over I2C

Thanks
Steve Schaefer

steve_s
 
Posts: 24
Joined: Fri Aug 10, 2012 4:31 pm

Re: Problem on ESP32-S3 LC709203

by mikeysklar on Thu May 26, 2022 4:34 pm

Steve,

Thank you for the clarification about he LC709203 being onboard.

Engineering has been investigating an issue with the ESP32-S3 using this battery monitor.

https://github.com/adafruit/circuitpython/issues/6311

You might have some intermittent success dropping the i2c speed down to 10kHz.

Code: Select all | TOGGLE FULL SIZE
i2c = I2C(SCL, SDA, frequency=10000)

mikeysklar
 
Posts: 7752
Joined: Mon Aug 01, 2016 8:10 pm

Re: Problem on ESP32-S3 LC709203

by steve_s on Thu May 26, 2022 5:13 pm

I guess I will have to wait for a fix with this part. 1/3 of why I wanted to switch to this board.

I wanted to move my application from the rp2040 feather. I have another issue that I do not think there is currently a solution for. My application sends data to a sever using sockets, which I can do with the socketpool, however socketpool does not appear to allow me to setup a socket just to listen to.

I could do this fine on the rp2040 using the external esp32 board
I can not figure out a way to set up a socket using the ESP32-SPI with the onboard esp32, so that I can monitor to see if it has received a message.
I can not figure out how to create a socket without using :

# Initialize esp
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset),

I can't figure how to bypass the pins here.
esp32_ready = digitalio.DigitalInOut(board.D11)
esp32_cs = digitalio.DigitalInOut(board.D12)
esp32_reset = digitalio.DigitalInOut(board.D10)

is there some internal reference I can use in replacement of these pins?

Thanks again for you assistance.
Steve Schaefer

steve_s
 
Posts: 24
Joined: Fri Aug 10, 2012 4:31 pm

Re: Problem on ESP32-S3 LC709203

by mikeysklar on Thu May 26, 2022 5:23 pm

Steve,

Please paste the socketpool question into a new thread as it is not related to the i2c LC709203F issue.

mikeysklar
 
Posts: 7752
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.