HAL SAI Overview

Introducing SAI

group SAI_Introduction

  • This introduction is under development.

Module and files

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

Module and files diagram

Component diagram

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



package "HAL" {

    [HAL_SERVICE]

    [HAL_SAI]

    [HAL_DMA]

}



package "Low Layer" {

    [CMSIS]

    [SAI Interrupt routine service]

    [DMA Interrupt routine service]

}



package "HW" {

    [STM32_HW]

}



[Appli] --> [HAL_SAI] : HAL SAI API

[Appli] <-- [HAL_SAI] : SAI callback

[HAL_SAI] -r-> [HAL_DMA] : Call DMA APIs

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

[HAL_SAI] <-- [SAI Interrupt routine service]

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

[HAL_SAI] --> [CMSIS]:SAI register def

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

[STM32_HW] -u--> [SAI Interrupt routine service]: SAIx Irq

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

[STM32_HW] <-l-- [HAL_SAI] : SAI registers R/W

@enduml

Configuration table

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

group SAI_Configuration_Table

Configuration inside the HAL SAI driver:

Config defines

Where

Default value

Note

USE_HAL_SAI_MODULE

hal_conf.h

1

Enable the HAL SAI module

USE_HAL_SAI_REGISTER_CALLBACKS

hal_conf.h

0

Allow user to define his own callback

USE_HAL_SAI_CLK_ENABLE_MODEL

hal_conf.h

HAL_CLK_ENABLE_NO

Enable the gating of the peripheral clock

USE_HAL_SAI_USER_DATA

hal_conf.h

0

Add an user data inside HAL SAI handle

USE_HAL_SAI_GET_LAST_ERRORS

hal_conf.h

0

Enable retrieving last processes error codes

USE_HAL_SAI_DMA

hal_conf.h

1

Enable DMA code inside HAL SAI

USE_HAL_CHECK_PARAM

hal_conf.h

0

Enable checking of vital parameters at runtime

USE_HAL_MUTEX

hal_conf.h

0

Enable the use of semaphore in the HAL driver

USE_HAL_CHECK_PROCESS_STATE

hal_conf.h

0

Enable atomic access to process state check

USE_ASSERT_DBG_PARAM

PreProcessor env

NONE

Enable check parameters for HAL

USE_ASSERT_DBG_STATE

PreProcessor env

NONE

Enable check state for HAL