8-channel audio input on Rock Pi S

Hi!

Brand new to Rock Pi’s. Discovered them via a random local online retailer last night (where it’s out of stock so I still need to wait to get my hands on one).

The wiki for the Rock Pi S shows that it can have upto 8 mic inputs on the second GPIO row. Can someone tell me if all of these work in Linux right now?

I’d love to buy one and turn it into a low end sound interface / mixing board and push the captured audio out via USB OTG to my desktop, possibly after applying some light-on-the-CPU DSP effects.

I think I should be able to fit 8 6.5mm panel mounting mono jacks on a 100x100 PCB comfortably, to act as an audio input shield for this.

Are there other Rock Pi’s geared towards multichannel audio like the S?

1 Like

I2S is definitely 8 channel I/O you have to create your own softvols via asound.conf but yeah they work.

RockPiS is an unusual soc due to its VoiceAI focus haven’t checked on others how many channels but I2S is pretty standard but usually 2/4 channel.

Not sure about USB Audio OTG as would like to do that as well? I2S mic & DAC has been done by RockPiS users, OTG just haven’t seen it done.
Codec gets disconnected as I2S is then card index 0 or 1 or whatever instead of internal DAC & ADC.
I think really there should be an overlay where it uses the simplesocdai instead but if you edit the DTB as

Ooh interesting! Are there any sound demos of how clear the audio input feature is, when using 8 channels at the same time?

What sort of extra connections would this need? I’d imagine I can directly solder terminals of a 6.5mm audio jack to female dupont connectors and plug these jacks into the header?

PS: I haven’t yet gotten my hands on a Rock Pi S because my local dealer hasn’t received fresh units yet; so I’m using that time to figure out everything beforehand.

If you’re willing to spend a bit of money, you can get a hat that offers six channels in and 8 channels out. See the descriptions of the Audio Injector Raspberry Pi Octo sound cards on:
https://elinux.org/RPi_Expansion_Boards#Sound

It’s available from Amazon in the US for $58.00
https://www.amazon.com/Octo-channel-sound-card-Raspberry/dp/B06Y3PZ6MF

I bought one, and am pleased with it, although I’m using it on a Raspberry Pi 3B under Raspbian instead of on my RockPi (running Ubuntu 20.04). .Audacity runs quite well with the hat.

When I first came across the audio injector card, I did consider buying one.

But unfortunately, no local retailers stock it where I live (the DIY audio community is nearly non-existent, and most audio HATs come with soldered-on microphones instead of dedicated inputs), and the cost of privately importing one is obscene. Individuals are taxed on the combined [cost+shipping] (a minimum of 86%) and then some extra (which depends on the mood of the customs agent on any given day).

So it’s pretty much down to looking at what stuff is available locally for a more reasonable price, and modify it (as long as things can go on a perfboard; I’m only equipped for through-hole work).

You should be able to pick up cheap modules or the Adafruit one as they deserve the credit.

You can use x2 on a Pi also and Adafruit give the driver away free.

No driver is needed for the RockPiS just enable I2S_0.

The adafruit info for Pi should give you all the info you need.
Never tried 8 even though I do have them I created a simple 5 wire stereo harness which actually just parallels out apart from x4 L/R data so all x8 is 8 wires if my math holds well :slight_smile:
Google “pi jumper wires” and you should get the jist.

PDM is also very similar in operation.

The built in embedded VAD and wake from sleep of the DSP unit works with a max of 4 and 1 for sleep mode.
8 would be great if you could have long cable runs for many recording apps and its such a shame the onboard ADC suffers from a DC ripple (I think Radxa are looking into that, hopefully so).

I guess it doesn’t have to be a Mic and this would wire exactly the same as the mics but gives choice of what analogue input you choose.

There is a mode on the RockPiS where I2S_0 and I2S_1 are bridged to give 16 but have no idea if it works or what is entailed.

There are also rumours of a Radxa Hat but the is still to be confirmed officially.

Have no idea about audio OTG gadget setup though.

So the problem here is that I don’t want to buy anything that comes with a microphone built-in, since the reason I’m buying one is to turn it into a mixing board (to route a phone, a laptop, a synth keyboard, a mic, and a guitar).

