16. Digital-to-analog converter (DAC)

16.1 DAC introduction

The DAC module is a 12-bit, voltage output digital-to-analog converter. The DAC can be configured in 8- or 12-bit mode and may be used in conjunction with the DMA controller. In 12-bit mode, the data could be left- or right-aligned. The DAC has two output channels, each with its own converter. In dual DAC channel mode, conversions could be done independently or simultaneously when both channels are grouped together for synchronous update operations. An input reference pin, \( V_{REF+} \) (shared with ADC) is available for better resolution.

16.2 DAC main features

Figure 93 shows the block diagram of a DAC channel and Table 102 gives the pin description.

Figure 93. DAC channel block diagram

Figure 93. DAC channel block diagram. The diagram shows the internal architecture of a DAC channel. On the left, an external trigger (EXTI_9) and a 'trigger selector' block (receiving inputs from SWTRIGx, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO, TIM6_TRGO, TIM7_TRGO, and TIM8_TRGO) are connected to a 'Control logicx' block. The 'Control logicx' block also receives a 12-bit input from 'DHRx' and control signals from a 'DAC control register' (TSELx[2:0] bits, DMAENx, DMA requestx, TENx, MAMPx[3:0] bits, and WAVENx[1:0] bits). The 'Control logicx' block contains 'LFSRx' and 'trianglex' sub-blocks and outputs a 12-bit signal to 'DORx'. 'DORx' then outputs a 12-bit signal to a 'Digital-to-analog converterx' block. The 'Digital-to-analog converterx' block receives V_DDA, V_SSA, and V_REF+ inputs and produces the final output, DAC1_OUT1/2. The identifier 'ai14708d' is present in the bottom right corner of the diagram.
Figure 93. DAC channel block diagram. The diagram shows the internal architecture of a DAC channel. On the left, an external trigger (EXTI_9) and a 'trigger selector' block (receiving inputs from SWTRIGx, TIM2_TRGO, TIM4_TRGO, TIM5_TRGO, TIM6_TRGO, TIM7_TRGO, and TIM8_TRGO) are connected to a 'Control logicx' block. The 'Control logicx' block also receives a 12-bit input from 'DHRx' and control signals from a 'DAC control register' (TSELx[2:0] bits, DMAENx, DMA requestx, TENx, MAMPx[3:0] bits, and WAVENx[1:0] bits). The 'Control logicx' block contains 'LFSRx' and 'trianglex' sub-blocks and outputs a 12-bit signal to 'DORx'. 'DORx' then outputs a 12-bit signal to a 'Digital-to-analog converterx' block. The 'Digital-to-analog converterx' block receives V_DDA, V_SSA, and V_REF+ inputs and produces the final output, DAC1_OUT1/2. The identifier 'ai14708d' is present in the bottom right corner of the diagram.

Table 102. DAC pins

NameSignal typeRemarks
V REF+Input, analog reference positiveThe higher/positive reference voltage for the DAC, \( 1.8\text{ V} \leq V_{\text{REF+}} \leq V_{\text{DDA}} \)
V DDAInput, analog supplyAnalog power supply
V SSAInput, analog supply groundGround for analog power supply
DAC_OUTxAnalog output signalDAC channelx analog output

Note: Once the DAC channelx is enabled, the corresponding GPIO pin (PA4 or PA5) is automatically connected to the analog converter output (DAC_OUTx). In order to avoid parasitic consumption, the PA4 or PA5 pin should first be configured to analog (AIN).

16.3 DAC functional description

16.3.1 DAC channel enable

Each DAC channel can be powered on by setting its corresponding ENx bit in the DAC_CR register. The DAC channel is then enabled after a startup time \( t_{\text{WAKEUP}} \) .

Note: The ENx bit enables the analog DAC channelx macrocell only. The DAC channelx digital interface is enabled even if the ENx bit is reset.

16.3.2 DAC output buffer enable

The DAC integrates two output buffers that can be used to reduce the output impedance, and to drive external loads directly without having to add an external operational amplifier. Each DAC channel output buffer can be enabled and disabled using the corresponding BOFFx bit in the DAC_CR register.

Figure 94. DAC output buffer connection

Figure 94: DAC output buffer connection diagram. The diagram shows two DAC channels, CH1 and CH2, within a DAC1 block. Each channel receives an 8-bit input from TSEL1[2:0] and TSEL2[2:0] respectively. The 12-bit output of each DAC is connected to a buffer. The buffers are controlled by DAC_CR.BOFF1 and DAC_CR.BOFF2. The output of Buffer 1 is connected to PA4, and the output of Buffer 2 is connected to PA5. The buffers can be bypassed when off.

