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

SAI/I2S Support #19

Open
teburd opened this issue Mar 3, 2020 · 7 comments · May be fixed by #143
Open

SAI/I2S Support #19

teburd opened this issue Mar 3, 2020 · 7 comments · May be fixed by #143
Labels
enhancement New feature or request imxrt-hal HAL related issue

Comments

@teburd
Copy link
Member

teburd commented Mar 3, 2020

SAI support would be a great way to make good use of these chips as audio processors

@teburd teburd added imxrt-hal HAL related issue enhancement New feature or request labels Mar 3, 2020
@teburd teburd changed the title SAI Support SAI/I2S Support Mar 3, 2020
@teburd
Copy link
Member Author

teburd commented May 18, 2020

I'm waiting until we have a solid DMA branch before really delving into this. DMA is something I'd like to immediately support with the driver.

In the meantime I'm working on a little no_std modular synth/sampler/sequencer type library for the project I have in mind.

@teburd
Copy link
Member Author

teburd commented Aug 3, 2020

I think I might be waiting forever on the audio support in usb-device unless I start looking to do it myself, which is what I was looking to see before committing time on this

@ChristianS99
Copy link

I want to use a Teensy4.1 with the audio adapter, that is attached via i2s. what needs to be done for that to work?
You mentioned proper DMA for this, what is the state of DMA? Does it need to be implemented in this create, or somewhere else?

BR, Christian

@teburd
Copy link
Member Author

teburd commented Aug 3, 2021

You can do it without DMA, the chances of missing the fill for the FIFO and getting an underflow or overflow error I think increases though as now you need to constantly attempt to keep the SAI FIFO filled (for tx) and drained (for rx).

@mciantyre
Copy link
Member

I want to use a Teensy4.1 with the audio adapter, that is attached via i2s. what needs to be done for that to work?

imxrt-rs/imxrt-iomuxc#3 added SAI pins, so we're set on hardware pin support. To support an I2S adapter on the Teensy 4.1, we would need an SAI driver in the HAL.

what is the state of DMA? Does it need to be implemented in this create, or somewhere else?

We have a proof-of-concept DMA driver in the 0.4 HAL. There's DMA support for SPI, UART, and ADC. SAI support might look similar; just implement a few traits.

@prutschman
Copy link

prutschman commented Jun 15, 2022

I have just started experimenting a bit with this. I agree that DMA is the better way to go here, but if you trigger an interrupt based on the FIFO watermark, and aim to write 4-8 samples per interrupt, the CPU overhead is quite manageable. (About 2% or so, at 96 kHz in a random not-particularly-optimized RTIC hack I've been poking at)

@teburd
Copy link
Member Author

teburd commented Jun 15, 2022

That of course makes perfect sense, very cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request imxrt-hal HAL related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants