Download Print this page

ST STM32L4+ Series Reference Manual page 739

Hide thumbs Also See for STM32L4+ Series:

Advertisement

RM0432
1.
If the DAC channel is active, write 0 to ENx bit in DAC_CR to disable the channel.
2.
Select a mode where the buffer is enabled, by writing to DAC_MCR register,
MODEx[2:0] = 000b or 001b or 100b or 101b.
3.
Start the DAC channelx calibration, by setting the CENx 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 OTRIMx[4:0] bits in a faster way.
The commutation/toggle of CAL_FLAGx bit indicates that the offset is correctly
compensated and the corresponding trim code must be kept in the OTRIMx[4:0] bits in
DAC_CCR register.
Note:
A t
delay must be respected between the write to the OTRIMx[4:0] bits and the read of
TRIM
the CAL_FLAGx 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 OTRIMx[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 CENx bit is set, it is not allowed to set ENx bit.
22.4.12
Dual DAC channel conversion modes (if dual channels are
available)
To efficiently use the bus bandwidth in applications that require the two DAC channels at the
same time, three dual registers are implemented: DHR8RD, DHR12RD and DHR12LD. A
unique register access is then required to drive both DAC channels at the same time. For
the wave generation, no accesses to DHRxxxD registers are required. As a result, two
output channels can be used either independently or simultaneously.
11 conversion modes are possible using the two DAC channels and these dual registers. All
the conversion modes can nevertheless be obtained using separate DHRx registers if
needed.
All modes are described in the paragraphs below.
Independent trigger without wave generation
To configure the DAC in this conversion mode, the following sequence is required:
1.
Set the two DAC channel trigger enable bits TEN1 and TEN2.
2.
Configure different trigger sources by setting different values in the TSEL1 and TSEL2
bitfields.
3.
Load the dual DAC channel data into the desired DHR register (DAC_DHR12RD,
DAC_DHR12LD or DAC_DHR8RD).
Write a code into OTRIMx[4:0] bits, starting by 00000b.
Wait for t
delay.
TRIM
Check if CAL_FLAGx bit in DAC_SR is set to 1.
If CAL_FLAGx is set to 1, the OTRIMx[4:0] trimming code is found and can be
used during device operation to compensate the output value, else increment
OTRIMx[4:0] and repeat sub-steps from (a) to (d) again.
RM0432 Rev 6
Digital-to-analog converter (DAC)
739/2301
762

Advertisement

loading
Need help?

Need help?

Do you have a question about the STM32L4+ Series and is the answer not in the manual?

Subscribe to Our Youtube Channel