cancel
Showing results for 
Search instead for 
Did you mean: 

SAI: SPDIF output in all MCUs ?

LCE
Principal II

Heyho,

do all SAIs in all MCUs offer the SPDIF output feature?

CubeMx and online MCU selectors do not show this info, no time to check 20 more datasheets.

For the few STM32 I know and worked or played with (G4, F7, H7) the answer is yes.

Merci!

4 REPLIES 4
AScha.3
Super User

Hi,

you tried using the SPDIF output ? works really ?

Because i looked at the details and there (on H743) is no subcode etc inserted,so its just a basic serial output in NRZ format, but no real full SPDIF .

+

see , what our AI telling:

 

1. General SAI SPDIF Output Support Across STM32 MCUs

Not all SAI peripherals in all STM32 MCUs support the SPDIF output feature. For example, STM32L4, STM32L4+, STM32U3, and STM32U5 devices offer SPDIF output only when the audio block is configured as a transmitter. The availability of this feature depends on the specific device and SAI instance, as indicated in the official documentation tables and descriptions.


2. Supported Series and Limitations

  • STM32L4, STM32L4+, STM32U3, STM32N6x5xx/N6x7xx: These series generally support SPDIF output when the SAI is configured as a transmitter. However, the number of SAI instances and the availability of SPDIF output may vary by device and instance.
  • Device Sub-Family Restrictions: For example, in the STM32L4 series, only certain sub-families (STM32L43/44/45/46xxx and STM32L47/48/49/4Axxx) provide SAI1 or SAI1/SAI2 instances, and SPDIF output is not available on STM32L41/42xxx devices.
  • Instance-Specific Features: Some features, such as PDM, may only be available on specific SAI instances (e.g., SAI1).

It is important to consult the specific device's documentation for detailed support and configuration options.


3. Series and Instances Without SPDIF Output or With Restrictions

  • STM32U0: I2S/SAI is not present, so SPDIF output is not supported.
  • STM32L41/42xxx, STM32U35/545: No SAI is available, so SPDIF output is not supported.
  • STM32F427/437, STM32F429/439: Only SAI1 is available, and SPDIF is not supported.
  • STM32H573/563, STM32H562: Both SAI1 and SAI2 are available, but SPDIF is not supported.
  • STM32L5, STM32U5: SPDIF output is only available when the audio block is configured as a transmitter.
  • STM32N6x5xx, STM32N6x7xx: SPDIF output is available if required, but not always present.

Summary

No, not all SAI peripherals in all STM32 MCUs offer the SPDIF output feature. The availability of SPDIF output depends on the specific STM32 series, device sub-family, and SAI instance. Some series do not support SAI or SPDIF at all, while others have restrictions or only support SPDIF output in certain configurations.

For additional support or to discuss your specific application with ST experts, you’re welcome to join conversations in STM32 forums.

If you feel a post has answered your question, please click "Accept as Solution".
LCE
Principal II

you tried using the SPDIF output ? works really ?

Yes. That was the first useful stuff I did with an STM32 (G4), and always used it in other projects for testing, so far on:

  • Nucleo-G431
  • F767 (Nucleo and custom board)
  • H723 & H735 (Nucleo and custom board)

No problems with simple sine output. Using that to test out SPDIF input cards, and I love to see this perfect digitally created sine (THD+N > 140dB) in our analyser SW. :D
Getting some non-audio user data into the stream was a bit fiddly, but that works too.

 

> AI answer

Thanks for trying, but these AI answers recently were too often wrong, at least in the important details.
Example:

LCE_0-1763731697350.png

compare to AI answer above... :D

 

So fiddling the status bits etc in the stream before sending, yes , that should work.

But i would not call this a SPDIF output module, its just a  biphase mark code transmitter, the spdif comes with manually puzzling the stream together from data and control words, to get a working spdif stream. Right ?

 

+

asking AI about this:  is SAI spdif output avail in H563 serie ?

SAI SPDIF Output Availability in STM32H563 Series

The STM32H563 series supports SPDIF output via its Serial Audio Interface (SAI) peripheral. Both SAI1 and SAI2 blocks on STM32H563xx devices are capable of SPDIF output when configured as transmitters.


Supported SAI Blocks and Configuration Requirements

  • SAI Blocks: Both SAI1 and SAI2 can be used for SPDIF output.
  • Configuration: To enable SPDIF output, configure the SAI audio block as a transmitter. The SAI peripheral supports a wide range of audio protocols, including SPDIF, and offers flexible options such as master/slave mode, configurable data size (8- to 32-bit), and various frame/slot settings. For SPDIF, the block must be set as a transmitter, and the protocol/frame configuration must match SPDIF requirements.

How to Configure SAI for SPDIF Output & Special Considerations

  • Register Settings:
    • Set PRTCFG[1:0] bits to 01 in the SAI_xCR1 register to select SPDIF mode.
    • Only the SD data line is enabled; FS, SCK, and MCLK I/Os are unused.
    • MODE[1] is forced to 0 (master mode), enabling the SAI's clock generator.
    • Data size is fixed at 24 bits; DS[2:0] bits are ignored.
    • The SAI's clock generator must be set so the bit clock is twice the symbol rate (Manchester coding).
    • SAI_xFRCR and SAI_xSLOTR registers are ignored in SPDIF mode.
  • SPDIF Frame Structure:
    • Each SPDIF block contains 192 frames, each with two 32-bit subframes (left/right channels), with 24 data bits and 4 status bits per subframe.
  • Limitations:
    • SPDIF is available only in transmitter mode.
    • Data size is fixed at 24 bits.
    • Only the SD line is used for data output.
    • The configuration is more restricted compared to other audio protocols to comply with SPDIF requirements.

Summary

Yes, the STM32H563 series supports SAI SPDIF output on both SAI1 and SAI2 blocks, but only in transmitter mode. Configuration requires setting the SAI to SPDIF mode with specific register settings, and there are some limitations such as fixed data size and use of only the SD line.

If you feel a post has answered your question, please click "Accept as Solution".
jhonwillaim21
Visitor

Hey, thanks for raising this question! From my experience with STM32 MCUs like G4, F7, and H7, the SAI modules do support SPDIF output, which makes audio interface projects much easier. I agree that CubeMX and online selectors don’t clearly indicate this, so checking datasheets is sometimes unavoidable. It would be great if ST could provide a consolidated table showing which MCUs fully support SPDIF that would save a lot of time for developers.