not sure if python versions are viable. none of the libraries i’ve seen were compiled for riscv.
Honestly I haven’t been able to do it yet, I’m not even sure that by soldering an electret microphone then the circuit will work. However, I saw that from today the new Duo S has appeared:
http://milkv.io/duo-s
Linux device drivers for the mic input are not enabled in the latest SDK builds. There are a few threads on the forum that claim to have step-by-step instructions for the necessary changes for enabling audio but I’ve tried them without success. I suspect this area needs more focused attention from the core developers to ensure it’s working correctly.
today my inmp441 mic has arrived)
so, i am a bit excited.
looking through the schematic of my duo 256, I can see IIS2_LRCK, _BCLK, _DO and _DI connected to EPHY_RXN, _RXP, _TXN and _TXP (ethernet connector) which means that I can’t use IIS2 with the ethernet connector.
as for IIS1, IIS1_MCLK is connected through a resistor to ground. IIS1_BCLK - through a cap to a mic connector (which then goes through 4.3K resistor to 3v3), IIS1_DI (_DO) is connected through a cap to audio_out pin (#34). not sure if those capacitors will allow to work with the mic.
So, the easiest way (as a proof of concept) is to connect it instead of the ethernet connector).
btw, what’s the difference between BCLK (bit clock?) and MCLK (master??)?
Next is the driver part?
ls /proc/audio_debug/
gives four files: cviteka_adc, cviteka_dac, is20, and i2s3 (why 3?). Cating those files show that both i2s are disabled, adc uses i2s0, dac uses i2s3.
There are a lot of things that you need to do in order to enable audio. See several other threads here that discuss the steps:
Basically though you need to:
- ensure the proper IO pins are enabled in uboot
- create the necessary nodes in device tree
- turn on the drivers in the kernel configuration
- turn on the userland tools (alsa) in the buildroot configuration
- potentially add a new driver source for any external I2S devices
I have tried all these things and still haven’t successfully seen the audio device become available. There seems to be some critical driver that’s missing which prevents the full audio stack from loading correctly during boot. If you figure this out please post here so the rest of us can benefit.
BCLK is the bit clock for the I2S data - it toggles for every data bit transmitted. It is always needed.
MCLK is “master clock” for the codec and usually runs a few powers-of-two faster than BCLK. Some codecs don’t need MCLK so you don’t always need to enable it.
this is disappointing news. which buildroot sdk version did you use? (and which duo,btw?) I am playing with a 1.0.8, duo256.
However, I wasn’t able to compile the entire thing with a docker on a macos host for some reason - just the FreeRTOS part, so I installed linux mint on another machine for such tasks (and successfully compiled everything) - but i’m away from it right now, will be able to continue the next week.
I’m working with a Duo 64 and SDK from github as of about 2 weeks ago. Note that some of the older audio / I2S threads mentioned above are very out of date with respect to recent SDK releases so many of the edits and suggestions do not match up with the current sources. I attempted to work around this and created a git diff patch for the MAX98357a against a recent SDK which can be found here:
This patch builds successfully but fails to correctly bring up the audio device and although I’ve had several experienced linux folk look at the results I’ve not been able to go further with it yet. I’ll keep poking at it and hopefully things will improve as more people get interested in the audio side of things here.
Good news - progress on getting mic input and I2S output working - details in this thread:
yep! that’s great! I am also following that thread. Yesterday it seemed you had some different outcome: it compiled but didn’t work
where did you get the sources for aplay or arecord? did you have any difficulties compiling them?
Right - I did have some trouble with the earlier suggestion for tweaking the DTSI file but later I saw a full patch set with additional configuration suggestions and that got things working better.
Userland aplay and arecord utilities are provided by the “tinyalsa” package which is enabled in the buildroot configuration of the full patch set that YangZhao provided. Check out their patch and also my updated patch which should apply cleanly to the latest github.
I just did a bit more testing and confirmed that mic input is working but will be pretty weak with most electret devices. I2S DAC output is not working yet - I’m not seeing proper I2S signals on the ethernet TX/RX pins of Duo board. Either there’s something wrong with the max98357a driver source that YangZhao provided or else we don’t have the I2S pinmuxing set correctly yet.