Audio Support Rock Pi S

Hi @stuartiannaylor ,
I2S0_8CH_SCLK_TX and I2S0_8CH_LRCK_TX L/R refer to transmission, that means output mode not input mode. Those pins have to be used when you connect speakers not microphones.
If you want to connect microphones then you need to use I2S0_8CH_SCLK_RX and I2S0_8CH_LRCK_RX (pins 19 and 20).
Be careful that whenever you upgrade the linux kernel, it overwrites the device tree changes you made. To overcome this problem you could use device tree overlays instead of changing the device tree directly but I do not know if the Rock Pi S supports that.
I hope I solved your issue.

Yeah doh seems like I had one of those days.
I was thinking in terms of clock direction rather than data and also because I had a red wire also stuck it on 5v from examination.

Think I have killed it as grabbed a fresh I2S mic and still no go.
I just need to try back on the Pi and see if I have a working Mic and then see if it works on the RockpiS but looking like might have to get another just to eliminate that damage could of been done.

My fault really as was just on a bored day and not paying true attention as interested in voiceAI but still waiting for a KWS.
There is this one version that is 100% opensource and has a model generator and just waiting for them to smoothe off some rough edges, so no major rush.

https://linto.ai/

I am recapping from a long time since I read the tech manual from rockchip but the VAR and Wake from sleep did you ever tinker with the DTS and get those running?

@jack I have been hassling jack for some time about mic connections as yeah it supports overlays but slightly bemused why Radxa hasn’t provided as like said and overlay would stop ony overwrites.

I guess I could of prob setup without a KWS and just used snapcast to RTP via WiFi and used as a speaker/mic.

EC work quite on the RockPi if you use ec - Echo Canceller but would be great if it had USB audio gadget drivers not that I have done much research on what is required.

So Doh and thanks for the great info and I will get back to if I ended up getting a replacement or not.
Dunno why radxa haven’t done more in the wiki or overlays with audio?

@jack the 512mb bt/wifi do you know when those are back in stock as its not much more for POE but it isn’t needed but think of getting x4 to make a wireless wide array room mic quad sound system.

Hi @stuartiannaylor,
Unfortunately I never changed the device trwe to use the VAR.
I only used a button as wakeup source from standby but that is different.
I am using a custom kernel on my Rock Pi S so I do not mind not using overlays as I never do the upgrade.

I will prob at one stage get round to checking the VAD dunno why I called it VAR must be a bit SAD (Speech activity Detection) after it still not working.

I lost interest as got sidetracked by some other things, trying to find a really good KWS but actually thinking a Wifi/USB conference speaker might even be a project.

@jack it just bemuses why Radxa doesn’t add and focus on its audio capability in terms of documentation and overlays as its heavily invested that way by rockchip and for that its an absolute awesome Pi killer as approx Pi3 perf with stereo output and x8 mic inputs just add a 3.5mm barrel and prob 4x I2S mics you can not touch it at that price.

Maybe it didn’t sell which actually bemuses me as the paradox is if it did have some simple info maybe if the usb audio gadget and mic interfacing got some love it would as for price its freaking awesome.

[EDIT]

@baronets

Haven’t tried but think that setting is in alsamixer.

ACODEC_DAC_ANA_CON12
Address: Operational Base + offset (0x0470)
Bit Attr Reset Value Description
31:8 RO 0x0 reserved
7:6 RW 0x0
The select signal of HPMIX module in the right DAC channel.
DAC_R_HPMIX_SEL [1] is reserved, it should be 1'b0.
DAC_R_HPMIX_SEL[0],Select input from I2S
1'b0: Don't select
1'b1: Select
5:4 RW 0x2
DAC_R_HPMIX_GAIN
The gain signal of HPMIX module in the right DAC channel.
2'b01: -6dB
2'b10: 0dB
others: reserved
3:2 RW 0x0
DAC_L_HPMIX_SEL
The select signal of HPMIX module in the left DAC channel.
DAC_L_HPMIX_SEL [1] is reserved, it should be 1'b0.
DAC_L_HPMIX_SEL[0],Select input from I2S
1'b0: Don't select
1'b1: Select 

Maybe I2S will work with the DAC but will have to set back up to try?

PS didn’t kill it with 5v your dts has a different naming to the standard which I never checked.
Copy over to the right filename as with the official setup and all works fine.

But guess now my audio out isn’t on LINEOUT_R pin 25, LINEOUT_L pin 26 as only returns when I revert back to the original dtb.

Anyone know how to get audio out and I2S mics working?

Just thought sod it and connected a analogue mic module without dc blocking caps.

3.3 -> Module VCC, GND -> Module GND
Out -> Mic-P, GND -> Mic-N

Works fine the mems is a bit quiet and the electret with the MAX9814 is mighty as it usually is.

There was DC buzz but far less than my lazy approach expected as thought it would be horrendous but ok just to test.
I will get some .1uf ceramics on Mic-N & Mic-P and see how its goes.

Also while I am at it a 4.7uF DC blockers on the stereo out is prob worth a try also, so will come back on that.

[edit]

I would say these are definitely the best to go for as even though electret rather than mems the Max9814 gives far more amplification.

There is a level of dc buzz that I think is endemic to the Soc board as on high gain with the codec you just amplify this base buzz with you signal.
So the higher the input signal the less you need to amplify.

Yeah blocking caps help a little but going to play with values a little bit more as its guess work to the impedance of the mic module.
Also because I had one I put an audio cap 12000uF across 5v & gnd which did clean the line a little but minimal.
Prob smaller :slight_smile: might help and not lessen the effect but debatable if worth the hassle or space.

The mems analogue modules due to the large codec gain needed produce quite a lot of noise. Its still completely fine for recognition but for voice recording you wouldn’t be happy.
In fact even the max9814 you probably wouldn’t be happy but in comparison to the mems the low level of background noise is only a problem if you where thinking of creating a wifi mic or something and expecting studio quality.

My application of a voiceAI then more than happy with the sensitivity of the max9814 you need to put 3.3v on the gain pin as the top gain by leaving it floating as usual with these modules is noisy.
Dunno why they are that way as the top gain is pure over optimism whilst -10db makes a world of difference.
The low gain by applying gnd to the gain pin doesn’t seem to be much different but the lower signal it produces means more codec amplification and the board noise starts to creep in.

You can listen here to the electret with a codec gain of 13.5db with a single mic

https://drive.google.com/file/d/1f4IUcTLdSJDCfdRAsQuA4JSWxw39670t/view?usp=sharing

Also my computer is pretty noisy so here is a recording where through the recording it goes to sleep and you can hear in a much quieter room a truer reflection of quality.

https://drive.google.com/file/d/1goGPNXlUE8P-R2T3tHrhjXFQwtWENz0h/view?usp=sharing

1 Like

Hi
I am using a DAC that needs master clock AK4495 and when I am following your instructions here I am not getting any output on the master clock pin. It should be on pin 7 (GPIO2_A4) right?
SCLK, LRCLK, and SDO working fine.
My question is do you know if something is wrong in the dts file or is it the driver?

Plus I2S0_8CH_LRCK_TX & Output.

Seemed to of got it working via those instructions I did mic in on the RX setup

MAX98357A dont need a master clock to work as far as I know. If you just follow the instructions here modifying the dtb file it should work.
It works well on my NOS DAC TDA1387 that one do not oversample and dont need a master clock.

I presume your using an adafruit amp?

Its has a clock input, LR clock and use 3.3v & gnd so prob better to supply them.

If you do a LS of dir containing the dtdb you will find the actual dtb is called rk3308-rock-pi-s.dtb or something and not just as Baronets says.
Just adjust the file names so they are correct and reboot.

@jack @Stephen

Any chance we could have an I2S_0 Overlay so that it makes things a little easier :slight_smile:

Try the above as didn’t check about I2S and if it works I will leave you to work out if its 5V compat also.

Try this

https://forum.radxa.com/t/i2s-out-overlay-to-enable-i2s0/4222/2

1 Like

Have you solved your issue? Did you get your Mic to work? I struggle with the same issue. I cant find a working setup.

Hi @Stephen Can we do something similar with the Zero ?
I’ve started a thread so the community can benefit from the solution

Hi, @baronets, just wanna know if I wanna use multi-channel TDM recording, how I could setup the DTS ? do I need to modify the code in audio driver ?

thanks

Power Pan

Thanks @DIYprojectz for the instructions! Sound plays nicely :slight_smile:
I am still having a problem with setting volume - changing the volume in alsa-mixer has no affect.
All settings are on 0, yet sound still has volume when played!

$ uname -a
Linux rockpis 4.4.143-69-rockchip-g8ccef796d27d #1 SMP PREEMPT Tue Jun 14 12:32:20 UTC 2022 aarch64 GNU/Linux

Any help how to control the volume via the command-line/alsa is most appreciated!

(also posted here: Rock PI S audio volume settings)

1 Like

Can you try installing PulseAudio and use pactl to control the volume:

pactl set-sink-volume @DEFAULT_SINK@ +1000

We are also looking to release a new system image for ROCK S soon. It will be based on the upstream Linux 6.1 kernel.

It was fixed some time ago, then break and fixed again. Someone reported working - with Armbian:


Current images don’t work yet (only automated daily builds) - has to be build from sources.

@igorp, Thanks for the info!
Unfortunately, building Armbian from source is beyond my capability :frowning:

If you don’t plan to change anything, it should be on end user level - similar to installing a Linux to the PC. I encourage you to try (instructions needs some update but in general this is it)

Also, at the bottom of the page https://www.armbian.com/rockpi-s/ there are auto generated images. Which should work. The only issue is, they are not officially support, can have unknown issues, but its worth trying. If this works, just wait for a release. Scheduled by the end of the month.

Im so thankfull for you helping out on this part of the board. Thank you.

I found your post by searching for a audio/file server for my HiFi setup:

Then I saw the RS308-D4 has i2S and I thought to myself. WOW! my dac also have this! but its HDMI formfactor.

is the Raxda modules output on the ETHERNET or the pins on the board, if the pins on the board. Possible to get a board/adapter so it will be possible to connect i2s/hdmi out?