Forum Discussion
Hello,
Summary :
1- external 1.25V +/- 0.2% reference voltage.
2- ADC samples are off ~10% even when averaged.
3- CAL bits in controller_csr remain 0, meaning calibration is not occuring.
4- tried to init the IP with setting the controller_csr = 0x102, followed by setting the bottom bit to start ADC sampling.
5- suspect ADC is using internal reference voltage instead of external voltage.
From userguide:
1- Cylone 10 GX ADC accuracy is ~+/- 20mV.
2- ADC supports external reference, but need to be explicitly configured correctly.
3- ADC defaults is to use internal reference ~+/- 10%. This would explain the deviation you see.
Debug steps:
1- by default, Voltage sensor IP may use the internal 1.2V reference (10% accuracy). To use external 1.25V reference, you need to perform below :
a) Route the external reference voltage to the correct analog input pin.
b) Set the IP to use external reference voltage correctly. (refer https://cdrdv2-public.intel.com/666896/ug_voltagesensor-683781-666896.pdf)
2- CAL bits = 0 meaning ADC has not been calibrated, which will affect accuracy. To calibrate, please do below steps:
a) write 0x102 to controller_csr:
bit 8: RESET_N = 0
bit 1: AUTOCAL = 1
bit 0: ENABLE = 0
b) then enable IP by setting controller_csr = 0x103:
bit 8 : RESET_N = 1
bit 1 : AUTOCAL = 1
bit 0 : ENABLE = 1
Notes: AUTOCAL need to get assserted with RESET_N to trigger calibration.
regards,
Farabi
wait for calibration to complete, check the CAL bit. If CAL =1 , means ADC has been successfully calibrated.