deleted>Frq08988 mNo edit summary |
Registered User Tag: 2017 source edit |
||
(45 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
{{ | |MPUs list=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | |||
}} | |||
<noinclude></noinclude> | |||
</noinclude> | |||
==Article purpose== | ==Article purpose== | ||
The purpose of this article is to: | The purpose of this article is to: | ||
* briefly introduce the SAI peripheral and its main features | * briefly introduce the SAI peripheral and its main features, | ||
* indicate the | * indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts), | ||
* list the software frameworks and drivers managing the peripheral, | |||
* explain how to configure the | * explain how to configure the peripheral. | ||
==Peripheral overview== | ==Peripheral overview== | ||
The SAI (Serial Audio Interface) offers a wide set of audio protocols, such as: I2S standards (LSB or MSB-justified), PCM/DSP, TDM and S/PDIF. The SAI contains two independent audio sub-blocks. Each sub-block has its own clock generator and I/O line controller, and can be configured either as transmitter or receiver. | The '''SAI''' (Serial Audio Interface) peripheral offers a wide set of audio protocols, such as: I2S standards (LSB or MSB-justified), PCM/DSP, TDM and S/PDIF. The SAI contains two independent audio sub-blocks. Each sub-block has its own clock generator and I/O line controller, and can be configured either as transmitter or receiver. | ||
Refer to the [[STM32 MPU resources#Reference manuals|STM32 MPU reference manuals]] for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented. | |||
Refer to [[ | |||
== | ==Peripheral usage== | ||
This chapter is applicable in the scope of the '''OpenSTLinux BSP''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-A processor(s), and the '''FwST-M Package''' running on the Arm<sup>®</sup> Cortex<sup>®</sup>-M processor. | |||
== | ===Boot time assignment=== | ||
=== | ====On {{MicroprocessorDevice | device=1}}==== | ||
The SAI is not used at boot time. | The SAI peripheral is not used at boot time. | ||
=== | ====On {{MicroprocessorDevice | device=2}}==== | ||
==== | =====For {{TrustedDomainFlavor|flavor=A35-TD}}===== | ||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_a35_boottime}} | |||
<section begin=stm32mp21_a35_boottime /> | |||
| rowspan="4" | Audio | |||
| rowspan="4" | [[SAI internal peripheral | SAI]] | |||
| SAI1 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| SAI2 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| SAI3 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
| SAI4 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
|- | |||
<section end=stm32mp21_a35_boottime /> | |||
|} | |||
=====For {{TrustedDomainFlavor|flavor=M33-TD}}===== | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp2_m33_boottime}} | |||
<section begin=stm32mp21_m33_boottime /> | |||
| rowspan="4" | Audio | |||
| rowspan="4" | [[SAI internal peripheral | SAI]] | |||
| SAI1 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
| | |||
|- | |||
| SAI2 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
| | |||
|- | |||
| SAI3 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
| | |||
|- | |||
| SAI4 | |||
| | |||
| | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| | |||
| | |||
|- | |||
<section end=stm32mp21_m33_boottime /> | |||
|} | |||
==== | ===Runtime assignment=== | ||
{{: | ====On {{MicroprocessorDevice | device=13}}==== | ||
| Audio | {{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp13_runtime}} | ||
| [[SAI internal peripheral|SAI]] | <section begin=stm32mp13_runtime /> | ||
| rowspan="2" | Audio | |||
| rowspan="2" | [[SAI internal peripheral|SAI]] | |||
| SAI1 | |||
| | | | ||
| | | <span title="assignable peripheral" style="font-size:21px">☐</span> | ||
| Assignment (single choice) | |||
| | |||
|- | |- | ||
|} | | SAI2 | ||
| | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| Assignment (single choice) | |||
|- | |||
<section end=stm32mp13_runtime /> | |||
|} | |||
==== | ====On {{MicroprocessorDevice | device=15}}==== | ||
{{#lst:STM32MP1_internal_peripherals_assignment_table_template|stm32mp15_runtime}} | |||
<section begin=stm32mp15_runtime /> | |||
{{: | |||
< | |||
| rowspan="4" | Audio | | rowspan="4" | Audio | ||
| rowspan="4" | [[SAI internal peripheral|SAI]] | | rowspan="4" | [[SAI internal peripheral|SAI]] | ||
Line 85: | Line 141: | ||
| Assignment (single choice) | | Assignment (single choice) | ||
|- | |- | ||
</ | <section end=stm32mp15_runtime /> | ||
|} | |||
====On {{MicroprocessorDevice | device=21}} and {{MicroprocessorDevice | device=23}}==== | |||
The tables below are applicable to any {{TrustedDomainFlavor | flavor=Any-TD}}. | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp21_23_runtime}} | |||
<section begin=stm32mp21_a35_runtime /><section begin=stm32mp21_m33_runtime /><section begin=stm32mp23_a35_runtime /><section begin=stm32mp23_m33_runtime /> | |||
| rowspan="4" | Audio | |||
| rowspan="4" | [[SAI internal peripheral | SAI]] | |||
| SAI1 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |||
| SAI2 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |||
| SAI3 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |||
| SAI4 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
|- | |||
<section end=stm32mp21_a35_runtime /><section end=stm32mp21_m33_runtime /><section end=stm32mp23_a35_runtime /><section end=stm32mp23_m33_runtime /> | |||
|} | |||
====On {{MicroprocessorDevice | device=25}}==== | |||
The tables below are applicable to any {{TrustedDomainFlavor | flavor=Any-TD}}. | |||
{{#lst:STM32MP2_internal_peripherals_assignment_table_template|stm32mp25_runtime}} | |||
<section begin=stm32mp25_a35_runtime /><section begin=stm32mp25_m33_runtime /> | |||
| rowspan="4" | Audio | |||
| rowspan="4" | [[SAI internal peripheral | SAI]] | |||
| SAI1 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
| | |||
|- | |||
| SAI2 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
| | |||
|- | |||
| SAI3 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
| | |||
|- | |||
| SAI4 | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span><sup>OP-TEE</sup> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| <span title="assignable peripheral but not supported" style="font-size:21px">⬚</span> | |||
| <span title="assignable peripheral" style="font-size:21px">☐</span> | |||
| | |||
| | |||
|- | |||
<section end=stm32mp25_a35_runtime /><section end=stm32mp25_m33_runtime /> | |||
|} | |||
==Software frameworks and drivers == | |||
Below are listed the software frameworks and drivers managing the SAI peripheral for the embedded software components listed in the above tables. | |||
*'''Linux<sup>®</sup>''': [[ALSA_overview|ALSA framework]] | |||
*'''STM32Cube''': [[STM32CubeMP15 Package architecture|SAI HAL driver]] and {{CodeSource | STM32CubeMP1 | Drivers/STM32MP1xx_HAL_Driver/Inc/stm32mp1xx_hal_sai.h | header file of SAI HAL module}} | |||
==How to assign and configure the peripheral== | |||
The peripheral assignment can be done via the [[STM32CubeMX]] graphical tool (and manually completed if needed).<br /> | |||
This tool also helps to configure the peripheral: | |||
*partial device trees (pin control and clock tree) generation for the OpenSTLinux software components, | |||
*HAL initialization code generation for the STM32CubeMPU Package. | |||
The configuration is applied by the firmware running in the context in which the peripheral is assigned. | |||
When the Arm<sup>®</sup> Cortex<sup>®</sup>-A7 core operates in non-secure access mode, the SAI is controlled by the Linux kernel framework. | |||
Refer to [[SAI Linux driver]] to drive the SAI through Linux kernel [[ALSA_overview|ALSA framework]]. Refer to [[Soundcard configuration]] and [[SAI device tree configuration]] to configure the SAI through the Linux kernel device tree<ref>[[Device tree]]</ref>. | |||
==How to go further== | ==How to go further== | ||
STM32H7 SAI training <ref> [https://www.st.com/content/ccc/resource/training/technical/product_training/group0/d3/c0/b0/0e/fe/eb/40/a9/STM32H7-Peripheral-Serial-Audio-Interface_SAI/files/STM32H7-Peripheral-Serial-Audio-Interface_SAI.pdf/_jcr_content/translations/en.STM32H7-Peripheral-Serial-Audio-Interface_SAI.pdf STM32H7 SAI training]</ref> introduces the SAI features and applications. The SAI versions in STM32H7 and {{MicroprocessorDevice | device=1}} are very close. In consequence this training is also relevant for {{MicroprocessorDevice | device=1}}. The user should refer to the [[STM32MP13 resources#Reference manuals|STM32MP13 reference manuals]] or [[STM32MP15 resources#Reference manuals|STM32MP15 reference manuals]] for a complete description. | |||
==References== | |||
<references /> | |||
<noinclude> | |||
< | [[Category:Audio peripherals]] | ||
{{ArticleBasedOnModel | Internal peripheral article model}} | |||
{{PublicationRequestId | 8893 | 2018-10-17 | PhilipS}} | |||
</noinclude> |
Latest revision as of 10:32, 26 June 2025
1. Article purpose[edit | edit source]
The purpose of this article is to:
- briefly introduce the SAI peripheral and its main features,
- indicate the peripheral instances assignment at boot time and their assignment at runtime (including whether instances can be allocated to secure contexts),
- list the software frameworks and drivers managing the peripheral,
- explain how to configure the peripheral.
2. Peripheral overview[edit | edit source]
The SAI (Serial Audio Interface) peripheral offers a wide set of audio protocols, such as: I2S standards (LSB or MSB-justified), PCM/DSP, TDM and S/PDIF. The SAI contains two independent audio sub-blocks. Each sub-block has its own clock generator and I/O line controller, and can be configured either as transmitter or receiver.
Refer to the STM32 MPU reference manuals for the complete list of features, and to the software frameworks and drivers, introduced below, to see which features are implemented.
3. Peripheral usage[edit | edit source]
This chapter is applicable in the scope of the OpenSTLinux BSP running on the Arm® Cortex®-A processor(s), and the FwST-M Package running on the Arm® Cortex®-M processor.
3.1. Boot time assignment[edit | edit source]
3.1.1. On STM32MP1 series[edit | edit source]
The SAI peripheral is not used at boot time.
3.1.2. On STM32MP2 series[edit | edit source]
3.1.2.1. For A35-TD flavor
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (ROM code) |
Cortex-A35 secure (TF-A BL2) |
Cortex-A35 nonsecure (U-Boot) | |||
Audio | SAI | SAI1 | ⬚ | |||
SAI2 | ⬚ | |||||
SAI3 | ⬚ | |||||
SAI4 | ⬚ |
3.1.2.2. For M33-TD flavor
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Boot time allocation | Comment ![]() | ||||
---|---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (ROM code) |
Cortex-A35 secure (TF-A BL2) |
Cortex-A35 nonsecure (U-Boot) |
Cortex-M33 secure (MCUboot) | |||
Audio | SAI | SAI1 | ⬚ | ||||
SAI2 | ⬚ | ||||||
SAI3 | ⬚ | ||||||
SAI4 | ⬚ |
3.2. Runtime assignment[edit | edit source]
3.2.1. On STM32MP13x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | ||
---|---|---|---|---|---|
Instance | Cortex-A7 secure (OP-TEE) |
Cortex-A7 nonsecure (Linux) | |||
Audio | SAI | SAI1 | ☐ | Assignment (single choice) | |
SAI2 | ☐ | Assignment (single choice) |
3.2.2. On STM32MP15x lines
[edit | edit source]
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | |||
---|---|---|---|---|---|---|
Instance | Cortex-A7 secure (OP-TEE) |
Cortex-A7 nonsecure (Linux) |
Cortex-M4 (STM32Cube) | |||
Audio | SAI | SAI1 | ☐ | ☐ | Assignment (single choice) | |
SAI2 | ☐ | ☐ | Assignment (single choice) | |||
SAI3 | ☐ | ☐ | Assignment (single choice) | |||
SAI4 | ☐ | ☐ | Assignment (single choice) |
3.2.3. On STM32MP21x lines
and STM32MP23x lines
[edit | edit source]
The tables below are applicable to any TD flavor (A35-TD or M33-TD) .
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | ||||
---|---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (OP-TEE / TF-A BL31) |
Cortex-A35 nonsecure (Linux) |
Cortex-M33 secure (TF-M) |
Cortex-M33 nonsecure (STM32Cube) | |||
Audio | SAI | SAI1 | ⬚OP-TEE | ☐ | ⬚ | ☐ | |
SAI2 | ⬚OP-TEE | ☐ | ⬚ | ☐ | |||
SAI3 | ⬚OP-TEE | ☐ | ⬚ | ☐ | |||
SAI4 | ⬚OP-TEE | ☐ | ⬚ | ☐ |
3.2.4. On STM32MP25x lines
[edit | edit source]
The tables below are applicable to any TD flavor (A35-TD or M33-TD) .
Click on to expand or collapse the legend...
Domain | Peripheral | Runtime allocation | Comment ![]() | |||||
---|---|---|---|---|---|---|---|---|
Instance | Cortex-A35 secure (OP-TEE / TF-A BL31) |
Cortex-A35 nonsecure (Linux) |
Cortex-M33 secure (TF-M) |
Cortex-M33 nonsecure (STM32Cube) |
Cortex-M0+ (STM32Cube) | |||
Audio | SAI | SAI1 | ⬚OP-TEE | ☐ | ⬚ | ☐ | ||
SAI2 | ⬚OP-TEE | ☐ | ⬚ | ☐ | ||||
SAI3 | ⬚OP-TEE | ☐ | ⬚ | ☐ | ||||
SAI4 | ⬚OP-TEE | ☐ | ⬚ | ☐ |
4. Software frameworks and drivers[edit | edit source]
Below are listed the software frameworks and drivers managing the SAI peripheral for the embedded software components listed in the above tables.
- Linux®: ALSA framework
- STM32Cube: SAI HAL driver and header file of SAI HAL module
5. How to assign and configure the peripheral[edit | edit source]
The peripheral assignment can be done via the STM32CubeMX graphical tool (and manually completed if needed).
This tool also helps to configure the peripheral:
- partial device trees (pin control and clock tree) generation for the OpenSTLinux software components,
- HAL initialization code generation for the STM32CubeMPU Package.
The configuration is applied by the firmware running in the context in which the peripheral is assigned.
When the Arm® Cortex®-A7 core operates in non-secure access mode, the SAI is controlled by the Linux kernel framework. Refer to SAI Linux driver to drive the SAI through Linux kernel ALSA framework. Refer to Soundcard configuration and SAI device tree configuration to configure the SAI through the Linux kernel device tree[1].
6. How to go further[edit | edit source]
STM32H7 SAI training [2] introduces the SAI features and applications. The SAI versions in STM32H7 and STM32MP1 series are very close. In consequence this training is also relevant for STM32MP1 series. The user should refer to the STM32MP13 reference manuals or STM32MP15 reference manuals for a complete description.
7. References[edit | edit source]