This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Audio in on the Sitara am335x starter kit

Other Parts Discussed in Thread: TLV320AIC3106

HI Everyone. I'm trying to design a product that'll use the sitara proc and i'm trying to base a prototype simply on the starter kit. Its got everything except audio in. What the easiest way to get 2 audio channels into the board. I need a fully duplexed system so that's another concern. 

Thanks 

  • Hi Mustafa,
     
    The Starter Kit has an audio codec, TLV320AIC3106 on board (schematics page 14). If you are designing your own schematics you can refer to the documents on the codec product page (http://www.ti.com/product/tlv320aic3106) for reference. If you need to patch the Startet Kit for prototyping, you will need to connect to the Line In or Mic inputs, depending on what signal input you need. These can be accessed via the capacitors connected to them (capacitors will probably need to be removed). You can find the Starter Kit board design files at this link: http://processors.wiki.ti.com/index.php/AM335x_StarterKit_Board_Design_Files. The PCB file is in Cadence Allegro format, there is a free viewer available on the Cadence web site.
  • Hi,

    I want to connect Mic input to Sitara AM335xsk Revision 1.2B

    i have patched a board by removing capacitor C164 and C166

    Connect MIC3R of U31(TLV320AIC3106) to Condenser MIC using 0.47uF capacitor

    and connect MICBIAS pin to Condenser MIC using 2K resistor

    as referred by TLV320AIC3106 data sheet page 18 Figure 13.

    But still MIC is not taking input

    I have tested in Linux-sdk using arecord

    and Sound recorder in Android

    Also try to detect register status of Codec IC to check configuration for MIC input

    but not able to get I2C bus as it is always busy and not giving access to read or write device

    root@am335x-evm:~# i2cdetect -r 1
    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-1 using read byte commands.
    I will probe address range 0x03-0x77.
    Continue? [Y/n] y
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- UU -- -- UU -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
    30: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
    40: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: UU UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --                         
    root@am335x-evm:~#

    Is Codec IC is properly configured by drivers to take MIC input

    Please suggest how to move further

    Regards

    Girish

  • Hi all, 

    I have patched one of our AM335x Starter Kits to privide two stereo 3.5jacks for audio in. One jack is connected to LINE1LP, LINE1RP, another one is connectd to LINE2LP, LINE2RP. Both jacks are AC-coupled to AIC3106 using the original capacitors which were shifted a bit, one pad remained tied to AIC, another pad made free for soldering jack's wires.

    I have booted linux to test audio. I used arecord to test recording. But it doesn't work. arecord just prints format of file, puts WAV header to stdin/file and does not collect any data. However, aplay works perfectly to output demo WAVs to original kit jack. That means the AIC itself works.

    I tried to invoke amixer to set up capture mixer. set mute to OFF, etc. but nothing happened. It seems that data is not captured by linux driver, so nothing is read from /dev/snd/pcm0c. 

    What is the reason of that promblev?

    Is there any guide how AIC3106 internal registers are mapped to ALSA mixer settings?

    Also,  is it possible to set up ALSA to AIC3106 capabilities to forward line inputs directly to outputs through the mixer? One of the desired functiond of the end product is to switch output between two inputs while capturing their data to LAN.

  • Hello Vladimir,

    What SDK are you using?  What modifications did you make to the kernel to reflect your hardware changes?

    "Also,  is it possible to set up ALSA to AIC3106 capabilities to forward line inputs directly to outputs through the mixer? One of the desired functiond of the end product is to switch output between two inputs while capturing their data to LAN."

    You should be able to accomplish this by editing your ALSA configuration in your filesystem.  See this page for more details.

    By the way, our SDK 7.0 Linux Audio page has lots of details that may help you.

    Regards,

    Josh

  • Hi, Josh!

    Thanks for the quick reply.

    I used linux out-of-box. Just plugged the USB cable into PC and used putty to connect to root console. Then I tried to call arecord. I did not change anything at first. However, I called alsactl init at one of my tries.It started to re-configure alsa core, but nothing changed.

    Well, I participate in this project mostly as a hardware engineer/designer. Now I just want to check AIC connections so that I could give the kit to my colleagues who will prototype the full application. So, for the first demonstration the simple test will be enough: I plug one end of 3.5 mm audio cable into PC headphones jack then plug another one into AM335x kit line1 jack, record some wav played by PC. Then I switch mixer to line2 and record second wav form PC. The I play them both, one after another, to see they sound diffrently according to input lines. If this works, I would start drawing target schematics while programmers will evaluate end application, in parallel, having closer look on linux SDK, ALSA, etc.

    Best regards, Vladimir...

  • Hello Vladimir,


    To test this in linux, you will have to modify the kernel to be able to activate this functionality.  If you are using SDK7.0, most of these changes will occur in the Device Tree file, although you may have to edit sound/soc/davinci/davinci-evm.c a bit.  Check the Board Port section of this page for more details: http://processors.wiki.ti.com/index.php/Sitara_SDK_Linux_Audio

    For SDK 6.0, you would need to edit the am335x board file and sound/soc/davinci/davinci-evm.c.  This isn't an exact example, but this e2e forum post shows where the changes would need to occur: http://e2e.ti.com/support/arm/sitara_arm/f/791/t/194645.aspx


    Pretty much what you would need to do in each case is set the Starter Kit to have the same setup as the General Purpose EVM, which uses both audio input and output.


    Regards,

    Josh

  • Hello Josh, 

    Thank you for links. It seems that we need to rebuild kernel to test the audio inputs.

    Do you have any idea why arecord does not work in pre-installed linux? I guess that linux does not know anything about the hardware connected to IAC line inputs. So, the arecord should record some default input which is silent because it is AC coupled to ground in starter kit.

    Best regards, Vladimir

  • Hi Vladimir,

    The default linux build running on the Starter Kit will not have any ALSA audio inputs configured with the McASP, so none of the audio utilities will know about any audio recording hardware.  If you type "arecord -l", you should see a message about "No soundcards found."

    However, if you ran that same linux image on the General Purpose EVM, linux would be able to detect audio input hardware, and so arecord would see a properly configured device available.

    Josh

  • Josh, 

    I am not 100% sure (I left the kit at work) but as I remember it prints something like "AM335x audio capture device". I have never seen strings like "no soundcards found". If you were right then any try to start arecord would give me a error of undefined input device. However, it starts recorgind but does not actually reads audio data from AIC chip.

    I will dump arecord -l to provide you with exact output.

    Is it possble to use alsactl init to re-configure ALSA subsystem and to add actual input device to mixer?

    Vladimir

  • Hello,

    Unfortunately, it would not be possible.  If you are using SDK 6.0, in the arch/arm/mach-omap2/board-am335x.c, you can see the following lines of code relating to the McASP setup for Starter Kit:

    static u8 am335x_evm_sk_iis_serializer_direction1[] = {
    	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    };
    
    static struct snd_platform_data am335x_evm_sk_snd_data1 = {
    	.tx_dma_offset	= 0x46400000,	/* McASP1 */
    	/*.rx_dma_offset	= 0x46400000,*/
    	.op_mode	= DAVINCI_MCASP_IIS_MODE,
    	.num_serializer	= ARRAY_SIZE(am335x_evm_sk_iis_serializer_direction1),
    	.tdm_slots	= 2,
    	.serial_dir	= am335x_evm_sk_iis_serializer_direction1,
    	.asp_chan_q	= EVENTQ_2,
    	.version	= MCASP_VERSION_3,
    	.txnumevt	= 32,
    	.get_context_loss_count	=
    			omap_pm_get_dev_context_loss_count,
    };

    The kernel is only being configured to use TX when Starter Kit is detected.

    Regards,

    Josh

  • Hm, trouble...

    I see, rx dma is also turned off. Is there version of a driver with input capturing capabilities? However, I suspect the driver itself supports capture but the kit's board info disables it due to lack of input connectors. They should not do this...

    Vladimir

  • Actually, in that same board fiel, there are structures that are initialized to do that with the General Purpose EVM:

    static u8 am335x_iis_serializer_direction1[] = {
    	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,	RX_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    };
    
    static struct snd_platform_data am335x_evm_snd_data1 = {
    	.tx_dma_offset	= 0x46400000,	/* McASP1 */
    	.rx_dma_offset	= 0x46400000,
    	.op_mode	= DAVINCI_MCASP_IIS_MODE,
    	.num_serializer	= ARRAY_SIZE(am335x_iis_serializer_direction1),
    	.tdm_slots	= 2,
    	.serial_dir	= am335x_iis_serializer_direction1,
    	.asp_chan_q	= EVENTQ_2,
    	.version	= MCASP_VERSION_3,
    	.txnumevt	= 32,
    	.rxnumevt	= 32,
    	.get_context_loss_count	=
    			omap_pm_get_dev_context_loss_count,
    };

    So you'd just have to reuse these configurations for the Starter Kit structures.

    Josh

  • Hello,

    Old topic here, but I am trying to achieve what the OP intended to do last year, ie to get audio in working on the AM335x EVM SK board using the LINE1R/LINE1L inputs of the audio codec.

    My setup :
    AM335x EVM SK with Android JellyBean

    I reworked the board : turned the J13 connector into a line-in connector (rather than line out). Achieved this by removing C181 and C185 caps and routing pin 2 of J13 to LINE1LP pin of Audio codec (pin 3 of TLV320AIC) + routing pin 1 of J13 to LINE1RP pin of Audio codec (pin 5 of TLV320AIC). Both routhing where done through 0,1uF caps. After rework I was able to measure the 0,1uF between the codec pins and the connector pins which validates the rework.

    Recompiled the Jellybean baseline with following modifications (to align with the GP AM335x EVM) :

    In file kernel/arch/arm/mach-omap2/board-am335xevm.c

    static u8 am335x_evm_sk_iis_serializer_direction1[] = {
    INACTIVE_MODE, INACTIVE_MODE, TX_MODE, RX_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    };
    static u8 am335x_evm_sk_iis_serializer_direction0[] = {
    TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
    };
    static struct snd_platform_data am335x_evm_sk_snd_data1 = {
    .tx_dma_offset = 0x46400000, /* McASP1 */
    .rx_dma_offset = 0x46400000,
    .op_mode = DAVINCI_MCASP_IIS_MODE,
    .num_serializer = ARRAY_SIZE(am335x_evm_sk_iis_serializer_direction1),
    .tdm_slots = 2,
    .serial_dir = am335x_evm_sk_iis_serializer_direction1,
    .asp_chan_q = EVENTQ_2,
    .version = MCASP_VERSION_3,
    .txnumevt = 32,
    .rxnumevt = 32,
    .get_context_loss_count =
    omap_pm_get_dev_context_loss_count,
    };
    static struct snd_platform_data am335x_evm_sk_snd_data0 = {
    .tx_dma_offset = 0x46000000, /* McASP0 */
    .rx_dma_offset = 0x46000000,
    .op_mode = DAVINCI_MCASP_IIS_MODE,
    .num_serializer = ARRAY_SIZE(am335x_evm_sk_iis_serializer_direction0),
    .tdm_slots = 2,
    .serial_dir = am335x_iis_serializer_direction0,
    .asp_chan_q = EVENTQ_2,
    .version = MCASP_VERSION_3,
    .txnumevt = 1,
    .rxnumevt = 1,
    .sync_mode = 1,
    };


    I am assuming the Line-In Audio is working fine on the AM335x EVM board. The only differences between am335xevm and am335xevm sk that could potentially impact audio in functionality seems to be in the board-am335evm.c file ; so i did not perform any other modifications.


    I am then running two types of test :
    1) Launching a sound recording using the Android JellyBean SoundRecorder app
    2) Doing a capture using tinycap utility (tinycap test.wav –n 16)

    In both cases the result is just either silence or background noise.

    I have played a bit with the tlv320aic registers by changing agc settings and gain for instance. By doing so I can see that data sent from codec to am335x SOC changes, which makes me think there is no issue on the dai link itself. (I am logging data @ app level in tincyap.c and pcm,c under external/tinyalsa directory).

    Please also find below the TLV320AIX registers that i dumped thanks to the debugfs codec_reg entry (dump done while audio is being recorded using the Android JellyBean SoundRecorder app) :

    00: 00
    01: 80
    02: 00
    03: 92
    04: 1c
    05: 52
    06: 40
    07: 8a
    08: c0
    09: 40
    0a: 00
    0b: 01
    0c: 00
    0d: 00
    0e: 00
    0f: 20
    10: 20
    11: ff
    12: ff
    13: 04
    14: 78
    15: 78
    16: 04
    17: 78
    18: 78
    19: 00
    1a: 00
    1b: fe
    1c: 00
    1d: 00
    1e: fe
    1f: 00
    20: 18
    21: 18
    22: 00
    23: 00
    24: 00
    25: c0
    26: 00
    27: 00
    28: 00
    29: 00
    2a: 00
    2b: 87
    2c: 87
    2d: 2f
    2e: 2f
    2f: af
    30: 00
    31: 00
    32: 00
    33: 0d
    34: 2f
    35: 2f
    36: af
    37: 00
    38: 00
    39: 00
    3a: 0c
    3b: 00
    3c: 00
    3d: 00
    3e: 2f
    3f: 2f
    40: af
    41: 0d
    42: 00
    43: 00
    44: 00
    45: 2f
    46: 2f
    47: af
    48: 0c
    49: 2f
    4a: 2f
    4b: af
    4c: 2f
    4d: 2f
    4e: af
    4f: 08
    50: 2f
    51: 2f
    52: af
    53: 00
    54: 00
    55: 00
    56: 09
    57: 00
    58: 00
    59: 00
    5a: 2f
    5b: 2f
    5c: af
    5d: 09
    5e: 00
    5f: 00
    60: 00
    61: 00
    62: 00
    63: 00
    64: 00
    65: 00
    66: 02




    Could you please let me know what could possibly wrong here ?


    Thanks in advance for your help. I have been working hard on this so far and cannot see an outcome !


    Gregoire
  • Gregoire, 

    1) If you see a capture program writes data to file then your driver most probably works OK. Original driver did not enable DMA for incoming data stream so reading from audio device blocked reading process forever with no data at all.

    2) If you see wrong input data then it seems you did not configure your mixer. Please run alsamixer utility and look through all capture settings. Also, try to check these settings against your codec block diagram and your hardware connections. I suspect your input could be muted, or just another channel muxed to ADC, or you have extremely low input gain, or you are actually recording mono signal on left channel while actual data comes on right.

    Best regards, Vladimir

  • Hi Vladimir,

    Thanks for the answer. However (and i did not say it) I already tested several codec register settings : I checked them all and they seem fine IMHO :

    1) I reviewed and played with the different stages gain (input gain, PGA gain, AGC settings) and they all look OK to me.
    2) I also checked the LINE1R and LINE1L are not muted on the right ADC and left ADC respectively.
    3) I also made sure they were configured as single-ended inputs (I am using LINE1LP and LINE1RP only).
    4) I also tried different configurations posted on the Sitara Audio Linux website (written by josh I think), with no luck.

    If that's possible could you please share a snapshot of the mixer settings or , even better , the codec registers (from Page 0 Register 1 to Page 0 Register 109) on a GP EVM when recording audio ? It would allow me to see the complete Codec register settings in the working case and from there I should be able to narrow down the issue.

    Please let me know,

    Thanks,

    Gregoire
  • Gregoire, 

    here is a dump of our configuration:

    # i2cdump -f -y 1 0x1b

    No size specified (using byte-data access)
    0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
    00: 00 00 00 92 10 00 00 0a c0 40 00 81 f0 00 00 72 ...??..??@.??..r
    10: 72 ff ff 7c 00 78 7c 00 78 06 00 fe 00 00 fe 00 r..|.x|.x?.?..?.
    20: 00 00 00 00 cc 20 10 00 00 00 00 86 86 76 76 84 ....? ?....??vv?
    30: 76 76 76 0c 76 76 76 76 76 76 04 76 76 76 76 76 vvv?vvvvvv?vvvvv
    40: 84 0c 76 76 76 76 76 76 04 76 76 76 76 76 76 00 ??vvvvvv?vvvvvv.
    50: 76 76 76 76 76 76 00 76 76 76 76 76 76 00 00 00 vvvvvv.vvvvvv...
    60: 00 00 00 00 00 c0 02 00 00 00 00 00 00 00 00 00 .....??.........
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    80: 00 00 00 92 10 00 00 0a c0 40 00 01 f0 00 00 72 ...??..??@.??..r
    90: 72 ff ff 7c 00 78 7c 00 78 06 00 fe 00 00 fe 00 r..|.x|.x?.?..?.
    a0: 00 00 00 00 cc 20 10 00 00 00 00 86 86 76 76 84 ....? ?....??vv?
    b0: 76 76 76 0c 76 76 76 76 76 76 04 76 76 76 76 76 vvv?vvvvvv?vvvvv
    c0: 84 0c 76 76 76 76 76 76 04 76 76 76 76 76 76 00 ??vvvvvv?vvvvvv.
    d0: 76 76 76 76 76 76 00 76 76 76 76 76 76 00 00 00 vvvvvv.vvvvvv...
    e0: 00 00 00 00 00 c0 02 00 00 00 00 00 00 00 00 00 .....??.........
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

    Please, note that

    1) this was dumped using our schematics originally derived from EVM but with some modifications. Here is an our schematics.

    2) mixer is too complex and I allways forget all the things that should be tuned to get good signal with minimal noise. The current configuration being dumped was made manually so there was some additional noise. But I could record the file from built-in microphone BM1 and then play it back. I used these commands:

    arecord -f dat test.wav  for recoring, and

    aplay test.wav for playback

    Now the part of the schematics around AIC.

  • Hi Vladimir,

    Thanks for sharing this, and for the prompt reply.

    I found out the rootcause of my issue. I did not have any pull-ups on the lines (I am using an external mic). So stupid of me :-) Anyway I have everything working now. I'll use the Codec register settings to check your config and see how well it is aligned with mine. I am now targetting perfect audio quality on the line-in inputs.

    Thanks again,

    Best Regards,

    Gregoire