sparkfun / SparkFun_Thing_Plus_ESP32_WROOM_C

ESP32-WROOM Thing Plus with USB-C.
https://docs.sparkfun.com/SparkFun_Thing_Plus_ESP32_WROOM_C/
Other
5 stars 5 forks source link

FuelGauge does not work #1

Closed fdahms closed 1 year ago

fdahms commented 1 year ago

Hi,

this sketch is not working for me. If you set the right adress, it will work.

SFE-Brudnerd commented 1 year ago

Hi @fdahms,

Please ensure you're using the correct variant file with your sketch.

https://github.com/espressif/arduino-esp32/blob/master/variants/esp32thing_plus_c/pins_arduino.h

The I2C pins are set correctly in this variant file, and successfully are able to talk to the MAX17048. While there are no external pull ups on the board, the ESP32 sets the I2C pins as pull-ups on initialization, and support an I2C speed of 100kHz, which is what this sketch was tested with. I did not test with 400kHz, however with the bus capacitance given in the datasheet and pull-up resistor value, it should still work. I used this as a calculation reference.

https://www.ti.com/lit/an/slva689/slva689.pdf

Additionally, in your commit you're not changing the address that the sketch is using to look for the MAX17048. Instead, you're defining which pins to use and at what speed. Finally, the MAX17048 supports a maximum I2C speed of 400kHz, so it may not work correctly when setting the speed to 1MHz as you've done.