nPM1300's ADC readings always return zero

Hello everyone,

My project consists on using the nPM1300 with ESP32-S3 on a custom board. I2C connection is pretty much validated, since I have already configured some features such as: button debounce for SHIP mode, entering SHIP mode, reading SHPHLD status, current limit on VBUS at start up, etc.

I tried almost every possible way to get a simple ADC reading, but the results are always zero no matter what I try measuring. I checked the hardware and VBAT, VBUS and VSYS voltages are certainly there.

Some examples of what I tried so far:

1 - cleared EVENTSADCCLR register completely --> triggered TASKVSYSMEASURE --> waited for EVENTSADCSET (ID = D) to trigger on its own --> read ADCVSYSRESULTMSB, and ADCGP0RESULTLSBS (considering only ID = D value); both of them always return zero.

2 - cleared EVENTSADCCLR register completely --> triggered TASKVBUS7MEASURE --> waited for EVENTSADCSET (ID = H) to trigger on its own --> read ADCVBAT3RESULTMSB, and ADCGP1RESULTLSBS (considering only ID = D value); both of them always return zero.

3 - cleared EVENTSADCCLR register completely --> configured ADCCONFIG to single measurement when triggered, single measurement (by writing 0x00 to this register) --> triggered TASKVBATMEASURE --> waited for EVENTSADCSET (ID = A) to trigger on its own --> read ADCVBATRESULTMSB, and ADCGP0RESULTLSBS (considering only ID = A value); both of them always return zero.

4 - cleared EVENTSADCCLR register completely --> configured ADCCONFIG to measure VBAT every 1s, single measurement (by writing 0x01 to this register) --> waited for EVENTSADCSET (ID = A) to trigger on its own --> read ADCVBATRESULTMSB and ADCGP0RESULTLSBS (considering only ID = A value); both of them always return zero.

All of these steps were tested in both an infinite loop, and as a single execution throughout the application's code.

Does anyone have any clue of why the ADC never returns an actual reading? I would appreciate any tip or insight you can give.

Best regards,

Lucas

Parents Reply Children
  • Hi Kazi

    Thanks for your reply. I checked the I2C communication using a logic analyzer and found out my calculations for the offset value of the register were incorrect. I was reading the wrong registers after all:

    ADCVBATRESULTMSB (0x511): base address = 0x5; offset = 0x11

    ADCGP0RESULTLSBS (0x515): base address = 0x5; offset = 0x15

    Thank you again for your time, the ADC readings now work as intended.

    Best regards,

    Lucas

    Giving some tips for future developers: store the register's address in a 16bit variable: the 8 LSBs bits are your offset value; the 8 MSBs are your base address, but you can ignore the 4 MSBs as every base address used by nPM1300 only uses 4 bits

Related