DocID025202 Rev 7
426/1080
RM0365
Operational amplifier (OPAMP)
436
The user can switch from the ‘factory’ values to the ‘user’ trimmed values using the
USER_TRIM bit in the OPAMP control register. This bit is reset at startup (‘factory’ values
are sent to the operational amplifiers).
The rail-to-rail input stage of the OPAMP is composed of two differential pairs:
•
One pair composed of NMOS transistors
•
One pair composed of PMOS transistors.
As these two pairs are independent, the trimming procedure calibrates each one separately.
The TRIMOFFSETN bits calibrate the NMOS differential pair offset and the TRIMOFFSETP
bits calibrate the PMOS differential pair offset.
To calibrate the NMOS differential pair, the following conditions must be met: CALON=1 and
CALSEL=11. In this case, an internal high voltage reference (0.9 x V
DDA
) is generated and
applied on the inverting and non inverting OPAMP inputs connected together. The voltage
applied to both inputs of the OPAMP can be measured (the OPAMP reference voltage can
be output through the TSTREF bit and connected internally to an ADC channel; refer to
Section 15: Analog-to-digital converters (ADC) on page 287
). The software should
increment the TRIMOFFSETN bits in the OPAMP control register from 0x00 to the first value
that causes the OUTCAL bit to change from 1 to 0 in the OPAMP register. If the OUTCAL bit
is reset, the offset is calibrated correctly and the corresponding trimming value must be
stored.
The calibration of the PMOS differential pair is performed in the same way, with two
differences: the TRIMOFFSETP bits-fields are used and the CALSEL bits must be
programmed to ‘01’ (an internal low voltage reference (0.1 x V
DDA
) is generated and applied
on the inverting and non inverting OPAMP inputs connected together).
Note:
During calibration mode, to get the correct OUTCAL value, please make sure the
OFFTRIMmax delay (specified in the datasheet electrical characteristics section) has
elapsed between the write of a trimming value (TRIMOFFSETP or TRIMOFFSETN) and the
read of the OUTCAL value,
To calibrate the NMOS differential pair, use the following software procedure:
1.
Enable OPAMP by setting the OPAMPxEN bit
2. Enable the user offset trimming by setting the USERTRIM bit
3. Connect VM and VP to the internal reference voltage by setting the CALON bit
4. Set CALSEL to 11 (OPAMP internal reference =0.9 x V
DDA
)
5. In a loop, increment the TRIMOFFSETN value. To exit from the loop, the OUTCAL bit
must be reset. In this case, the TRIMOFFSETN value must be stored.
The same software procedure must be applied for PMOS differential pair calibration with
CALSEL = 01 (OPAMP internal reference = 0.1 V
DDA
).
18.3.6
Timer controlled Multiplexer mode
The selection of the OPAMP inverting and non inverting inputs can be done automatically. In
this case, the switch from one input to another is done automatically. This automatic switch
is triggered by the TIM1 CC6 output arriving on the OPAMP input multiplexers.
This is useful for dual motor control with a need to measure the currents on the 3 phases
instantaneously on a first motor and then on the second motor.
The automatic switch is enabled by setting the TCM_EN bit in the OPAMP control register.
The inverting and non inverting inputs selection is performed using the VPS_SEL and