# AURIX™ MCU: Calculate the gain factors for EDSADC – KBA235517

Community Manager
Community Manager

Version: **

To achieve a correct calibration, the values for the Cascaded Integrator Comb (CIC) shift and gain factor must be calculated according to the intended full-scale value and the selected decimation factor.

The value for the CIC shift is determined by the following formula:Where:

• N is the selected decimation factor.
• AFS is the intended calibrated full-scale value of the ADC (it refers to the analog full-scale 𝑉_𝐼𝑁=𝑉_𝐴𝑅𝐸𝐹).
• FM is the modulator gain factor (when using the on-chip modulator FM = 0,6945).

Then, the gap that comes from the rounding in the above formula is closed by computing the corresponding gain correction factor:

That is finally multiplied by 4096 and truncated to be stored in the GAINFACTOR bitfield of GAINCORR register:

<GAINFACTOR> = truncate( gain factor * 4096 )

Calculation example:

Consider the following use case:

• Use the on-chip modulator: this fixes the value of FM to FM = 0,6945.
• Select a decimation factor N = 32.
• Assume an intended full-scale value AFS = 30000.

The value for the CIC shift is then determined by the formula:

And the gain correction factor:

Which finally leads to the GAINFACTOR bitfield of GAINCORR register: