|
Home | Forums | Rules | Articles | diyAudio Store | Blogs | Gallery | Wiki | Register | Donations | FAQ | Calendar | Mark Forums Read |
PC Based Computer music servers, crossovers, and equalization |
|
Please consider donating to help us continue to serve you.
Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving |
![]() |
|
Thread Tools |
![]() |
#1 |
diyAudio Member
Join Date: Sep 2013
|
![]()
Most SBCs can be used in conjuction with a cape or plugin module supporting an I2S DAC to play sound.
Usually these SBC support a Linux distribution that includes ALSA drivers, over which one can add Jack, Pulseaudio and support other high level applications for playing music. What does not seem to be so obvious is to find I2S ADC recording support. Some time ago I thought I could use a Odroid C2 which is quite compact in size and includes a quite powerful quad ARM. I could even develop myself the HW including a I2S codec board. Unfortunately the Linux distributions do not support I2S recording drivers for Amlogic processor, and it's impossible to get support to make a driver for yourself. So far I haven't been able to identify a SBC that is able to support play and record/capture MMAP drivers using I2S ADC/DAC codecs. I find hard to believe that audio recording is not supported by SBCs in the market. Does anybody know of SBCs that support this? |
![]() |
![]() |
#2 |
diyAudio Member
Join Date: Apr 2005
Location: Pilsen
|
RPi has I2S capture support (I do not know if MMAPed, but why such condition?), there are I2S ADC boards/hats on the market, e.g. Datasheet DAC+ ADC | HiFiBerry , ADC Analog to Digital Converter AKM5720 I2S 24Bit / 96kHz - Audiophonics , etc.
I have never used Odroid C2, but the source code suggests the I2S input as specified in S905 SoC specs (page 182 of https://dn.odroid.com/S905/DataSheet...eet_V1.1.4.pdf ) should be supported linux/sound/soc/aml/m8 at odroidc2-3.14.y * hardkernel/linux * GitHub linux/aml_i2s.c at odroidc2-3.14.y * hardkernel/linux * GitHub . I did not find any implementation of a driver for any I2S ADC for odroid, but that is always prepared for a specific ADC codec, similar to the odroid DAC2 driver for pcm512x (module snd_soc_odroid_dac2). For the first guess everything is ready for Odroid C2 ADC I2S module. |
![]() |
![]() |
#3 |
diyAudio Member
Join Date: Sep 2013
|
I need MMAP because this is for an audio effect application, I need to process recorded sound and send the processed audio in real time with minimal latency.
I2S implementation on Amlogic S905 (Odroid C2 processor) is very complex and apparently even if the driver has been written, it is not supported and I am not even sure it works. There is some discussion here on odroid forum about it |
![]() |
![]() |
#4 |
diyAudio Member
Join Date: Apr 2017
|
Another member here wrote a custom i2s implementation for the Beaglebone SBC which uses a TI chip. I've seen some I2s related questions answered on TI support forums as well as NXP forums, so maybe look for an SBC with TI or NXP chips and check if their data sheets are freely available. Then try and get answers on the manufacturer forums.
You won't be getting any answers from Broadcom or Allwinner. Intel is also a no-go. I don't know about Rockchip. |
![]() |
![]() |
#5 | |
diyAudio Member
Join Date: Aug 2008
|
Quote:
My experiments interfacing it with a Raspberry Pi have so far been unsuccessful. I believe it will work as a front end directly to an i2s DAC but not as an ADC for recording into a PI. If you have any information that would help with interfacing it to a Pi I would be most interested. Bob. |
|
![]() |
![]() |
#6 |
diyAudio Member
Join Date: Aug 2008
|
With the audiophonics board connected...and the software installed as per the only instructions I could find for an i2s card...
Overview | Adafruit I2S MEMS Microphone Breakout | Adafruit Learning System /raspberry-pi-wiring-test The card is found correctly- Code:
pi@raspberrypi:~ $ arecord -l **** List of CAPTURE Hardware Devices **** card 0: sndrpii2scard [snd_rpi_i2s_card], device 0: simple-card_codec_link snd-soc-dummy-dai-0 [simple-card_codec_link snd-soc-dummy-dai-0] Subdevices: 1/1 Subdevice #0: subdevice #0 Here is the recorded waveform in audacity... Obviously something very wrong..!! |
![]() |
![]() |
#7 |
diyAudio Member
Join Date: Apr 2005
Location: Pilsen
|
Things are not so simple. The digital mic is I2S slave, configuring RPi I2S interface to master mode. Configuration is in the mic driver Raspberry-Pi-Installer-Scripts/snd-i2smic-rpi.c at master * adafruit/Raspberry-Pi-Installer-Scripts * GitHub - constant SND_SOC_DAIFMT_CBS_CFS - explanation soc-dai.h - include/sound/soc-dai.h - Linux source code (v5.8-rc4) - Bootlin
IIUC the AK5720 board configures the I2S port of the ADC to master mode, expecting the RPi I2S interface to accept its BCLK and LRCLK clocks - that would be constant SND_SOC_DAIFMT_CBM_CFM soc-dai.h - include/sound/soc-dai.h - Linux source code (v5.8-rc4) - Bootlin The driver must fit the hardware precisely. That's why there are dedicated modules for almost every DAC hat for RPi. But all the components for building a working driver are there. My 2 cents from looking at the source code the same holds for the I2S input of Odroid C2, only nobody has done it correctly yet for his specific HW. |
![]() |
![]() |
#8 |
diyAudio Member
Join Date: Aug 2008
|
Thank-you phofman !!
Perfectly explained, and after making the indicated changes to snd-i2smic-rpi.c it now works as expected. Code:
arecord -c2 -f S32_LE -r 96000 --vumeter=stereo test.wav Unsure if this is how it was meant but I added Code:
read -p "Press [z] key to resume ..." Once again my thanks for your time and advice. |
![]() |
![]() |
#9 |
diyAudio Member
Join Date: Apr 2005
Location: Pilsen
|
Great to hear that only fixing the I2S mode was enough to make it work. Congrats.
As of the samplerate - look at table 2 on page 16 of the AK5720 datasheet https://www.akm.com/content/dam/docu...-datasheet.pdf . Value of the settings resistor would have to be changed to change the fs multiple, hence the outgoing samplerate to the slaved RPi (masteclock is fixed). Another options would be generating the masterclock directly from RPi on its GPclkout (for ways to avoid the jittery MASH look at the symphonic-mpd clock redefinition https://www.diyaudio.com/forums/pc-b...ml#post6255443 + further posts - not a simple change though). But that is a large project including proper driver etc. |
![]() |
![]() |
#10 | |
diyAudio Member
Join Date: Sep 2013
|
Quote:
I have been working on a mainline Linux driver for Odroid C2 and driver works OK for playing on S16_LE and S32_LE modes. S24_LE mode is bugged on Amlogic S905 processor though. But I've been struggling a lot with recording driver, initially internal FIFOs didn't move and I had a PCM IO error due to timeout. Now I am able to run arecord command but wave files generated are just garbage. There are hundreds of registers to configure AUDIN block on S905 and they are badly documented on datasheet, and no way to get any support from Hardkernel or Amlogic. I've got inspiration on how to configure registers from existing v3.16 Linux drivers, though I don't know if these drivers actually work for recording. For example, before writing sound samples from internal FIFO to external memory, endianness has to be configured. For me there is little endian (LSB first) and big endian (MSB first), but endian register uses 3 bits, 8 different endian modes, and they are not documented. Existing drivers configured endianness=4, except if split mode is used (which it's the case), then endian is 6 for 16-bits and 7 for 24/32-bits, according to existing drivers. I don't have a way to sweep and test all those values to check what works, I am forced to recomplie the whole Linux, write a Flash and try, which may take ages. Any ideas on how to solve this issue are welcome. If anybody is interested here is the existing drivir as it is now: linux/sound/soc/meson at devrezz2 * Rezzonics/linux * GitHub |
|
![]() |
![]() |
Thread Tools | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can playing playing poor quality records damage my stylus? | HarryY | Analogue Source | 13 | 23rd February 2020 05:43 PM |
Which USB codec to use? | Neil_J | PC Based | 1 | 27th November 2017 04:25 PM |
Recording, playback’s poor relation? Post a DIY recording. | wakibaki | The Lounge | 4 | 2nd December 2010 05:46 AM |
I2S codec... | wildswan | Digital Line Level | 4 | 30th July 2010 04:07 PM |
what's better, a mid playing high, or a tweet playing low??? | cody6766 | Multi-Way | 10 | 20th February 2005 10:40 PM |
New To Site? | Need Help? |