The USB OTG audio bits I should be able to figure out on a Pi 4 (I can connect a MIDI keyboard to the Pi 4 and see if I can transmit that over USB). I just need some exposure to Linux’s GadgetFS. I’ve also been reading https://www.beyondlogic.org/usbnutshell/ to understand what I’m up against.

With the Rock Pi S, I’m primarily interested in what the mic pins actually do, when I connect an ordinary microphone to them. In the Rock Pi S 1.2 Header 2 pinout page, I can see input pairs labelled (MICN8, MICP8), (MICN7, MICP7), (MICN6, MICP6), (MICN5, MICP5), (MICN2, MICP2), (MICN1, MICP1). Let me explicitly list out my questions:

  1. This looks like 6 channels, each with a ground and a signal pin. Is this accurate?

  2. Where’s the other two channels?

  3. What are the MICBIAS2 and MICBIAS1 pins used for?

  4. Can I directly connect mic-level inputs to these pins? Or do I need to bring them to a 0-3.3v level with an op-amp?

  5. Can any of these pins handle a higher power line-level input (like from the aux out of a keyboard synth)?

  6. What’s the sampling rate and bit-depth supported by the Rock Pi S?

  7. I see a common GND, but also a MICN. Which of these do I connect the ground pin of a two-pin microphone to?

  8. If I connect a 6.5mm stereo jack to the line-out pins, does the ground go to the GND pin?

There is a DC ripple on the ADC that I have been talking to @jack about and I think they are trying to sort it.
The ripple on near line in level sounds just like a relatively bad noisy recording.
With a low level and high gain such as an electret it sounds very bad.

You would be better using a I2S $3 ADC and mic than onboard as the DC ripple currently is killing it for any acceptable level of audio use.
If maybe for recognition with near line input prob doesn’t matter.

Trying now several days to get the i2s-tdm working in 8chan dsp_b mode, but I get it not running.

I have create a new DT and add following elements :

    tdm_sound {
            compatible = "simple-audio-card";
            simple-audio-card,name = "rockpis-tdm";
            simple-audio-card,format = "dsp_b";
            simple-audio-card,mclk-fs = < 0x100 >;
            simple-audio-card,bitclock-master = <&i2s_tdm>;
            simple-audio-card,frame-master = <&i2s_tdm>;
            status = "okay";

            simple-audio-card,cpu {
                sound-dai = < &i2s_tdm 0>;
                system-clock-frequency = <12288000 >;
                system-clock-direction = "out";
                dai-tdm-slot-num = <8>;
                dai-tdm-slot-with = <16>;
            };
            dailink0_master: simple-audio-card,codec {
                sound-dai = <&dummy_codec>;
                dai-tdm-slot-num = <8>;
                dai-tdm-slot-with = <16>;
            };
    };

    dummy_codec: dummy-codec {
            status = "okay";
            compatible = "rockchip,dummy-codec";
            #sound-dai-cells = < 0x00 >;
            clocks = <0x02 0x4c>;
            clock-names = "mclk";
            phandle = < 0x139 >;
    };

It seems to enumerate without error:
[ 1.658822] dummy_codec dummy-codec: get mclk success
[ 1.722213] of_get_named_gpiod_flags: can’t parse ‘simple-audio-card,hp-det-gpio’ property of node ‘/tdm_sound[0]’
[ 1.723300] of_get_named_gpiod_flags: can’t parse ‘simple-audio-card,mic-det-gpio’ property of node ‘/tdm_sound[0]’
[ 1.725529] asoc-simple-card tdm_sound: dummy_codec <-> ff300000.i2s mapping ok
[ 1.747649] ALSA device list:
[ 1.747967] #0: Loopback 1
[ 1.748248] #1: rockpis-tdm

asound.conf:
pcm.!default {
type hw
card 1
channels 8
}

ctl.!default {
type hw
card 1
}

aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
[Loopback skipped]
Karte 1: rockpistdm [rockpis-tdm], Gerät 0: ff300000.i2s-dummy_codec dummy_codec-0 []
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0

aplay -L
[loopback skipped]
sysdefault:CARD=rockpistdm
rockpis-tdm,
Default Audio Device
dmix:CARD=rockpistdm,DEV=0
rockpis-tdm,
Direct sample mixing device
dsnoop:CARD=rockpistdm,DEV=0
rockpis-tdm,
Direct sample snooping device
hw:CARD=rockpistdm,DEV=0
rockpis-tdm,
Direct hardware device without any conversions
plughw:CARD=rockpistdm,DEV=0
rockpis-tdm,
Hardware device with all software conversions