The diagram illustrates the internal architecture of the DAC output buffers. On the left, two 8-bit input signals, TSEL1[2:0] and TSEL2[2:0], enter the DAC1 block. Inside, they are processed by CH1 and CH2. Each channel has a 12-bit output that connects to a buffer. The buffers are labeled 'Buffer' and are controlled by DAC_CR.BOFF1 and DAC_CR.BOFF2. The output of Buffer 1 is connected to PA4, and the output of Buffer 2 is connected to PA5. The buffers can be bypassed when off, as indicated by the text 'Bypass, when off' next to each buffer.

Figure 94: DAC output buffer connection diagram. The diagram shows two DAC channels, CH1 and CH2, within a DAC1 block. Each channel receives an 8-bit input from TSEL1[2:0] and TSEL2[2:0] respectively. The 12-bit output of each DAC is connected to a buffer. The buffers are controlled by DAC_CR.BOFF1 and DAC_CR.BOFF2. The output of Buffer 1 is connected to PA4, and the output of Buffer 2 is connected to PA5. The buffers can be bypassed when off.

16.3.3 DAC data format

Depending on the selected configuration mode, the data have to be written into the specified register as described below:

Depending on the loaded DAC_DHRyyxx register, the data written by the user is shifted and stored into the corresponding DHRx (data holding registerx, which are internal non-memory-mapped registers). The DHRx register is then loaded into the DORx register either automatically, by software trigger or by an external event trigger.

Figure 95. Data registers in single DAC channel mode

Figure 95: Data registers in single DAC channel mode. A diagram showing a 32-bit register (bits 31 to 0) with three alignment options: 8-bit right aligned, 12-bit left aligned, and 12-bit right aligned. The 8-bit right aligned option shows data in bits 7:0. The 12-bit left aligned option shows data in bits 31:20. The 12-bit right aligned option shows data in bits 11:0.

ai14710b

Figure 95: Data registers in single DAC channel mode. A diagram showing a 32-bit register (bits 31 to 0) with three alignment options: 8-bit right aligned, 12-bit left aligned, and 12-bit right aligned. The 8-bit right aligned option shows data in bits 7:0. The 12-bit left aligned option shows data in bits 31:20. The 12-bit right aligned option shows data in bits 11:0.

Depending on the loaded DAC_DHRyyD register, the data written by the user is shifted and stored into DHR1 and DHR2 (data holding registers, which are internal non-memory-mapped registers). The DHR1 and DHR2 registers are then loaded into the DOR1 and DOR2 registers, respectively, either automatically, by software trigger or by an external event trigger.

Figure 96. Data registers in dual DAC channel mode

Figure 96: Data registers in dual DAC channel mode. A diagram showing a 32-bit register (bits 31 to 0) with three alignment options: 8-bit right aligned, 12-bit left aligned, and 12-bit right aligned. The 8-bit right aligned option shows data for channel 1 in bits 11:4 and channel 2 in bits 15:8. The 12-bit left aligned option shows data for channel 1 in bits 11:0 and channel 2 in bits 31:20. The 12-bit right aligned option shows data for channel 1 in bits 11:0 and channel 2 in bits 27:16.

ai14709b

Figure 96: Data registers in dual DAC channel mode. A diagram showing a 32-bit register (bits 31 to 0) with three alignment options: 8-bit right aligned, 12-bit left aligned, and 12-bit right aligned. The 8-bit right aligned option shows data for channel 1 in bits 11:4 and channel 2 in bits 15:8. The 12-bit left aligned option shows data for channel 1 in bits 11:0 and channel 2 in bits 31:20. The 12-bit right aligned option shows data for channel 1 in bits 11:0 and channel 2 in bits 27:16.

16.3.4 DAC conversion

The DAC_DORx cannot be written directly and any data transfer to the DAC channelx must be performed by loading the DAC_DHRx register (write to DAC_DHR8Rx, DAC_DHR12Lx, DAC_DHR12Rx, DAC_DHR8RD, DAC_DHR12LD or DAC_DHR12RD).

Data stored in the DAC_DHRx register are automatically transferred to the DAC_DORx register after one APB1 clock cycle, if no hardware trigger is selected (TENx bit in DAC_CR register is reset). However, when a hardware trigger is selected (TENx bit in DAC_CR register is set) and a trigger occurs, the transfer is performed three APB1 clock cycles later.

When DAC_DORx is loaded with the DAC_DHRx contents, the analog output voltage becomes available after a time \( t_{\text{SETTLING}} \) that depends on the power supply voltage and the analog output load.

Figure 97. Timing diagram for conversion with trigger disabled TEN = 0

