I2S in for recording audio with ADC/Codec

Post Reply
rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

I2S in for recording audio with ADC/Codec

Post by rezzonics »

Can anybody tell me if I2S in for recording audio with external ADC/Codec actually works on Odroid-C2?
I have seen a topic where someone said that he changed device tree to enable I2S input pin and was able to record audio. Is this actually confirmed?
Has AUDIN block with GXBB S905 processor been tested?
Can anybody point me to Kernel source code that can work in this configuration?
What source code is it more recent and is it recommended?
Hardkernel odroid C2 v3.16 kernel
https://github.com/hardkernel/linux/tre ... soc/aml/m8
LibreElec v3.14 ?
https://github.com/LibreELEC/linux-amlo ... soc/aml/m8
CoreElec v4.9?
https://github.com/CoreELEC/linux-amlog ... ogic/meson
Any other source code repository?
Is there any additional documentation apart from S905 datasheet. I think that AUDIN block is not fully documented.
I am trying to have an AUDIN driver working, codec sends I2S data to S905, but data inside S905 does not seem to move thorugh the FIFOs, arecord command times out with pcm_read input/output error.
Any help will be more than welcome

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 772 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by odroid »

No. We've not tested/implemented the I2S input (AUDIN) function due to our limited knowledge. Sorry about that.

But one user could enable the I2S-ADC input on ODROID-C2 Kernel 3.14 around four years ago. :o
viewtopic.php?f=139&t=20413#p143249

rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by rezzonics »

What about recommended repository? The fact that there is AUDIN code does not mean that has not been tested?
Is there a way I can get support from Amlogic? Do you have a contact? I need additional documentation on AUDIN, Datasheet is not fully documented.

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 772 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by odroid »

Try this branch since that user @artaphis used old Kernel 3.14 on his C2 board.
https://github.com/hardkernel/linux/tre ... c2-3.14.y/

There has been no support from Amlogic except for their old ancient Android BSPs.

BTW, what are you going to make with the audio recording function on C2 board?

rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by rezzonics »

I wanted to make a guitar pedal, read audio from guitar, process it and play on real time, I made a custom board with analog circuitry and a codec. I can play sounds, but I cannot record yet.
These users thanked the author rezzonics for the post:
odroid (Mon Jun 15, 2020 10:39 am)

rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by rezzonics »

Is there a way to get additional documentation on AUDIN block apart from Datasheet. This block is not completely documented on Datasheet.
I sent an email to Amlogic technical support without response. I don't see how anybody can implement a driver without additional documentation, this must exist somewhere.
I will keep that information confidential.

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 772 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by odroid »

We don't have it either.

rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by rezzonics »

I had an issue where capture FIFOs did not move and arecord command timed out without pcm input data. Now I have been able to get data on a wave file, unfortunately the file contains garbage data, or maybe the data is shifted, who knows
I have discovered that S905 is not able to play S24_LE format on I2S. Data on wave file has to be 16 bits or 32 bits, from those 32bits, only 24bits are sent to codec. Using S24_LE format swaps bytes on a channel or skips one byte out of 4, so one channel is always wrong.
The audio block on S905 is incredibly complex with hundreds of registers badly documented and with no support.
There are bits to be able to manipulate data, shifting bits, changing endianness, which is quite strange because I2S is a standard format.
For aplay command is easy to create a 1 sample wav file and observing the signal on I2S bus on oscilloscope and how changing register configuration bits affects I2S bits, but arecord is more difficult, because an analog signal must be converted into an I2S flow and then into a wave file.
I think I am starting to know the limitations of this open source model for DIYers and makers like myself.

User avatar
odroid
Site Admin
Posts: 34906
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 954 times
Been thanked: 772 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by odroid »

Sorry to hear that bad situation. :(

rezzonics
Posts: 19
Joined: Sat Jul 07, 2018 6:54 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 3 times
Contact:

Re: I2S in for recording audio with ADC/Codec

Post by rezzonics »

I have made work (more or less) capture MMAP at least on S32_LE mode, I had to add controls on alsamixer to be able to test all bits on AUDIN configuration registers: AUDIN_FIFO0_CTRL, AUDIN_FIFO0_CTRL1 and AUDIN_I2SIN_CTRL. Finally the register configuration used on hardkernel v3.16 was almost right except for DIN_POS on AUDIN_FIFO0_CTRL1 that I had to set to 1 instead of 0. The other issue was that AUDIN_POS_SYNC bit has to be active.
I used a 480 sinewave test signal to check wave generated record file. There is still some kind of synchronization issue, every 48k samples, 31 samples are skipped.
The capture driver, based on playback Mainline linux driver uses an interrupt based on a timer, maybe is related to that, I don't know.
Image
These users thanked the author rezzonics for the post:
odroid (Mon Jul 27, 2020 10:38 am)

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 2 guests