ADuCM4050 ADC oversampling decreases resolution after waking up from hibernation


I'm trying to use the oversampling feature of the ADuCM4050 to produce 14-bit values from the ADC channels.

The steps I'm doing to initialize the ADC peripheral are:

  1. Set the PWRUP bit of the ADC_CFG register
  2. Set the ADC_PWRUP register to 0x218
  3. Set the EN bit of the ADC_CFG register
  4. Wait until the RDY bit of the ADC_STAT register goes to 1
  5. Set bit 15 of ADC_STAT to clear it
  6. Set the STARTCAL bit of the ADC_CFG register
  7. Wait until the CALDONE bit of the ADC_STAT register goes to 1
  8. Set SEL to 1 in the ADC_CNV_CFG register (select ADC channel 0)
  9. Set ADC_CNV_TIME register to 0

From there I can start a conversion by setting the SINGLE bit in the ADC_CNV_CFG register, wait for the conversion to be completed using the DONE0 bit in the ADC_STAT register or the conversion done interrupt and it gives me a 12-bit value as expected.

Then I tried configuring the oversampling per the user manual: I set the OS and EN bits of the ADC_AVG_CFG register and set the FACTOR bits to one of the following values: 0x02 for 13-bit, 0x08 for 14-bit, 0x20 for 15-bit, 0x80 for 16 bit.

With this configuration the ADC output values 2, 4, 8, 16 times bigger than the related 12-bit value for 13, 14, 15, 16 bits, respectively, as expected.

Finally, I tried putting the MCU into hibernation mode. I de-initialize the ADC and put it to sleep, when the MCU wakes up I re-initialize the ADC and try to do readings again. From this point on, the ADC values are divided instead of multiplied by the expected value: outputs are 1/2, 1/4, 1/8, 1/16 of the original value when configuring for 13, 14, 15, 16 bits, respectively.

Am I doing something wrong? How can I get the ADC to output values with resolution higher than 12 bits in this situation?

Thanks in advance.


Added details about the problem: seems to only occur after waking up from hibernation mode.
[edited by: Hazael Batista at 9:22 PM (GMT 0) on 15 Jul 2020]