Timing diagram for conversion with trigger disabled (TEN = 0). The diagram shows three signals: APB1_CLK (a periodic square wave), DHR (Digital-to-Analog Register, holding value 0x1AC), and DOR (Output Register, holding value 0x1AC). The DOR signal is shown as a step function that updates its value to 0x1AC after a settling time t_SETTLING. An arrow points from the DOR signal to the text 'Output voltage available on DAC_OUT pin'. The diagram is labeled ai14711b.
Timing diagram for conversion with trigger disabled (TEN = 0). The diagram shows three signals: APB1_CLK (a periodic square wave), DHR (Digital-to-Analog Register, holding value 0x1AC), and DOR (Output Register, holding value 0x1AC). The DOR signal is shown as a step function that updates its value to 0x1AC after a settling time t_SETTLING. An arrow points from the DOR signal to the text 'Output voltage available on DAC_OUT pin'. The diagram is labeled ai14711b.

16.3.5 DAC output voltage

Digital inputs are converted to output voltages on a linear conversion between 0 and \( V_{\text{REF+}} \) . The analog output voltages on each DAC channel pin are determined by the following equation:

\[ \text{DACoutput} = V_{\text{REF}} \times \frac{\text{DOR}}{4096} \]

16.3.6 DAC trigger selection

If the TENx control bit is set, conversion can then be triggered by an external event (timer counter, external interrupt line). The TSELx[2:0] control bits determine which out of 8 possible events will trigger conversion as shown in Table 103 .

Table 103. External triggers

SourceTypeTSEL[2:0]
Timer 6 TRGO eventInternal signal from on-chip timers000
Timer 8 TRGO event001
Timer 7 TRGO event010
Timer 5 TRGO event011
Timer 2 TRGO event100
Timer 4 TRGO event101
EXTI line9External pin110
SWTRIGSoftware control bit111

Each time a DAC interface detects a rising edge on the selected timer TRGO output, or on the selected external interrupt line 9, the last data stored into the DAC_DHRx register are transferred into the DAC_DORx register. The DAC_DORx register is updated three APB1 cycles after the trigger occurs.

If the software trigger is selected, the conversion starts once the SWTRIG bit is set. SWTRIG is reset by hardware once the DAC_DORx register has been loaded with the DAC_DHRx register contents.

Note: TSELx[2:0] bit cannot be changed when the ENx bit is set.

When software trigger is selected, the transfer from the DAC_DHRx register to the DAC_DORx register takes only one APB1 clock cycle.

16.3.7 DMA request

Each DAC channel has a DMA capability. Two DMA channels are used to service DAC channel DMA requests.

A DAC DMA request is generated when an external trigger (but not a software trigger) occurs while the DMAENx bit is set. The value of the DAC_DHRx register is then transferred into the DAC_DORx register.

In dual mode, if both DMAENx bits are set, two DMA requests are generated. If only one DMA request is needed, you should set only the corresponding DMAENx bit. In this way, the application can manage both DAC channels in dual mode by using one DMA request and a unique DMA channel.

DMA underrun

The DAC DMA request is not queued so that if a second external trigger arrives before the acknowledgement for the first external trigger is received (first request), then no new request is issued and the DMA channelx underrun flag DMAUDRx in the DAC_SR register is set, reporting the error condition. DMA data transfers are then disabled and no further DMA request is treated. The DAC channelx continues to convert old data.

The software should clear the DMAUDRx flag by writing “1”, clear the DMAEN bit of the used DMA stream and re-initialize both DMA and DAC channelx to restart the transfer correctly. The software should modify the DAC trigger conversion frequency or lighten the DMA workload to avoid a new DMA underrun. Finally, the DAC conversion could be resumed by enabling both DMA data transfer and conversion trigger.

For each DAC channelx, an interrupt is also generated if its corresponding DMAUDRIEx bit in the DAC_CR register is enabled.

16.3.8 Noise generation

In order to generate a variable-amplitude pseudonoise, an LFSR (linear feedback shift register) is available. DAC noise generation is selected by setting WAVEx[1:0] to “01”. The preloaded value in LFSR is 0xAAA. This register is updated three APB1 clock cycles after each trigger event, following a specific calculation algorithm.

Figure 98. DAC LFSR register calculation algorithm

Figure 98: DAC LFSR register calculation algorithm diagram. It shows a 12-bit shift register with cells numbered 11 down to 0. The output of cell 0 is labeled X^0. The output of cell 1 is labeled X. The output of cell 4 is labeled X^4. The output of cell 6 is labeled X^6. The output of cell 11 is labeled X^12. These outputs are connected to an XOR gate. The output of the XOR gate is connected to a NOR gate. The output of the NOR gate is connected back to the input of cell 11. A 12-bit bus is shown entering the NOR gate from below.
Figure 98: DAC LFSR register calculation algorithm diagram. It shows a 12-bit shift register with cells numbered 11 down to 0. The output of cell 0 is labeled X^0. The output of cell 1 is labeled X. The output of cell 4 is labeled X^4. The output of cell 6 is labeled X^6. The output of cell 11 is labeled X^12. These outputs are connected to an XOR gate. The output of the XOR gate is connected to a NOR gate. The output of the NOR gate is connected back to the input of cell 11. A 12-bit bus is shown entering the NOR gate from below.

