HAL DAC Overview

Introducing DAC

group DAC_Introduction

  • This introduction is under development.

Module and files

The following diagram illustrates the DAC module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the DAC module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.



@startuml

<style>

componentDiagram {

   arrow {

      FontSize 8

   }

}

</style>



title DAC Software Component Diagram



package "HAL" {

    [HAL_SERVICE]

    [HAL_DAC]

    [HAL_DMA]

}



package "Low Layer" {

    [LL_DAC]

    [CMSIS]

    [DAC Interrupt routine service]

    [DMA Interrupt routine service]

}



package "HW" {

    [STM32_HW]

}



[Appli] --> [HAL_DAC] : HAL DAC API

[Appli] <-- [HAL_DAC] : DAC callback

[HAL_DAC] --> [LL_DAC] : LL DAC API

[HAL_DAC] -r-> [HAL_DMA] : HAL DMA_Start_IT\nHAL_DMA_Abort_IT

[HAL_DAC] -l-> [HAL_SERVICE] : HAL_GetTick

[HAL_DAC] <-- [DAC Interrupt routine service]

[HAL_DAC] <-r- [HAL_DMA]:Half transfer complete\nTransfer complete\nError

[LL_DAC] --> [CMSIS]:DAC register def

[HAL_DMA] <-d- [DMA Interrupt routine service]

[STM32_HW] -u--> [DAC Interrupt routine service]: DACx Irq

[STM32_HW] -u--> [DMA Interrupt routine service] : DMA Channel Irq

[STM32_HW] <-u-- [LL_DAC] : DAC registers R/W

@enduml

Configuration table

The following table lists the configuration defines for the HAL DAC module, specifying their locations, default values, and descriptions:

group DAC_Configuration_Table

Configuration inside the DAC driver

Config defines

Description

Default value

Note

USE_HAL_DAC_MODULE

hal_conf.h

1

HAL DAC module is enabled

USE_HAL_DAC_USER_DATA

hal_conf.h

0

enable the user data

USE_HAL_DAC_REGISTER_CALLBACKS

hal_conf.h

0

enable the register callbacks assert

DAC_CHANNEL2_SUPPORT

stm32u599xx.h

1

DAC channel 2 is available (only on specific devices)

USE_HAL_DAC_DUAL_CHANNEL

hal_conf.h

1

DAC dual channel mode is available

USE_HAL_DAC_CLK_ENABLE_MODEL

hal_conf.h

HAL_CLK_ENABLE_NO

else, clock is enabled inside HAL_DAC_Init()

USE_HAL_DAC_DMA

hal_conf.h

1

to use the DMA with the DAC

USE_HAL_CHECK_PARAM

hal_conf.h

0

to use the run-time checks on function parameters

USE_HAL_CHECK_PROCESS_STATE

hal_conf.h

0

to use the run-time checks on the state during processing

USE_ASSERT_DBG_PARAM

Pre-processor env

None

to use the assert checks on function parameters

USE_ASSERT_DBG_STATE

Pre-processor env

None

to use the assert checks on module state

USE_HAL_DAC_GET_LAST_ERRORS

hal_conf.h

0

records the errors occurred during DAC channel processing