cancel
Showing results for 
Search instead for 
Did you mean: 

What is OutputDrive on the SAI Peripheral?

APire.1
Associate

On the STM32 SAI peripheral, there's a member of the SAI_InitTypeDef which is:

  uint32_t OutputDrive;         /*!< Specifies when SAI Block outputs are driven.
                                     This parameter can be a value of @ref SAI_Block_Output_Drive
                                     @note This value has to be set before enabling the audio block
                                           but after the audio block configuration. */

However, I can't find any docs on what that means or does anywhere on the documentation or even on Google. Could someone help me understand it?

Thanks

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
waclawek.jan
Super User

Which STM32?

Cube is open source, so you find out what things do simply by looking into it.

Assuming you use e.g. 'F446, look into STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c to find out what happens with the OutputDrive field:

 hsai->Instance->CR1 |= (hsai->Init.AudioMode | hsai->Init.Protocol |          \

                         hsai->Init.DataSize | hsai->Init.FirstBit |          \

                         ckstr_bits | syncen_bits |                            \

                         hsai->Init.MonoStereoMode | hsai->Init.OutputDrive |  \

                         hsai->Init.NoDivider | (hsai->Init.Mckdiv << 20U));

Okay, so it's planly ORed together with other struct fields into SAIx_CR1.

Then look into the respective header, what are it's values.

#defineSAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV)

#defineSAI_OUTPUTDRIVE_DISABLE0x00000000U

Okay, so it's basically just one bit, SAI_xCR1_OUTDRIV. So now look into the RM:

0693W00000aH3x4QAC.png 

So this bit determines, that if SAI is set as Master, whether the respective SAIx_SD_x pin should be output all the time (if OUTDRIV = 1), or if it should go to high-impedance state whenever the respective SAIEN = 0 i.e. the given SAI block is disabled.

JW

View solution in original post

1 REPLY 1
waclawek.jan
Super User

Which STM32?

Cube is open source, so you find out what things do simply by looking into it.

Assuming you use e.g. 'F446, look into STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c to find out what happens with the OutputDrive field:

 hsai->Instance->CR1 |= (hsai->Init.AudioMode | hsai->Init.Protocol |          \

                         hsai->Init.DataSize | hsai->Init.FirstBit |          \

                         ckstr_bits | syncen_bits |                            \

                         hsai->Init.MonoStereoMode | hsai->Init.OutputDrive |  \

                         hsai->Init.NoDivider | (hsai->Init.Mckdiv << 20U));

Okay, so it's planly ORed together with other struct fields into SAIx_CR1.

Then look into the respective header, what are it's values.

#defineSAI_OUTPUTDRIVE_ENABLE ((uint32_t)SAI_xCR1_OUTDRIV)

#defineSAI_OUTPUTDRIVE_DISABLE0x00000000U

Okay, so it's basically just one bit, SAI_xCR1_OUTDRIV. So now look into the RM:

0693W00000aH3x4QAC.png 

So this bit determines, that if SAI is set as Master, whether the respective SAIx_SD_x pin should be output all the time (if OUTDRIV = 1), or if it should go to high-impedance state whenever the respective SAIEN = 0 i.e. the given SAI block is disabled.

JW