ai14713c

The LFSR value, that may be masked partially or totally by means of the MAMPx[3:0] bits in the DAC_CR register, is added up to the DAC_DHRx contents without overflow and this value is then stored into the DAC_DORx register.

If LFSR is 0x0000, a '1' is injected into it (antilock-up mechanism).

It is possible to reset LFSR wave generation by resetting the WAVEx[1:0] bits.

Figure 99. DAC conversion (SW trigger enabled) with LFSR wave generation

Figure 99: Timing diagram showing APB1_CLK, DHR, DOR, and SWTRIG signals. APB1_CLK is a periodic square wave. DHR is a constant value of 0x00. DOR starts at 0xAAA and changes to 0xD55. SWTRIG is a pulse that triggers the change in DOR. The change in DOR occurs after a SWTRIG pulse and is synchronized with the APB1_CLK signal.
Figure 99: Timing diagram showing APB1_CLK, DHR, DOR, and SWTRIG signals. APB1_CLK is a periodic square wave. DHR is a constant value of 0x00. DOR starts at 0xAAA and changes to 0xD55. SWTRIG is a pulse that triggers the change in DOR. The change in DOR occurs after a SWTRIG pulse and is synchronized with the APB1_CLK signal.

ai14714b

Note: The DAC trigger must be enabled for noise generation by setting the TENx bit in the DAC_CR register.

16.3.9 Triangle-wave generation

It is possible to add a small-amplitude triangular waveform on a DC or slowly varying signal. DAC triangle-wave generation is selected by setting WAVEx[1:0] to "10". The amplitude is configured through the MAMPx[3:0] bits in the DAC_CR register. An internal triangle counter is incremented three APB1 clock cycles after each trigger event. The value of this counter is then added to the DAC_DHRx register without overflow and the sum is stored into the DAC_DORx register. The triangle counter is incremented as long as it is less than the maximum amplitude defined by the MAMPx[3:0] bits. Once the configured amplitude is reached, the counter is decremented down to 0, then incremented again and so on.

It is possible to reset triangle wave generation by resetting the WAVEx[1:0] bits.

Figure 100. DAC triangle wave generation

Figure 100: DAC triangle wave generation graph. The y-axis shows 'MAMPx[3:0] max amplitude + DAC_DHRx base value' at the peak and 'DAC_DHRx base value' at the trough. The x-axis represents time. The waveform is a triangle wave starting at the base value, rising linearly (labeled 'Incrementation'), reaching the peak, falling linearly (labeled 'Decrementation'), and returning to the base value. The graph is labeled 'ai14715c'.
Figure 100: DAC triangle wave generation graph. The y-axis shows 'MAMPx[3:0] max amplitude + DAC_DHRx base value' at the peak and 'DAC_DHRx base value' at the trough. The x-axis represents time. The waveform is a triangle wave starting at the base value, rising linearly (labeled 'Incrementation'), reaching the peak, falling linearly (labeled 'Decrementation'), and returning to the base value. The graph is labeled 'ai14715c'.

Figure 101. DAC conversion (SW trigger enabled) with triangle wave generation

Figure 101: Timing diagram for DAC conversion with SW trigger enabled. It shows four signals: APB1_CLK (a high-frequency square wave), DHR (Digital Hold Register) which is set to 0x00, DOR (Data Output Register) which shows values 0xAA and 0xD5, and SWTRIG (Software Trigger) which is a pulse. Vertical dashed lines indicate the sequence of events: first, DHR is set to 0x00; then, a SWTRIG pulse occurs, causing the DOR value to change to 0xAA; later, another SWTRIG pulse occurs, causing the DOR value to change to 0xD5. The graph is labeled 'ai14714b'.
Figure 101: Timing diagram for DAC conversion with SW trigger enabled. It shows four signals: APB1_CLK (a high-frequency square wave), DHR (Digital Hold Register) which is set to 0x00, DOR (Data Output Register) which shows values 0xAA and 0xD5, and SWTRIG (Software Trigger) which is a pulse. Vertical dashed lines indicate the sequence of events: first, DHR is set to 0x00; then, a SWTRIG pulse occurs, causing the DOR value to change to 0xAA; later, another SWTRIG pulse occurs, causing the DOR value to change to 0xD5. The graph is labeled 'ai14714b'.

Note: The DAC trigger must be enabled for noise generation by setting the TENx bit in the DAC_CR register.

The MAMPx[3:0] bits must be configured before enabling the DAC, otherwise they cannot be changed.

16.4 Dual DAC channel conversion

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.

Eleven possible 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.

16.4.1 Independent trigger without wave generation

To configure the DAC in this conversion mode, the following sequence is required:

When a DAC channel1 trigger arrives, the DHR1 register is transferred into DAC_DOR1 (three APB1 clock cycles later).

