This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049: ADC calibration

Part Number: TMS320F280049

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.

  • Hi Mark,

    The offset trim steps correspond to 1/16th of an LSB, so +112 should be an artificial offset of +7. 8766 / 512 = +17.12 average offset per conversion. 17.12 - 7 = +10.12 measured actual offset. So ideally you'd want to apply -10.12 LSBs of offset = -161 trim steps, which is what you arrived at.

    However, if you look at the register definition, the range of trim is only +7 to -8 LSBs.

    Is this via the internal VREFLO channel, or some external channel connected to ground, or some external channel connected to some other near-zero voltage? We observe that the natural offset error of the ADC should be very low, so +7/-8LSBs of range should be sufficient. If this isn't the case, maybe checking that the VREFLO, VSS, and VSSA connections to the ground plane are all very strong and the corresponding power/reference pins have good decoupling is a good place to start.
  • Sure - that makes sense.

    I am using internal reference for my conversions and simply converting a single channel which is unused.

    I had thought that any channel which is unused is ok for this purpose, but that's probably not the case.

    I've seen comments like "You can also sample the internal VREFLO connection", and I thought that conversion on an unused ADCA channel when configured for internal reference accomplished this.

    To calibrate ADCA I need to perform conversions on one of the 16 available channels don't I? 

    This seems like a dumb question as I type it but, how does one sample the internal VREFLO connection?

    Thanks so much!

    Mark

  • Hi Mark,

    Check out Table 5-39. "Analog Pins and Internal Connections" in the datasheet. You'll see that channel 13 one each ADC is connected to VREFLO. These connections do not have a pin number, so the connection is internal to the device.

    Unused pins are floating; they will not be pulled up or down.
  • Yes - that's exactly the info I was looking for.

    Thank you.

    Mark