But speaker-test drops a error and stop:
speaker-test -c8 -twav

speaker-test 1.1.8

Wiedergabe-Gerät ist default
Stream-Parameter sind 48000 Hz, S16_LE, 8 Kanäle
WAV-Datei(en)
Rate ist 48000 Hz (angefordert: 48000 Hz)
Puffergröße von 32 bis 32768
Periodengröße von 16 bis 16384
Verwende maximale Puffergröße 32768
Perioden = 4
Fehler beim Setzen der Hardware-Parameter: Das Argument ist ungültig
Fehler beim Setzen der Hardware-Parameter: Das Argument ist ungültig

[ 160.838793] rockchip-i2s-tdm ff300000.i2s: ASoC: can’t set ff300000.i2s hw params: -22

On logic analyser, I can see that the clock is there for a short period.

Hopefully, that someone got it working may give a hint whats wrong

Edit-1:

when removing dai-tds-slots it is running in 2 channel mode using dsp_b
framesync so far.
When try to play 4,6,8 channel, I got a write error

when using the mutichannel-codec i got a kernel-crash leads to a boot-loop:

    tdm-sound {
            compatible = "rockchip,multicodecs-card";
            rockchip,card-name = "rockpis-tdm";
            rockchip,codec-hp-det;
            rockchip,mclk-fs = < 0x100 >;
            rockchip,cpu = < 0xbe >;
            rockchip,codec = < 0x139 >;
            phandle = < 0x13d >;
    };

[ 1.661387] [] driver_probe_device+0x190/0x274
[ 1.661394] [] __driver_attach+0x4c/0x90
[ 1.661402] [] bus_for_each_dev+0x80/0x90
[ 1.661410] [] driver_attach+0x20/0x28
[ 1.661418] [] bus_add_driver+0x194/0x1d8
[ 1.661425] [] driver_register+0x98/0xd0
[ 1.661433] [] __platform_driver_register+0x48/0x50
[ 1.661444] [] rockchip_multicodecs_driver_init+0x18/0x20
[ 1.661453] [] do_one_initcall+0x170/0x178
[ 1.661463] [] kernel_init_freeable+0x228/0x22c
[ 1.661472] [] kernel_init+0x10/0xf8
[ 1.661480] [] ret_from_fork+0x10/0x50
[ 1.661487] ------------[ cut here ]------------
[ 1.661490] WARNING: at kernel/workqueue.c:1486
[ 1.661494] Modules linked in:
[ 1.661495]
[ 1.661503] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G W 4.4.143-57-rockchip-g4b8d0571d76e #1
[ 1.661510] Hardware name: Radxa ROCK Pi S (DT)
[ 1.661514] task: ffffffc01f898000 task.stack: ffffffc01f8a0000
[ 1.661521] PC is at __queue_delayed_work+0xb0/0x104
[ 1.661528] LR is at queue_delayed_work_on+0x50/0x74
[ 1.661534] pc : [] lr : [] pstate: 000001c5
[ 1.661536] sp : ffffffc01f8a3a10

I start to think 8 channel audio is not working with this board.
Does anyone knows a board having a working 8 channel tdm and USB-OTG ?

I2s-out overlay to enable i2s0 - Using ROCK Pi S - Radxa Forum

Peterk, have you by any chance come across a solution to the issue you described? I’m referring to finding a device capable of supporting i2s/tdm with 8-channel audio output. I’m asking because I’m also looking to build a DSP based on CamillaDSP, and I’m in search of a similar solution. I’d love to know if you’ve made any progress or discoveries in this area.

anybody tested i2s mode 8ch in? need the dts for reference.
I checked the dtsi is very detail… but don’t know how to write the dts but use the i2s_8ch_0 rx pins.

I made the output work, 8ch, ask I think, tested by oscilloscope(not dac) seemed works fine.

Please refer to:

Finally, I got it running. Have a ADAU1467, an HDMI extractor and 4*PCM5102 connected together.
Can control the whole DSP part by using sigma studio connected by TCP to PIS.
I drop the idea to use USB Audio, but use Scream Audio now to multi-channel stream from Windows-PC to PiS board.

Hope that helps