When a DAC channel2 trigger arrives, the DHR2 register is transferred into DAC_DOR2 (three APB1 clock cycles later).

16.4.2 Independent trigger with single LFSR generation

To configure the DAC in this conversion mode, the following sequence is required:

When a DAC channel1 trigger arrives, the LFSR1 counter, with the same mask, is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). Then the LFSR1 counter is updated.

When a DAC channel2 trigger arrives, the LFSR2 counter, with the same mask, is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). Then the LFSR2 counter is updated.

16.4.3 Independent trigger with different LFSR generation

To configure the DAC in this conversion mode, the following sequence is required:

When a DAC channel1 trigger arrives, the LFSR1 counter, with the mask configured by MAMP1[3:0], is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). Then the LFSR1 counter is updated.

When a DAC channel2 trigger arrives, the LFSR2 counter, with the mask configured by MAMP2[3:0], is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). Then the LFSR2 counter is updated.

16.4.4 Independent trigger with single triangle generation

To configure the DAC in this conversion mode, the following sequence is required:

When a DAC channel1 trigger arrives, the DAC channel1 triangle counter, with the same triangle amplitude, is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). The DAC channel1 triangle counter is then updated.

When a DAC channel2 trigger arrives, the DAC channel2 triangle counter, with the same triangle amplitude, is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). The DAC channel2 triangle counter is then updated.

16.4.5 Independent trigger with different triangle generation

To configure the DAC in this conversion mode, the following sequence is required:

When a DAC channel1 trigger arrives, the DAC channel1 triangle counter, with a triangle amplitude configured by MAMP1[3:0], is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). The DAC channel1 triangle counter is then updated.

When a DAC channel2 trigger arrives, the DAC channel2 triangle counter, with a triangle amplitude configured by MAMP2[3:0], is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). The DAC channel2 triangle counter is then updated.

16.4.6 Simultaneous software start

To configure the DAC in this conversion mode, the following sequence is required:

In this configuration, one APB1 clock cycle later, the DHR1 and DHR2 registers are transferred into DAC_DOR1 and DAC_DOR2, respectively.

16.4.7 Simultaneous trigger without wave generation

To configure the DAC in this conversion mode, the following sequence is required:

When a trigger arrives, the DHR1 and DHR2 registers are transferred into DAC_DOR1 and DAC_DOR2, respectively (after three APB1 clock cycles).

16.4.8 Simultaneous trigger with single LFSR generation

To configure the DAC in this conversion mode, the following sequence is required:

When a trigger arrives, the LFSR1 counter, with the same mask, is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). The LFSR1 counter is then updated. At the same time, the LFSR2 counter, with the same mask, is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). The LFSR2 counter is then updated.

16.4.9 Simultaneous trigger with different LFSR generation

To configure the DAC in this conversion mode, the following sequence is required:

When a trigger arrives, the LFSR1 counter, with the mask configured by MAMP1[3:0], is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). The LFSR1 counter is then updated.

At the same time, the LFSR2 counter, with the mask configured by MAMP2[3:0], is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). The LFSR2 counter is then updated.

16.4.10 Simultaneous trigger with single triangle generation

To configure the DAC in this conversion mode, the following sequence is required:

When a trigger arrives, the DAC channel1 triangle counter, with the same triangle amplitude, is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). The DAC channel1 triangle counter is then updated.

At the same time, the DAC channel2 triangle counter, with the same triangle amplitude, is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). The DAC channel2 triangle counter is then updated.

16.4.11 Simultaneous trigger with different triangle generation

To configure the DAC in this conversion mode, the following sequence is required:

When a trigger arrives, the DAC channel1 triangle counter, with a triangle amplitude configured by MAMP1[3:0], is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three APB1 clock cycles later). Then the DAC channel1 triangle counter is updated.

At the same time, the DAC channel2 triangle counter, with a triangle amplitude configured by MAMP2[3:0], is added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock cycles later). Then the DAC channel2 triangle counter is updated.

16.5 DAC registers

Refer to Section 1 on page 63 for a list of abbreviations used in register descriptions.

The peripheral registers have to be accessed by words (32 bits).

16.5.1 DAC control register (DAC_CR)

Address offset: 0x00

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.DMAUDRIE2DMAEN2MAMP2[3:0]WAVE2[1:0]TSEL2[2:0]TEN2BOFF2EN2
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

1514131211109876543210
Res.Res.DMAUDRIE1DMAEN1MAMP1[3:0]WAVE1[1:0]TSEL1[2:0]TEN1BOFF1EN1
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:30 Reserved, must be kept at reset value.

Bit 29 DMAUDRIE2 : DAC channel2 DMA underrun interrupt enable

This bit is set and cleared by software.

0: DAC channel2 DMA underrun interrupt disabled

1: DAC channel2 DMA underrun interrupt enabled

Bit 28 DMAEN2 : DAC channel2 DMA enable

