HAL ADC Overview

Introducing ADC

group ADC_Introduction

  • This introduction is under development.

Module and files

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

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the ADC 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 ADC Software Component Diagram



package "HAL" {

    [HAL_SERVICE]

    [HAL_ADC]

    [HAL_DMA]

}



package "Low Layer" {

    [LL_ADC]

    [CMSIS]

    [ADC Interrupt routine service]

    [DMA Interrupt routine service]

}



package "HW" {

    [STM32_HW]

}



[Appli] --> [HAL_ADC] : HAL ADC API

[Appli] <-- [HAL_ADC] : ADC callback

[HAL_ADC] --> [LL_ADC] : LL ADC API

[HAL_ADC] -r-> [HAL_DMA] : HAL DMA API\n(StartPeriphXfer, Abort, ...)

[HAL_ADC] -l-> [HAL_SERVICE] : HAL generic API\n(get tick, device ID, ...)

[HAL_ADC] <-- [ADC Interrupt routine service]

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

[LL_ADC] --> [CMSIS]:ADC register def

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

[STM32_HW] -u--> [ADC Interrupt routine service]: ADCx Irq

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

[STM32_HW] <-u-- [LL_ADC] : ADC registers R/W

@enduml

Configuration table

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

group ADC_Configuration_Table

Configuration inside the ADC driver

Config defines

Description

Default value

Note

USE_HAL_ADC_MODULE

from hal_conf.h

1

When set, HAL ADC module is enabled

USE_HAL_ADC_DMA

from hal_conf.h

1

Enable DMA code inside ADC

USE_HAL_ADC_REGISTER_CALLBACKS

from hal_conf.h

0

When defined, enable the register callbacks assert

USE_HAL_ADC_CLK_ENABLE_MODEL

from hal_conf.h

HAL_CLK_ENABLE_NO

Enable gating of the peripheral clock

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Parameters (pointers or sizes) are checked in runtime

USE_HAL_CHECK_PROCESS_STATE

from hal_conf.h

0

When set, enable atomic access to process state check

USE_ASSERT_DBG_PARAM

from PreProcessor env

None

When defined, enable the params assert

USE_ASSERT_DBG_STATE

from PreProcessor env

None

When defined, enable the state assert

ADC_INST_IN_COMMON_COUNT

from CMSIS

None

When defined and value > 2, multiple ADC handles can be linked

ADC_MULTIMODE_SUPPORT

from CMSIS

None

When defined, multimode features available