Example: Let the current through an LED string be 300mA with a ripple of 40%.
So Iavg = 300 mA.
sense resistance value Rsense = 0.22 W
gain of CSA be 20 and,
the 8-bit DAC be set at a resolution of 2.6V/10mV.
Current sense voltage Vpeak = Ipeak x Rsense = 360 x 0.22 = 79.2 mV.
Similarly Vvalley= Ivalley x Rsense = 240 x 0.22 = 52.8 mV.
Corresponding to Vpeak and Vvalley, the output of CSA would be the gain multiplied by the voltage.
V’peak = Vpeak x 20 = 1.584 V and
V’valley= Vvalley x 20 = 1.056 V.
Now, the peak or upper limit DAC reference is calculated as,
REFupper = (V’peak/2.6) x 256 = 156
Similarly, valley or lower DAC reference is,
REFlower = (V’valley/2.6) x 256 = 104