This bit is set and cleared by software.

0: DAC channel2 DMA mode disabled

1: DAC channel2 DMA mode enabled

Bits 27:24 MAMP2[3:0] : DAC channel2 mask/amplitude selector

These bits are written by software to select mask in wave generation mode or amplitude in triangle generation mode.

0000: Unmask bit0 of LFSR/ triangle amplitude equal to 1

0001: Unmask bits[1:0] of LFSR/ triangle amplitude equal to 3

0010: Unmask bits[2:0] of LFSR/ triangle amplitude equal to 7

0011: Unmask bits[3:0] of LFSR/ triangle amplitude equal to 15

0100: Unmask bits[4:0] of LFSR/ triangle amplitude equal to 31

0101: Unmask bits[5:0] of LFSR/ triangle amplitude equal to 63

0110: Unmask bits[6:0] of LFSR/ triangle amplitude equal to 127

0111: Unmask bits[7:0] of LFSR/ triangle amplitude equal to 255

1000: Unmask bits[8:0] of LFSR/ triangle amplitude equal to 511

1001: Unmask bits[9:0] of LFSR/ triangle amplitude equal to 1023

1010: Unmask bits[10:0] of LFSR/ triangle amplitude equal to 2047

≥ 1011: Unmask bits[11:0] of LFSR/ triangle amplitude equal to 4095

Bits 23:22 WAVE2[1:0] : DAC channel2 noise/triangle wave generation enable

These bits are set/reset by software.

00: wave generation disabled

01: Noise wave generation enabled

1x: Triangle wave generation enabled

Note: Only used if bit TEN2 = 1 (DAC channel2 trigger enabled)

Bits 21:19 TSEL2[2:0] : DAC channel2 trigger selection

These bits select the external event used to trigger DAC channel2

000: Timer 6 TRGO event

001: Timer 8 TRGO event

010: Timer 7 TRGO event

011: Timer 5 TRGO event

100: Timer 2 TRGO event

101: Timer 4 TRGO event

110: External line9

111: Software trigger

Note: Only used if bit TEN2 = 1 (DAC channel2 trigger enabled).

Bit 18 TEN2 : DAC channel2 trigger enable

This bit is set and cleared by software to enable/disable DAC channel2 trigger

0: DAC channel2 trigger disabled and data written into the DAC_DHRx register are transferred one APB1 clock cycle later to the DAC_DOR2 register

1: DAC channel2 trigger enabled and data from the DAC_DHRx register are transferred three APB1 clock cycles later to the DAC_DOR2 register

Note: When software trigger is selected, the transfer from the DAC_DHRx register to the DAC_DOR2 register takes only one APB1 clock cycle.

Bit 17 BOFF2 : DAC channel2 output buffer disable

This bit is set and cleared by software to enable/disable DAC channel2 output buffer.

0: DAC channel2 output buffer enabled

1: DAC channel2 output buffer disabled

Bit 16 EN2 : DAC channel2 enable

This bit is set and cleared by software to enable/disable DAC channel2.

0: DAC channel2 disabled

1: DAC channel2 enabled

Bits 15:14 Reserved, must be kept at reset value.

Bit 13 DMAUDRIE1 : DAC channel1 DMA Underrun Interrupt enable

This bit is set and cleared by software.

0: DAC channel1 DMA Underrun Interrupt disabled

1: DAC channel1 DMA Underrun Interrupt enabled

Bit 12 DMAEN1 : DAC channel1 DMA enable

This bit is set and cleared by software.

0: DAC channel1 DMA mode disabled

1: DAC channel1 DMA mode enabled

Bits 11:8 MAMP1[3:0]: DAC channel1 mask/amplitude selector

These bits are written by software to select mask in wave generation mode or amplitude in triangle generation mode.

0000: Unmask bit0 of LFSR/ triangle amplitude equal to 1

0001: Unmask bits[1:0] of LFSR/ triangle amplitude equal to 3

0010: Unmask bits[2:0] of LFSR/ triangle amplitude equal to 7

0011: Unmask bits[3:0] of LFSR/ triangle amplitude equal to 15

0100: Unmask bits[4:0] of LFSR/ triangle amplitude equal to 31

0101: Unmask bits[5:0] of LFSR/ triangle amplitude equal to 63

0110: Unmask bits[6:0] of LFSR/ triangle amplitude equal to 127

0111: Unmask bits[7:0] of LFSR/ triangle amplitude equal to 255

1000: Unmask bits[8:0] of LFSR/ triangle amplitude equal to 511

1001: Unmask bits[9:0] of LFSR/ triangle amplitude equal to 1023

1010: Unmask bits[10:0] of LFSR/ triangle amplitude equal to 2047

≥ 1011: Unmask bits[11:0] of LFSR/ triangle amplitude equal to 4095

Bits 7:6 WAVE1[1:0]: DAC channel1 noise/triangle wave generation enable

