Digital-to-analog converter (DAC)
1.
If the DAC channel is active, write 0 to EN1 bit in DAC_CR to disable the channel.
2.
Select a mode where the buffer is enabled, by writing to DAC_MCR register,
MODE1[2:0] = 0b000 or 0b001 or 0b100 or 0b101.
3.
Start the DAC channel calibration, by setting the CEN1 bit in DAC_CR register to 1.
4.
Apply a trimming algorithm:
a)
b)
c)
d)
The software algorithm may use either a successive approximation or dichotomy techniques
to compute and set the content of OTRIM1[4:0] bits in a faster way.
The commutation/toggle of CAL_FLAG1 bit indicates that the offset is correctly
compensated and the corresponding trim code must be kept in the OTRIM1[4:0] bits in
DAC_CCR register.
Note:
A t
delay must be respected between the write to the OTRIM1[4:0] bits and the read of
TRIM
the CAL_FLAG1 bit in DAC_SR register in order to get a correct value.This parameter is
specified into datasheet electrical characteristics section.
If V
, VREF+ and temperature conditions do not change during device operation while it
DDA
enters more often in standby and VBAT mode, the software may store the OTRIM1[4:0] bits
found in the first user calibration in the flash or in back-up registers. then to load/write them
directly when the device power is back again thus avoiding to wait for a new calibration time.
When CEN1 bit is set, it is not allowed to set EN1 bit.
19.4.13
DAC channel conversion modes
Four conversion modes are possible.
Independent trigger without wave generation
To configure the DAC in this conversion mode, the following sequence is required:
1.
Set the DAC channel trigger enable bit, TEN1.
2.
Configure the trigger sources by setting different values in the TSEL1[3:0] bits.
3.
Load the DAC channel data into the desired DHR registers (DAC_DHR12R1,
DAC_DHR12L1 or DAC_DHR8R1).
When a DAC channel trigger arrives, the DHR1 register is transferred into DAC_DOR1
(three dac_pclk clock cycles later).
604/1450
Write a code into OTRIM1[4:0] bits, starting by 0b00000.
Wait for t
delay.
TRIM
Check if CAL_FLAG1 bit in DAC_SR is set to 1.
If CAL_FLAG1 is set to 1, the OTRIM1[4:0] trimming code is found and can be
used during device operation to compensate the output value, else increment
OTRIM1[4:0] and repeat sub-steps from (a) to (d) again.
RM0453 Rev 5
RM0453
Need help?
Do you have a question about the STM32WL5 Series and is the answer not in the manual?
Questions and answers