r/esp32 • • 4d ago

Software help needed Weird ESP error message

I'm using an ESP32-N16-R8 and getting the following errors during the setup section of my code:

I'm using two separate I2C buses with independent SDA and SCL pin pairs. The second error mainly occurs in the MAX17048 section.

Interestingly, everything seems to work fine, and I'm not noticing any issues with data acquisition.

I'm curious about why these errors are appearing despite everything seemingly working correctly.

2 Upvotes

7 comments sorted by

4

u/n_sh_44 4d ago

Those two errors usually come from the same cause. The duplicate addApbChangeCallback message appears when Wire.begin() runs twice on the same I2C port, and a lot of sensor libraries call Wire.begin() inside their own begin(), which defaults to the first bus. If your MAX17048 sits on the second bus, the library is probably talking to Wire with nothing attached and that gives the requestFrom error -1, which is a NACK or no device. I'd check whether your library lets you pass the bus, for example begin(Wire1) or a TwoWire pointer, and make sure each bus gets its begin(sda, scl) call only once. To confirm, run a quick I2C scanner on each bus and see which one actually shows 0x36 for the MAX17048. Also check that both buses have pull-ups.

1

u/Humble_Bit_4998 4d ago

Will surely check the flow, but 0x36 is coming in second wire and I am calling Wire1.begin still this error message comes

2

u/AdCompetitive1256 4d ago

:thumbs up:

OP, ^ this here is the right answer.

3

u/pmuschi 4d ago

Have you tried a search engine? I got good results for both errors using Google

1

u/Humble_Bit_4998 4d ago

I already researched those but the result did not work and the documentation on the errors are good but I couldn't understand

2

u/pmuschi 4d ago

Google told me that the first error is due to reinitializing a device or a bus that is already initialized. 

The second error is likely a SPI timeout, either due to improper termination, different ground voltages, or your wires are too long.

1

u/Humble_Bit_4998 4d ago

[E][esp32-hal-cpu.c:110] addApbChangeCallback(): duplicate func=0x420c9240 arg=0x3fc9a61c

[E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1

Sorry I don't know why I couldn't add this error message