These bits are set and cleared by software.

00: wave generation disabled

01: Noise wave generation enabled

1x: Triangle wave generation enabled

Note: Only used if bit TEN1 = 1 (DAC channel1 trigger enabled).

Bits 5:3 TSEL1[2:0]: DAC channel1 trigger selection

These bits select the external event used to trigger DAC channel1.

000: Timer 6 TRGO event

001: Timer 8 TRGO event

010: Timer 7 TRGO event

011: Timer 5 TRGO event

100: Timer 2 TRGO event

101: Timer 4 TRGO event

110: External line9

111: Software trigger

Note: Only used if bit TEN1 = 1 (DAC channel1 trigger enabled).

Bit 2 TEN1: DAC channel1 trigger enable

This bit is set and cleared by software to enable/disable DAC channel1 trigger.

0: DAC channel1 trigger disabled and data written into the DAC_DHRx register are transferred one APB1 clock cycle later to the DAC_DOR1 register

1: DAC channel1 trigger enabled and data from the DAC_DHRx register are transferred three APB1 clock cycles later to the DAC_DOR1 register

Note: When software trigger is selected, the transfer from the DAC_DHRx register to the DAC_DOR1 register takes only one APB1 clock cycle.

Bit 1 BOFF1: DAC channel1 output buffer disable

This bit is set and cleared by software to enable/disable DAC channel1 output buffer.

0: DAC channel1 output buffer enabled

1: DAC channel1 output buffer disabled

Bit 0 EN1: DAC channel1 enable

This bit is set and cleared by software to enable/disable DAC channel1.

0: DAC channel1 disabled

1: DAC channel1 enabled

16.5.2 DAC software trigger register (DAC_SWTRIGR)

Address offset: 0x04

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SWTRIG2SWTRIG1
ww

Bits 31:2 Reserved, must be kept at reset value.

Bit 1 SWTRIG2 : DAC channel2 software trigger

This bit is set and cleared by software to enable/disable the software trigger.

0: Software trigger disabled

1: Software trigger enabled

Note: This bit is cleared by hardware (one APB1 clock cycle later) once the DAC_DHR2 register value has been loaded into the DAC_DOR2 register.

Bit 0 SWTRIG1 : DAC channel1 software trigger

This bit is set and cleared by software to enable/disable the software trigger.

0: Software trigger disabled

1: Software trigger enabled

Note: This bit is cleared by hardware (one APB1 clock cycle later) once the DAC_DHR1 register value has been loaded into the DAC_DOR1 register.

16.5.3 DAC channel1 12-bit right-aligned data holding register (DAC_DHR12R1)

