Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add I2S communication using SPI peripherals #265

Merged
merged 14 commits into from
Apr 15, 2021
Merged

Conversation

samcrow
Copy link
Contributor

@samcrow samcrow commented Feb 7, 2021

Introduction

Welcome to my first large pull request, which adds support for I2S audio communication using supported SPI peripherals. Like the way we support CAN with the bxcan library, I am proposing to support I2S using my stm32_i2s_v12x library.

Although stm32_i2s_v12x is in a separate repository, we can also talk about it here.

Notes

  • The I2S module is available if the i2s feature is enabled, in order to not increase compile time for applications that don't use I2S.
  • All four modes are supported: master transmit, master receive, slave transmit, and slave receive.
  • Basic support for DMA, interrupts, and error detection is provided.
  • All STM32F4 models are supported.
  • I added two examples that run on the STM32F411E-DISCO board and send audio to the on-board DAC. One of them uses DMA.

These changes are not perfect, so criticism and suggestions are welcome.

Limitations

  • No support for full-duplex communication
  • I have tested master transmit mode fairly thoroughly, but have not tested the other modes.
  • No support for embedded-hal I2S traits
    • The I2S pull request is still under review. The proposed traits look compatible with this driver code. Until that pull request gets merged and released, people can still use this driver code directly.

Related work

@jkristell
Copy link
Contributor

I tested this on the Stm32F407G-DISC1 and it seems to work fine there as well.

@phoracek
Copy link

Works for me on my STM32F407G-DISC1 too. The only not I'd have is to lower the volume down to -100. The current one blasted my ears.

Thanks a lot for this patch @samcrow, I was struggling to get I2S work on my board for a while.

Copy link
Member

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks excellent. Let's get that in now.

bors r+

@bors bors bot merged commit 98d7bc1 into stm32-rs:master Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants