Nrf9160: Battery ADC measurement off by ~100 mv

I'm getting a strange amount of error when trying to measure the battery for a custom PCB based on the nrf9160.

Details

  • My VCC_IO is 1.8V
  • My max battery voltage is 4.2V
  • I am using a slightly modified version of the battery sample from zephyr/samples/boards/nrf/battery.
    • I'm using a switch controlled voltage divider, where R1 is 3.01k and R2 is 2.0k

    • I am measuring the analog levels on adc line, the battery voltage going into the divider, and the battery voltage going into the switch.

    • I am using the internal reference of 600 mv.
    • I am using ADC_GAIN_1_3 
      • 600mv * 3 = 1800 mv (Within VCC_IO + 300 mv)
      • An analog value of 145 mv should result in a value of around 3630 mv to be reported from the device.
    • The device is reporting battery voltage of ~3570 mv. 

     This isn't necessarily useful information, but I have another custom PCB with an almost identical measurement circuit but VCC_IO is 3.0V. The device always reports an acceptable value.

    Am I missing something here?

    Related