Crate stm32_i2s_v12x

source ·
Expand description

This library supports I2S communication for SPI version 1.2 of STM32 microcontrollers (STM32F1, STM32F2, STM32F4, STM32L0, and STM32L1). This library may also work with SPI version 1.3 (STM32F0 STM32F3 STM32F7 STM32L4 STM32L5)

This library is normally used through a MCU HAL library providing types that implement I2sPeripheral or DualI2sPeripheral. I2sDriver or I2sTransfer objects can be created around I2sPeripheral objects to have a single bus for I2S communication, and DualI2sDriver objects can be created around DualI2sPeripheral for full duplex I2S communication.

§For STM32 MCU HAL implementers

To support I2S by using this library, HAL implementers must implements I2sPeripheral, DualI2sPeripheral and WsPin and trait and reexport this crate. It’s also recommended to create some examples. For reference, implementation and examples are (or will be soon) available in stm32f4xx-hal.

§For I2S users

You should use use this library through a MCU HAL. For fine control and advanced usage, see the driver module. For quick and basic usage, see the transfer module.

§About PCM standards

Almost all information you can get about PCM mode in STM32 datasheets are wrong, or confusing at least. Compared to other modes:

  • PCM is monophonic; this is why the Channel flag information is meaningless.
  • With the same prescaler configuration, the sampling frequency is doubled. This is because the bit rate is the same with half the samples.
  • When master clock is enabled, its frequency is 128 * sampling_frequency, instead of 256 * sampling_frequency.

§Issues and limitations

  • In master transmit mode, the CHSIDE flag appears to be sporadically wrong, so don’t use it.
  • Depending on your chip, data corruption may occur under some configurations. Check the errata of your chip for more information.

Modules§

Traits§

  • An object that can be used for full duplex I2S communication.
  • An object composed of a SPI device that can be used for I2S communication.
  • A pin carrying the WS (word select) signal from/to an i2s peripheral.