I'm afraid I don't understand the following procedure outlined in the TMS320F28004x Piccolo MicrocontrollersTechnical Reference Manual.
Section: 13.1.12.1 ADC Zero Offset Calibration
Use the following procedure to re-calibrate the ADC offset in 12-bit, single-ended mode:
1. Set ADCOFFTRIM to +112 steps (0x70). This adds an artificial offset to account for negative offset that
may reside in the ADC core.
2. Perform some multiple of 16 conversions on VREFLO (internal connection), accumulating the results
(for example, 32*16 conversions = 512 conversions).
3. Divide the accumulated result by the multiple of 16 (for example, for 512 conversions, divide by 32).
4. Set ADCOFFTRIM to 112 – result from step 3.
With a value of 0x70 in the ADCA ADCOFFTRIM register I am reading an average of 0x11 from a configured unused pin and using the internal reference voltage.
So I use a value of 0x70 in the ADCA ADCOFFTRIM register, take 512 samples and sum them up. that's 8766. Divide that by 32, that's 273 (0x111).
Per step 4: 0x70 - 0x111 = 0xFF5F, which I write to AdcaRegs_ADCOFFTRIM
.
With this value (0x5F) on the ADCA ADCOFFTRIM register I am reading an average of 0x0F from a configured unused pin and using the internal reference voltage.
per my own testing:
With a value of 0x70 in the ADCA ADCOFFTRIM register I am reading an average of 0x11 from a configured unused pin and using the internal reference voltage.
With a value of 0x00 in the ADCA ADCOFFTRIM register I am reading an average of 0x09 from a configured unused pin and using the internal reference voltage.
With a value of 0x8A in the ADCA ADCOFFTRIM register I am reading an average of 0x01 from a configured unused pin and using the internal reference voltage.
It would seem a value like 0x8A is what I want, but I don't see how I arrive at that using the procedure outlined in the manual.
Setting the Trim obviously works, but I don't see how this correctly chooses the value to set.
Thank you.