dotnet / iot

This repo includes .NET Core implementations for various IoT boards, chips, displays and PCBs.
MIT License
2.12k stars 574 forks source link

I2S Missing #2294

Open DevInOrbit opened 3 months ago

DevInOrbit commented 3 months ago

Can not locate I2S samples or related classes. Did support for I2S get removed?

pgrawehr commented 3 months ago

As far as I know, it was never there. What exactly do you want to do?

DevInOrbit commented 3 months ago

Reading from a mems microphone (INMP441) using I2S. I am unsure how I would generate the serial clock signal and properly sample the SD pin to get valid PCM data back. Any direction on this would be much appreciated.

Ellerbach commented 3 months ago

I2S is implemented on the .NET nanoFramework side and you can take inspiration on the API: https://github.com/nanoframework/System.Device.I2s

On a Linux system, it will be different, the system you are using needs to support it at the driver level, you may have to add couple of elements.

On a Raspberry Pi, just activate the feature like this:

sudo nano /boot/config.txt

Uncomment the line or add it dtparam=i2s=on

Reboot.

Now, accessing it is a more complicated story. You can look at tools like alsa-utils to see how they are using I2S and use interoperability or even directly use the tools under a command line.