Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 21 Feb 2014 12:01 PM by  Louie Earle
Audio -- cannot record from MIC input
 9 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Louie Earle
New Member
New Member
Posts:12


--
12 Feb 2014 03:05 PM
    Hello all,

    I have a microphone connected to J1.8 (HSMIC.P) of the Torpedo + Wireless SOM.

     arecord -l shows the following:

    **** List of CAPTURE Hardware Devices ****
    card 0: omap3logic [omap3logic], device 0: TWL4030 twl4030-hifi-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0


    When I type the command          arecord -d 5 -D plughw /mnt/mmcblk0/test.WAV  I expect to record 5 seconds of audio to get recorded to the SD card, but all I get is hiss. I have made sure all levels are non-zero using the alsamixer program.

    Do I need to do anything with the board file to tell it to expect headset microphone input? I didn't see any obvious places in the board-omap3logic.c or board-omap3logic-audio.c files where this could be set.

    Any help you can give is greatly appreciated.

    -Louie

     

    Richard Hendricks
    New Member
    New Member
    Posts:52


    --
    12 Feb 2014 03:24 PM

    Louie,

      You will need to setup the Amixer settings.  Here is a cheat sheet I created.

    The default  is OPT_MODE=0

    amixer

    gives a list of audio settings

    amixer name  TPS65950 register default amixer setting (range) register setting
    Analog ANAMIC_GAIN 5 (0-5) 0x5 (30dB)
    TX1 Digital ATXL1PGA/ATXR1PGA 15 (0-31) 0xf (15dB)
    DAC1 Digital Coarse ARXL1PGA/ARXR1PGA coarse 1 (0-2 0x1 (6dB)
    DAC1 Digital Fine ARXL1PGA/ARXR1PGA fine 63 (0-63)   0x3f (0dB)
    DAC1 Analog ARXL1_APGA_CTL/ARXR1_APGA_CTL 12 (0-18) 0x6 (0dB)
    Headset HS_GAIN_SET 1 (0-3) 0x3 (-6dB)
           
     Analog Left Main Mic
         
     Analog Left Headset Mic      


    This table should help with cross-referencing Figure 14-7 Voice/Audio option 2 Block Diagram in the TPS65950 Technical Reference Manual.  Print the figure as 11x17" and trace your input path from the mic to the I2S interface.

     

    Louie Earle
    New Member
    New Member
    Posts:12


    --
    14 Feb 2014 10:31 AM
    Thanks for the help, Richard!

    I found the reference manual, and I'm working through the diagram, but I'm confused how I go about setting OPT_MODE? I took a look through the source tree with

    grep -rni OPT_MODE ~/LogicPD/...(path).../rpm/BUILD/linux-3.0/arch/arm/*

    but don't see where that is set. How do I change this? (both from C code and from my bash prompt -- I'd like to verify that the hardware works before tying it into my app)

    Thanks so much!

    -Louie
    Louie Earle
    New Member
    New Member
    Posts:12


    --
    14 Feb 2014 01:08 PM
    OK, I see now how I can use arecord to set those various registers, but still no sound. I've also made sure to turn off any and all capture devices that are NOT the headset, but still no joy. :(

    I went ahead and connected to the Torpedo+Wireless dev board, where line-in is connected to AUXL/AUXR. I toggled the arecord mixer settings so that it was now capturing from AUXL and UAXR -- still no luck. Just the same hiss.

    Does that output of arecord -l in my original message look correct? Or should the linux kernel be seeing some other capture devices?
    Louie Earle
    New Member
    New Member
    Posts:12


    --
    17 Feb 2014 08:52 AM
    OK, I think I've found the problem.

    According to the document 1021712B_DM3730_Torpedo_Wireless_SOM_Schematic.pdf, R24 is a pull up resistor that connects MIC_IN signal to pin E.4 of the TPS65950. (VHSMI.OUT). I was able to locate R24 using 1021713A_DM3730_Torpedo_Wireless_SOM_Assembly_Drawing.pdf, and both sides of it are about 0V. So I need to turn on that pin so it can pull up the MIC_IN signal.

    I don't see any settings in amixer that look like they can turn that pin on. I was expecting it to automatically turn on when I toggled `Analog Left Headset Mic` to [on], but it didn't set that pin.

    How can I get this pin to turn on?
    Richard Hendricks
    New Member
    New Member
    Posts:52


    --
    17 Feb 2014 01:04 PM
    Louie,
    Let's step back a bit before jumping to your platform. You should be able to use a simple microphone to record from line-in. Just using these commands I can record and play back an audio file with a mic (33-3019 Radio Shack uni-directional dynamic microphone Impedance 450 Ohms) and powered speaker:

    arecord -f cd --duration=10 > ~/output.wav
    aplay ~/output.wav

    I did test using the same microphone on MIC_IN, and it worked fine. Under alsamixer all I did was

    Hit tab - this will switch it from Playback mode to Capture mode
    Arrow over to Analog Left AUXL and disable it
    Arrow over to Analog Left Headset Mic and enable it
    Arrow over to Analog Right AUXR and disable it

    Then held MIC_IN to the tip of the mic, and ground to the outside, and I could record. The audio is a little faint since it is an unpowered mic, but under Alsamixer if you go to Capture mode you can increase the Analog gain (first item on the left) to 30 Db and it sounds pretty good.

    OPT_MODE=0 is set by default from the driver, you shouldn't have to mess with it. The audio driver information is kept in a separate directory from the Linux kernel, under ~/logic/Logic_BSPs/Linux_3.0/REL-ltib-DM3730-2.4-2/rpm/BUILD/linux/sound

    Linux audio is a dark and scary forest, where many fear to tread. Do not review those files lightly. :)
    Louie Earle
    New Member
    New Member
    Posts:12


    --
    20 Feb 2014 01:42 PM
    What are you testing this on? I'm using the LogicPD dev kit right, and just downloaded the stock SD card demo image... still unable to record (keeping it on Line-in, set Analog gain to +30dB in [capture] mode of alsamixer, AUXL and AUXR on).

    I'm using a generic no-name microphone, but have verified that it works on a laptop.

    My dev kit does not have an audio jack for MIC_IN (the custom board I was testing at the top of the thread has that though), so perhaps we are not using the same hardware to test with?
    Louie Earle
    New Member
    New Member
    Posts:12


    --
    21 Feb 2014 09:50 AM
    UPDATE:

    I can record audio, but only when I send it from a nearby laptop out the headphone jack to the mic_in. If I try to use a stand alone microphone, audio does not record.

    I think this confirms that it is because VHSMI.OUT on the TPS65950 is never going high. The laptop provides a signal with a DC bias, where the passive mic does not. I've confirmed this by probing R24 on the SOM itself - I should be seeing ~2.5V but it's always around 0.

    I'm going to have a hardware change on my board to pull up the MIC_IN line to circumvent this. But I am very curious to see how people are getting passive mics to work -- I've tried with 5 different SOMs (4 different Torpedo+ Wireless, 1 Torpedo) and the behavior was identical in each.

    Thanks for your help, guys.
    Richard Hendricks
    New Member
    New Member
    Posts:52


    --
    21 Feb 2014 10:19 AM
    Louie,
    That should not be necessary. I did some testing here, and it looks like you are correct, the audio driver does not setup the bias by default.

    You can enable the bias manually with an I2C command. Please give that a try. I couldn't hear any noticeable difference in record performance with my microphone with the bias on or off. You should see ~2V on the MIC_IN line when recording (when the codec is off the bias is also disabled, but the register value is preserved).

    i2cset -f -y 1 0x49 0x04 0x04
    Louie Earle
    New Member
    New Member
    Posts:12


    --
    21 Feb 2014 12:01 PM
    Richard --

    Success!

    Thank you so much for that command! I didn't know about the force command of i2cset -- without that -f, I was getting "resource busy" messages, so assumed I had to modify the twl4030 driver which was using that i2c bus.

    Note to anyone else new to all of this:

    1) the way linux handles audio, the bias only goes high when you are actually recording. Your i2c command worked, but looked like it didn't at first since I wasn't actively capturing audio and the level was zero. I must have been doing the same with my tweaked twl4030.c file. Learn something new every day.

    2) A bigger problem I was having was that my stereo mic is shorting things out when it plugs into 3.5mm<-> 2.5mm adapters! I grabbed 2 adapters from Radio Shack - one mono adapter and one stereo adapter. They both have near shorts when I plug in. (My custom board has a stereo 2.5mm jack, but we had no 2.5mm mics handy, so this is what a quick trip to Radio Shack got me). I am several true 2.5mm mics now to verify that it works. Luckily I had a 3.5mm mono mic also, which works when plugged into the mono converter. I hadn't thought to check the mic adapters because that's something you just expect to work out of the box.

    Many thanks to everyone who helped!
    You are not authorized to post a reply.