TSL2521 ALS/Flicker
TSL2521 ALS and Flicker Settings
Application Note
• PUBLIC
AN001042
• v1-01 • 2022-Jan-27
23
│ 11
2.5
ALS/Flicker Gain and AGC
Another fundamental parameter for ALS measurement is the ALS gain setting. For ALS legacy
devices like TCS3707 there was a single AGAIN value. For TSL2521, the gain is set per modulator
and even for every sequence individually. The gain for both modulator 0 and modulator 1 for step 0
can be set in register
MEAS_SEQR_STEP0_MOD_GAINX_L
. The modulator gain can range from
0.5x to 4096x and is limited in register
CFG8
by the field measurement_sequencer_max_mod_gain for
all modulators and sequencer steps. Please note that in case of enabled Automatic Gain Control
(AGC) the modulator gain registers are changed according to the last measurement.
The gain used for the current result set in the
ALS_DATA
registers can be read from the
ALS_STATUS2
register using the bit fields als_data0_gain_status and als_data1_gain_status. This
gain information is important for the lux equation, since the AGC
– if enabled – might have changed
the originally set modulator gain.
There are two Automatic Gain Control (AGC) methods implemented. The legacy one is the saturation
AGC that reduces the gain in case of modulator saturation and repeats the measurement until there is
no saturated result. This method is easy and
– as long as the dynamic range allows it – always leads
to a useful result but can take longer time and the time delay caused by this procedure is not
deterministic.
The saturation AGC can be enabled in field measurement_sequencer_agc_asat_pattern in register
MEAS_SEQR_STEP1_MOD_PHDX_SMUX_H
individually for each sequencer step. This setting is
valid for both modulators.
The second one is the predict AGC, that defines the gain for the next measurement by doing a
measurement with reduced gain. The gain reduction can be set in register
CFG8
in the field
measurement_mod_gain_reduction; by default it reduces the gain by 4 steps. The advantage of the
predict AGC is a shorter and deterministic measurement time, but in case of abrupt changes it can
lead to a saturated result that needs to be dropped after checking the saturation signals.
The predict AGC can be enabled in the field measurement_sequencer_agc_predict_pattern in register
MEAS_SEQR_STEP2_MOD_PHDX_SMUX_H
individually for each sequencer step. This setting is
valid for both modulators.
The AGC measurement is done by adding an additional ALS sequence round before the actual
measurement sequence. Both AGC methods do not need to use the same ALS integration time since
AGC has its own dedicated agc_nr_samples fields in registers
AGC_NR_SAMPLE[7:0]
and
AGC_NR_SAMPLES[10:8],
sample_time is the same as for ALS/Flicker. That can help to reduce the
whole ALS measurement time by using a shorter integration time for the AGC measurement. Both
AGC methods can be used at the same time, in this case the predict AGC firstly sets the gain, but if
still analog saturation happens the saturation AGC repeats the measurement with reduced gain.
Please note that due to the saturation AGC method the ALS measurement time is not deterministic in
this case too.
How often AGC is performed is defined with mod_calib_nth_iteration in register
MOD_CALIB_CFG0
.
Additionally, the ACG needs to be linked to mod_calib_nth_iteration by setting the bit