Address offset: 0x08

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.DACC1DHR[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 DACC1DHR[11:0] : DAC channel1 12-bit right-aligned data

These bits are written by software which specifies 12-bit data for DAC channel1.

16.5.4 DAC channel1 12-bit left aligned data holding register (DAC_DHR12L1)

Address offset: 0x0C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
DACC1DHR[11:0]Res.Res.Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:4 DACC1DHR[11:0] : DAC channel1 12-bit left-aligned data
These bits are written by software which specifies 12-bit data for DAC channel1.

Bits 3:0 Reserved, must be kept at reset value.

16.5.5 DAC channel1 8-bit right aligned data holding register (DAC_DHR8R1)

Address offset: 0x10

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.DACC1DHR[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 DACC1DHR[7:0] : DAC channel1 8-bit right-aligned data
These bits are written by software which specifies 8-bit data for DAC channel1.

16.5.6 DAC channel2 12-bit right aligned data holding register (DAC_DHR12R2)

Address offset: 0x14

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.DACC2DHR[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 DACC2DHR[11:0] : DAC channel2 12-bit right-aligned data

These bits are written by software which specifies 12-bit data for DAC channel2.

16.5.7 DAC channel2 12-bit left aligned data holding register (DAC_DHR12L2)

Address offset: 0x18

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
DACC2DHR[11:0]Res.Res.Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:4 DACC2DHR[11:0] : DAC channel2 12-bit left-aligned data

These bits are written by software which specify 12-bit data for DAC channel2.

Bits 3:0 Reserved, must be kept at reset value.

16.5.8 DAC channel2 8-bit right-aligned data holding register (DAC_DHR8R2)

Address offset: 0x1C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.DACC2DHR[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 DACC2DHR[7:0] : DAC channel2 8-bit right-aligned data

These bits are written by software which specifies 8-bit data for DAC channel2.

16.5.9 Dual DAC 12-bit right-aligned data holding register (DAC_DHR12RD)

Address offset: 0x20

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.DACC2DHR[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.DACC1DHR[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value.

Bits 27:16 DACC2DHR[11:0] : DAC channel2 12-bit right-aligned data

These bits are written by software which specifies 12-bit data for DAC channel2.

Bits 15:12 Reserved, must be kept at reset value.

Bits 11:0 DACC1DHR[11:0] : DAC channel1 12-bit right-aligned data

These bits are written by software which specifies 12-bit data for DAC channel1.

16.5.10 DUAL DAC 12-bit left aligned data holding register (DAC_DHR12LD)

Address offset: 0x24

Reset value: 0x0000 0000

31302928272625242322212019181716
DACC2DHR[11:0]Res.Res.Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
DACC1DHR[11:0]Res.Res.Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:20 DACC2DHR[11:0] : DAC channel2 12-bit left-aligned data

These bits are written by software which specifies 12-bit data for DAC channel2.

Bits 19:16 Reserved, must be kept at reset value.

Bits 15:4 DACC1DHR[11:0] : DAC channel1 12-bit left-aligned data

These bits are written by software which specifies 12-bit data for DAC channel1.

Bits 3:0 Reserved, must be kept at reset value.

16.5.11 DUAL DAC 8-bit right aligned data holding register (DAC_DHR8RD)

Address offset: 0x28

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
DACC2DHR[7:0]DACC1DHR[7:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:8 DACC2DHR[7:0] : DAC channel2 8-bit right-aligned data

These bits are written by software which specifies 8-bit data for DAC channel2.

Bits 7:0 DACC1DHR[7:0] : DAC channel1 8-bit right-aligned data

These bits are written by software which specifies 8-bit data for DAC channel1.

16.5.12 DAC channel1 data output register (DAC_DOR1)

Address offset: 0x2C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.DACC1DOR[11:0]
rrrrrrrrrrrr

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 DACC1DOR[11:0] : DAC channel1 data output

These bits are read-only, they contain data output for DAC channel1.

16.5.13 DAC channel2 data output register (DAC_DOR2)

Address offset: 0x30

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.DACC2DOR[11:0]
rrrrrrrrrrrr

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 DACC2DOR[11:0] : DAC channel2 data output

These bits are read-only, they contain data output for DAC channel2.

16.5.14 DAC status register (DAC_SR)

Address offset: 0x34

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.DMAUDR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.DMAUDR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rc_w1

Bits 31:30 Reserved, must be kept at reset value.

Bit 29 DMAUDR2 : DAC channel2 DMA underrun flag

This bit is set by hardware and cleared by software (by writing it to 1).

0: No DMA underrun error condition occurred for DAC channel2

1: DMA underrun error condition occurred for DAC channel2 (the currently selected trigger is driving DAC channel2 conversion at a frequency higher than the DMA service capability rate)

Bits 28:14 Reserved, must be kept at reset value.

Bit 13 DMAUDR1 : DAC channel1 DMA underrun flag

This bit is set by hardware and cleared by software (by writing it to 1).

0: No DMA underrun error condition occurred for DAC channel1

1: DMA underrun error condition occurred for DAC channel1 (the currently selected trigger is driving DAC channel1 conversion at a frequency higher than the DMA service capability rate)

Bits 12:0 Reserved, must be kept at reset value.

16.5.15 DAC register map

Table 104 summarizes the DAC registers.

Table 104. DAC register map

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x00DAC_CRRes.Res.DMAUDRIE2DMAEN2MAMP2[3:0]WAVE2[2:0]TSEL2[2:0]TEN2BOFF2EN2Res.Res.DMAUDRIE1DMAEN1MAMP1[3:0]WAVE1[2:0]TSEL1[2:0]TEN1BOFF1EN1
Reset value0000000000000000000000000000
0x04DAC_SWTRIGRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SWTRIG2SWTRIG1
Reset value00
0x08DAC_DHR12R1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC1DHR[11:0]
Reset value00000000000
0x0CDAC_DHR12L1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC1DHR[11:0]
Reset value000000000000000
0x10DAC_DHR8R1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC1DHR[7:0]
Reset value00000000000
0x14DAC_DHR12R2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC2DHR[11:0]
Reset value00000000000
0x18DAC_DHR12L2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC2DHR[11:0]
Reset value000000000000000
0x1CDAC_DHR8R2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC2DHR[7:0]
Reset value00000000000
0x20DAC_DHR12RDRes.Res.Res.Res.DACC2DHR[11:0]Res.Res.Res.Res.DACC1DHR[11:0]
Reset value000000000000000000000000
0x24DAC_DHR12LDDACC2DHR[11:0]ReservedDACC1DHR[11:0]
Reset value0000000000000000000000000000
0x28DAC_DHR8RDRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC2DHR[7:0]
Reset value000000000000000
0x2CDAC_DOR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC1DOR[11:0]
Reset value00000000000
0x30DAC_DOR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DACC2DOR[11:0]
Reset value00000000000
0x34DAC_SRRes.Res.DMAUDR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DMAUDR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00

Refer to Section 2.2 on page 69 for the register boundary addresses.