Loading ...
Sorry, an error occurred while loading the content.

USB audio on RPi

Expand Messages
  • Kristoff Bonne
    Hi, As has been discussed and published a number of times on the net, there seams to be a pretty serious problem with USB on the RPi, which has its effects on
    Message 1 of 14 , Jan 19, 2013
    • 0 Attachment
      Hi,



      As has been discussed and published a number of times on the net, there
      seams to be a pretty serious problem with USB on the RPi, which has its
      effects on using an USB audio-dongle on it.
      From what I have found, it seams to be related to using a USB 1.1
      device on the (USB 2.0) HUB of the Pi.


      This has been my experience sofar:
      - When I just plug in a USB audiofob on the RPi, I seams to be loseing
      audio-frames during audio-capturing. The number of frames dropped per
      second does differ quite a lot per device. On some devices (like a USB
      headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
      of 25).

      - One trick seams to be to boot the Pi with the option set to limit the
      USB speed to USB 1.1).

      However, this seams to have a number of issues:
      - in some cases, USB does not work anymore. E.g. my USB keyboard does
      not work anymore.
      - I had rapports of people where there are problems with the video
      - When I use this trick and have 2 audio-devices active (both running at
      48 Kbps full-duplex) at the same time, I have problems that the devices
      says it does not have sufficient bandwidth for both sessions.
      I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
      if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
      sampling, 16 bits/sample), I only have 3 Mbps / second

      I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
      modem for VHF and UHF), so I do need two audio-connections (one for the
      headset for the user and one for the GMSK modem connection to the radio).


      What is the experience of people on this group about this?


      Some question:
      - is there somebody who has a revision 2.0 version of the RPi. Does it
      also have this USB issue?

      - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
      read, the problem with the USB-bus is related to using a USB 1.1 device
      on the USB 2.0 bus. So does using a USB 2.0 device help?



      73
      Kristoff - ON1ARF
    • Ronny Julian
      Total beginner here but I want to help get this going. I have a USB 2.0 headset (2 different models/brands) I can try along with a few generic USB sound cards.
      Message 2 of 14 , Jan 19, 2013
      • 0 Attachment
        Total beginner here but I want to help get this going.

        I have a USB 2.0 headset (2 different models/brands) I can try along with a few generic USB sound cards.  I also have a powered 2.0 hub I got last night.  
        Want to share info off list?  

        K4RJJ
        Ronny

        On Sat, Jan 19, 2013 at 4:20 AM, Kristoff Bonne <kristoff@...> wrote:
         

        Hi,

        As has been discussed and published a number of times on the net, there
        seams to be a pretty serious problem with USB on the RPi, which has its
        effects on using an USB audio-dongle on it.
        From what I have found, it seams to be related to using a USB 1.1
        device on the (USB 2.0) HUB of the Pi.

        This has been my experience sofar:
        - When I just plug in a USB audiofob on the RPi, I seams to be loseing
        audio-frames during audio-capturing. The number of frames dropped per
        second does differ quite a lot per device. On some devices (like a USB
        headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
        of 25).

        - One trick seams to be to boot the Pi with the option set to limit the
        USB speed to USB 1.1).

        However, this seams to have a number of issues:
        - in some cases, USB does not work anymore. E.g. my USB keyboard does
        not work anymore.
        - I had rapports of people where there are problems with the video
        - When I use this trick and have 2 audio-devices active (both running at
        48 Kbps full-duplex) at the same time, I have problems that the devices
        says it does not have sufficient bandwidth for both sessions.
        I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
        if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
        sampling, 16 bits/sample), I only have 3 Mbps / second

        I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
        modem for VHF and UHF), so I do need two audio-connections (one for the
        headset for the user and one for the GMSK modem connection to the radio).

        What is the experience of people on this group about this?

        Some question:
        - is there somebody who has a revision 2.0 version of the RPi. Does it
        also have this USB issue?

        - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
        read, the problem with the USB-bus is related to using a USB 1.1 device
        on the USB 2.0 bus. So does using a USB 2.0 device help?

        73
        Kristoff - ON1ARF


      • Michael O'Bannon
        Kristoff, I ve experimented with audio and fldigi on two original RPi s, but I don t have a rev 2 to help answer your question. There is definitely an ongoing
        Message 3 of 14 , Jan 19, 2013
        • 0 Attachment
          Kristoff,

          I've experimented with audio and fldigi on two original RPi's, but I
          don't have a rev 2 to help answer your question. There is definitely
          an ongoing and serious problem with USB on the RPi, though.

          I would like to characterize the performance of several audio
          devices. How to do you measure the number of frames dropped? Is
          there a service in linux that gives this information?

          Thanks,
          Michael KD4SGN

          > Hi,
          >
          >
          >
          > As has been discussed and published a number of times on the net, there
          > seams to be a pretty serious problem with USB on the RPi, which has its
          > effects on using an USB audio-dongle on it.
          > From what I have found, it seams to be related to using a USB 1.1
          > device on the (USB 2.0) HUB of the Pi.
          >
          >
        • Alan Melia
          Could this be the same problem as surfaced with the original Funcube SDR receiver software. Here I believe dropped frames were due to drift between the two
          Message 4 of 14 , Jan 19, 2013
          • 0 Attachment
            Could this be the same problem as surfaced with the original Funcube SDR
            receiver software. Here I believe dropped frames were due to drift between
            the two clocks (PC and USB "unit") Details may be found describing the
            symptoms and solution on the Funcube Yahoo Group.

            Alan
            G3NYK

            ----- Original Message -----
            From: "Michael O'Bannon" <mob@...>
            To: <Raspberry_Pi_4-Ham_RADIO@yahoogroups.com>
            Sent: Saturday, January 19, 2013 3:19 PM
            Subject: Re: [Raspberry_Pi_4-Ham_RADIO] USB audio on RPi


            >
            > Kristoff,
            >
            > I've experimented with audio and fldigi on two original RPi's, but I
            > don't have a rev 2 to help answer your question. There is definitely
            > an ongoing and serious problem with USB on the RPi, though.
            >
            > I would like to characterize the performance of several audio
            > devices. How to do you measure the number of frames dropped? Is
            > there a service in linux that gives this information?
            >
            > Thanks,
            > Michael KD4SGN
            >
            >> Hi,
            >>
            >>
            >>
            >> As has been discussed and published a number of times on the net, there
            >> seams to be a pretty serious problem with USB on the RPi, which has its
            >> effects on using an USB audio-dongle on it.
            >> From what I have found, it seams to be related to using a USB 1.1
            >> device on the (USB 2.0) HUB of the Pi.
            >>
            >>
            >
            >
            >
            > ------------------------------------
            >
            > Yahoo! Groups Links
            >
            >
            >
          • Robert Nickels
            ... Could be. All I can add is that I ve had no problem when pulling 2 million samples per second from a DVB-T dongle on the Pi, so it s capable of handling
            Message 5 of 14 , Jan 19, 2013
            • 0 Attachment
              On 1/19/2013 3:20 AM, Kristoff Bonne wrote:
              > From what I have found, it seams to be related to using a USB 1.1
              > device on the (USB 2.0) HUB of the Pi.

              Could be. All I can add is that I've had no problem when pulling 2
              million samples per second from a DVB-T dongle on the Pi, so it's
              capable of handling pretty high speed USB 2.0 data from that device, at
              least.

              73, Bob W9RAN
            • (KP4TR)Ramon Gonzalez
              You should use an external powered USB hub with a power supply rated at least 2 amps. I have done extensive tests and determined (in my situation) that even a
              Message 6 of 14 , Jan 19, 2013
              • 0 Attachment
                You should use an external powered USB hub with a power supply rated at least 2 amps. I have done extensive tests and determined (in my situation) that even a 1 amp USB hub is not enough. I lose my USB after 1-2 hours of use, which includes the Ethernet module. By using one like the Belkin powered USB hub or the DLINK hub my Pi is very stable. A cheap powered USB hub I had didn't work well, but I replaced the cheap power supply with one from a Magellan GPS rated at 2 amps 5V and it solved my problem with stability as well.

                I know that in many forums they say it is not recommended to power the Pi using a USB powered hub, but I have gone against this thinking and has worked very well for me. My setup is an IRLP node with changes recently released by VE7LTD (Dave Cameron) at http://www.irlp.net/pi and has a wired IRLP board powered by the Pi itself. Also in the mix is a USB soundcard and an Edimax wireless USB adapter.

                Avoid cheap powered USB hubs. Their power supplies are bad and may not deliver enough current to keep the Pi stable.


                On 1/19/2013 4:20 AM, Kristoff Bonne wrote:
                 

                Hi,

                As has been discussed and published a number of times on the net, there
                seams to be a pretty serious problem with USB on the RPi, which has its
                effects on using an USB audio-dongle on it.
                From what I have found, it seams to be related to using a USB 1.1
                device on the (USB 2.0) HUB of the Pi.

                This has been my experience sofar:
                - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                audio-frames during audio-capturing. The number of frames dropped per
                second does differ quite a lot per device. On some devices (like a USB
                headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                of 25).

                - One trick seams to be to boot the Pi with the option set to limit the
                USB speed to USB 1.1).

                However, this seams to have a number of issues:
                - in some cases, USB does not work anymore. E.g. my USB keyboard does
                not work anymore.
                - I had rapports of people where there are problems with the video
                - When I use this trick and have 2 audio-devices active (both running at
                48 Kbps full-duplex) at the same time, I have problems that the devices
                says it does not have sufficient bandwidth for both sessions.
                I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                sampling, 16 bits/sample), I only have 3 Mbps / second

                I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                modem for VHF and UHF), so I do need two audio-connections (one for the
                headset for the user and one for the GMSK modem connection to the radio).

                What is the experience of people on this group about this?

                Some question:
                - is there somebody who has a revision 2.0 version of the RPi. Does it
                also have this USB issue?

                - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                read, the problem with the USB-bus is related to using a USB 1.1 device
                on the USB 2.0 bus. So does using a USB 2.0 device help?

                73
                Kristoff - ON1ARF


              • Ray Wells
                Hi All, I m not convinced that the power supply is the only problem. I run a RPi as an APRS gateway using a wifi link to my LAN. The RPi runs from a 7 port
                Message 7 of 14 , Jan 19, 2013
                • 0 Attachment
                  Hi All,

                  I'm not convinced that the power supply is the only problem.

                  I run a RPi as an APRS gateway using a wifi link to my LAN. The RPi runs from a 7 port powered hub with a 2.1A supply. The supply is verified clean and stable with digital voltmeter and an oscilloscope. Feeding the hub is the RPi USB (in addition to its power suppy cable) and hanging from the hub is a four port USB/RS232 adapter for my TNC's (currently 2 but soon to be 3) and the wifi dongle.

                  My RPi (I've tried both of the two I own) will run for up to 10 days before crashing and sometimes much less. I've been through the process of trying different power supplies and different supply arrangements - 1 supply or 2 supplies. I've even used 12v to 5v adapters to run the RPi from battery backup to eliminate mains spike issues.

                  My "crash" is really a loss of the wifi link which appears to be up (green light on) but there is no activity. I now believe this is caused by USB failure and not complete failure of the RPi. I was running a cron job every 15 minutes to ping my router and write the results to a log. Even when the wifi link was lost  the RPi kept writing to the log file and reporting failed attempts.

                  The salient point I observed from system logs was that, every time, prior to the wifi failure, the ethernet port had fallen over. I don't use ethernet but it remains available and configured.

                  USB and Ethernet are controlled by the SAME chip.

                  After lots of Googling I stumbled across a script that checks some /sys files every minute from a cron job and, depending on the script output takes action to restore the chip to working once again. I have had the script invoked for 4 days now and so far the script log has not reported a failure, but, being that the RPi has been able to go for 10 days without failure, I can't yet be sure if I've found the solution to my wifi failure.

                  FWIW, take a look here ...
                  https://github.com/raspberrypi/linux/issues/151

                  Ray,
                  vk2tv

                  On 20/01/13 06:44, (KP4TR)Ramon Gonzalez wrote:
                   

                  You should use an external powered USB hub with a power supply rated at least 2 amps. I have done extensive tests and determined (in my situation) that even a 1 amp USB hub is not enough. I lose my USB after 1-2 hours of use, which includes the Ethernet module. By using one like the Belkin powered USB hub or the DLINK hub my Pi is very stable. A cheap powered USB hub I had didn't work well, but I replaced the cheap power supply with one from a Magellan GPS rated at 2 amps 5V and it solved my problem with stability as well.

                  I know that in many forums they say it is not recommended to power the Pi using a USB powered hub, but I have gone against this thinking and has worked very well for me. My setup is an IRLP node with changes recently released by VE7LTD (Dave Cameron) at http://www.irlp.net/pi and has a wired IRLP board powered by the Pi itself. Also in the mix is a USB soundcard and an Edimax wireless USB adapter.

                  Avoid cheap powered USB hubs. Their power supplies are bad and may not deliver enough current to keep the Pi stable.


                  On 1/19/2013 4:20 AM, Kristoff Bonne wrote:
                   

                  Hi,

                  As has been discussed and published a number of times on the net, there
                  seams to be a pretty serious problem with USB on the RPi, which has its
                  effects on using an USB audio-dongle on it.
                  From what I have found, it seams to be related to using a USB 1.1
                  device on the (USB 2.0) HUB of the Pi.

                  This has been my experience sofar:
                  - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                  audio-frames during audio-capturing. The number of frames dropped per
                  second does differ quite a lot per device. On some devices (like a USB
                  headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                  of 25).

                  - One trick seams to be to boot the Pi with the option set to limit the
                  USB speed to USB 1.1).

                  However, this seams to have a number of issues:
                  - in some cases, USB does not work anymore. E.g. my USB keyboard does
                  not work anymore.
                  - I had rapports of people where there are problems with the video
                  - When I use this trick and have 2 audio-devices active (both running at
                  48 Kbps full-duplex) at the same time, I have problems that the devices
                  says it does not have sufficient bandwidth for both sessions.
                  I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                  if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                  sampling, 16 bits/sample), I only have 3 Mbps / second

                  I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                  modem for VHF and UHF), so I do need two audio-connections (one for the
                  headset for the user and one for the GMSK modem connection to the radio).

                  What is the experience of people on this group about this?

                  Some question:
                  - is there somebody who has a revision 2.0 version of the RPi. Does it
                  also have this USB issue?

                  - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                  read, the problem with the USB-bus is related to using a USB 1.1 device
                  on the USB 2.0 bus. So does using a USB 2.0 device help?

                  73
                  Kristoff - ON1ARF



                • Brian GW6WTK
                  Hi guys I have had WiFi running a simplex node (GMSK) uninterrupted for months without any crashes, the WiFi dongle I have always used is a TP-LinkTL-WN723N,
                  Message 8 of 14 , Jan 20, 2013
                  • 0 Attachment
                    Hi guys
                       I have had WiFi running a simplex node (GMSK) uninterrupted for months without any crashes, the WiFi dongle I have always used is a TP-Link TL-WN723N, it's current 'uptime' is 18 days because of a Christmas holiday.
                    The R-PI is completely stand alone, with only the WiFi dongle and the USB to the GMSK connected directly to it, the power-supply to it is now dropped from the supply to the radio via a simple 5Volt regulator. I have no intention of shutting  down the R-PI in the near future as it appears to be extremely stable, logging is done automatically from ramdisk to remote webspace.

                    Perhaps is just a case of the suitability of the dongle, this one has always worked well for me.

                    Brian
                    gw6wtk

                    On 19/01/2013 21:43, Ray Wells wrote:
                     

                    Hi All,

                    I'm not convinced that the power supply is the only problem.

                    I run a RPi as an APRS gateway using a wifi link to my LAN. The RPi runs from a 7 port powered hub with a 2.1A supply. The supply is verified clean and stable with digital voltmeter and an oscilloscope. Feeding the hub is the RPi USB (in addition to its power suppy cable) and hanging from the hub is a four port USB/RS232 adapter for my TNC's (currently 2 but soon to be 3) and the wifi dongle.

                    My RPi (I've tried both of the two I own) will run for up to 10 days before crashing and sometimes much less. I've been through the process of trying different power supplies and different supply arrangements - 1 supply or 2 supplies. I've even used 12v to 5v adapters to run the RPi from battery backup to eliminate mains spike issues.

                    My "crash" is really a loss of the wifi link which appears to be up (green light on) but there is no activity. I now believe this is caused by USB failure and not complete failure of the RPi. I was running a cron job every 15 minutes to ping my router and write the results to a log. Even when the wifi link was lost  the RPi kept writing to the log file and reporting failed attempts.

                    The salient point I observed from system logs was that, every time, prior to the wifi failure, the ethernet port had fallen over. I don't use ethernet but it remains available and configured.

                    USB and Ethernet are controlled by the SAME chip.

                    After lots of Googling I stumbled across a script that checks some /sys files every minute from a cron job and, depending on the script output takes action to restore the chip to working once again. I have had the script invoked for 4 days now and so far the script log has not reported a failure, but, being that the RPi has been able to go for 10 days without failure, I can't yet be sure if I've found the solution to my wifi failure.

                    FWIW, take a look here ...
                    https://github.com/raspberrypi/linux/issues/151

                    Ray,
                    vk2tv

                    On 20/01/13 06:44, (KP4TR)Ramon Gonzalez wrote:
                     

                    You should use an external powered USB hub with a power supply rated at least 2 amps. I have done extensive tests and determined (in my situation) that even a 1 amp USB hub is not enough. I lose my USB after 1-2 hours of use, which includes the Ethernet module. By using one like the Belkin powered USB hub or the DLINK hub my Pi is very stable. A cheap powered USB hub I had didn't work well, but I replaced the cheap power supply with one from a Magellan GPS rated at 2 amps 5V and it solved my problem with stability as well.

                    I know that in many forums they say it is not recommended to power the Pi using a USB powered hub, but I have gone against this thinking and has worked very well for me. My setup is an IRLP node with changes recently released by VE7LTD (Dave Cameron) at http://www.irlp.net/pi and has a wired IRLP board powered by the Pi itself. Also in the mix is a USB soundcard and an Edimax wireless USB adapter.

                    Avoid cheap powered USB hubs. Their power supplies are bad and may not deliver enough current to keep the Pi stable.


                    On 1/19/2013 4:20 AM, Kristoff Bonne wrote:
                     

                    Hi,

                    As has been discussed and published a number of times on the net, there
                    seams to be a pretty serious problem with USB on the RPi, which has its
                    effects on using an USB audio-dongle on it.
                    From what I have found, it seams to be related to using a USB 1.1
                    device on the (USB 2.0) HUB of the Pi.

                    This has been my experience sofar:
                    - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                    audio-frames during audio-capturing. The number of frames dropped per
                    second does differ quite a lot per device. On some devices (like a USB
                    headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                    of 25).

                    - One trick seams to be to boot the Pi with the option set to limit the
                    USB speed to USB 1.1).

                    However, this seams to have a number of issues:
                    - in some cases, USB does not work anymore. E.g. my USB keyboard does
                    not work anymore.
                    - I had rapports of people where there are problems with the video
                    - When I use this trick and have 2 audio-devices active (both running at
                    48 Kbps full-duplex) at the same time, I have problems that the devices
                    says it does not have sufficient bandwidth for both sessions.
                    I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                    if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                    sampling, 16 bits/sample), I only have 3 Mbps / second

                    I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                    modem for VHF and UHF), so I do need two audio-connections (one for the
                    headset for the user and one for the GMSK modem connection to the radio).

                    What is the experience of people on this group about this?

                    Some question:
                    - is there somebody who has a revision 2.0 version of the RPi. Does it
                    also have this USB issue?

                    - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                    read, the problem with the USB-bus is related to using a USB 1.1 device
                    on the USB 2.0 bus. So does using a USB 2.0 device help?

                    73
                    Kristoff - ON1ARF




                  • Kristoff Bonne
                    HI Michael, ... I ve dropped a small test tool on my website: http://villazeebries.krbonne.net/raspi_audioframedroptest/raspi_audioframedroptest.tar.gz It s
                    Message 9 of 14 , Jan 20, 2013
                    • 0 Attachment
                      HI Michael,




                      On 19-01-13 16:19, Michael O'Bannon wrote:
                       


                      Kristoff,

                      I've experimented with audio and fldigi on two original RPi's, but I
                      don't have a rev 2 to help answer your question. There is definitely
                      an ongoing and serious problem with USB on the RPi, though.

                      I would like to characterize the performance of several audio
                      devices. How to do you measure the number of frames dropped? Is
                      there a service in linux that gives this information?

                      I've dropped a small test tool on my website:
                      http://villazeebries.krbonne.net/raspi_audioframedroptest/raspi_audioframedroptest.tar.gz

                      It's actually code from one of the applications I am using for the c2_gmsk project. Just download, do "make" and that should be it.
                      If it complains about not finding the portaudio functions, do this: "sudo apt-get install portaudio19-dev"


                      It's very simple. What is does is start a audio-capturing session and count the number of audio-frames it receives. If it reaches a certain value, it stops and gives information how long the application has run.

                      Do this to get a list of audio-devices on your system and get their names:
                      $ ./audiocapture_callbackcount 1000 40 48000 ""

                      In  my case, I get this:
                      Audio device: 1 (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                      Samplerate 48000 supported in mono.

                      Audio device: 2 (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                      Samplerate 48000 supported in mono.

                      The first one of the generic cheap USB audio dongle I use for the gmsk modem. The latter one is a USB headset.  (please ignore all the junk messages during Portaudio init).


                      Testing is done like this:

                      kristoff@raspberrypi ~/raspi_audioframedroptest $ ./audiocapture_callbackcount 1000 40 48000 Generic
                      INITIALISING PORTAUDIO    (this can take some time, please ignore any errors below) ....
                      (...)
                      Audio device: 1 (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                      Samplerate 48000 supported in mono.

                      Selected Audio device = (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                      Second 0001, Current count 0025, Total count = 0025
                      Second 0002, Current count 0025, Total count = 0050
                      (...)

                      Second 0037, Current count 0024, Total count = 0926
                      Second 0038, Current count 0026, Total count = 0952
                      Second 0039, Current count 0025, Total count = 0977
                      DONE: timediff = 39 sec, 965 msec

                      In this case, it opened a audio-capturing session to the "Generic" audio-dongle, sampling at 48000 samples/second requesting 40 ms audio-frames. This is equivalent to 25 samples / second (1 sec / 40 ms).

                      The application will stop when it receives 1000 frames, which should take 40 seconds (1000 frames / 25 frames-per-second).

                      Using this dongle, it took 40 seconds, so that is good.



                      This is the same test but with a USB headset:
                      $ ./audiocapture_callbackcount 1000 40 48000 headset
                      INITIALISING PORTAUDIO    (this can take some time, please ignore any errors below) ....
                      (...)

                      Audio device: 2 (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                      Samplerate 48000 supported in mono.

                      Selected Audio device = (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                      Second 0001, Current count 0018, Total count = 0018
                      Second 0002, Current count 0018, Total count = 0036
                      Second 0003, Current count 0018, Total count = 0054
                      Second 0004, Current count 0017, Total count = 0071
                      (...)
                      Second 0053, Current count 0018, Total count = 0935
                      Second 0054, Current count 0017, Total count = 0952
                      Second 0055, Current count 0017, Total count = 0969
                      Second 0056, Current count 0018, Total count = 0987
                      DONE: timediff = 56 sec, 821 msec

                      So, in this case, it received 17 to 18 frames per second (instead of the 25 if should receive), which seams to indicate that about 20 to 25 % of the frames send by the audio-device never arrive in the RPi.

                      I've done tests with a number of different devices. Sofar, my conclussion is:
                      - it greatly depends on the device you have. Some devices do work pretty good. E.g. the griphin iMic I use for the digital modes on my PC seams to work very good).

                      - What also is strange is that I sometimes get different results with the same device. E.g. the cheapo USB dongle I have. (the "Generic" device).
                      When I connect it directly to the USB connector on the RPi, I have some frame-lost. The last check I did lost soem 15 frames out of 1000.

                      However, when I do not connect it directly but with a small 20 cm USB-cable inbetween, I do not have any frameloss!!!  (as shown in the test above)?.


                      So it's a very weird problem!!!



                      However, the nett result is that -as it stands now- using the USB audio-device for a digital modem (like the GMSK modem, or the APRS soundcard modem for packet / ARPS), the RPi does have a serious problem!

                      Modem-software usually is not designed to deal with losing complete audio-frames.



                      Thanks,
                      Michael KD4SGN

                      73
                      Kristoff - ON1ARF
                    • Michael O'Bannon
                      Kristoff, Thanks for providing this test software. I ll do some tests over the next couple of days and post them. Best regards, Michael KD4SGN
                      Message 10 of 14 , Jan 20, 2013
                      • 0 Attachment
                        Kristoff,

                        Thanks for providing this test software.  I'll do some tests over the next couple of days and post them.

                        Best regards,
                        Michael  KD4SGN

                        HI Michael,




                        On 19-01-13 16:19, Michael O'Bannon wrote:
                         


                        Kristoff,

                        I've experimented with audio and fldigi on two original RPi's, but I
                        don't have a rev 2 to help answer your question. There is definitely
                        an ongoing and serious problem with USB on the RPi, though.

                        I would like to characterize the performance of several audio
                        devices. How to do you measure the number of frames dropped? Is
                        there a service in linux that gives this information?

                        I've dropped a small test tool on my website:
                        http://villazeebries.krbonne.net/raspi_audioframedroptest/raspi_audioframedroptest.tar.gz

                        It's actually code from one of the applications I am using for the c2_gmsk project. Just download, do "make" and that should be it.
                        If it complains about not finding the portaudio functions, do this: "sudo apt-get install portaudio19-dev"


                        It's very simple. What is does is start a audio-capturing session and count the number of audio-frames it receives. If it reaches a certain value, it stops and gives information how long the application has run.

                        Do this to get a list of audio-devices on your system and get their names:
                        $ ./audiocapture_callbackcount 1000 40 48000 ""

                        In  my case, I get this:
                        Audio device: 1 (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                        Samplerate 48000 supported in mono.

                        Audio device: 2 (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                        Samplerate 48000 supported in mono.

                        The first one of the generic cheap USB audio dongle I use for the gmsk modem. The latter one is a USB headset.  (please ignore all the junk messages during Portaudio init).


                        Testing is done like this:

                        kristoff@raspberrypi ~/raspi_audioframedroptest $ ./audiocapture_callbackcount 1000 40 48000 Generic
                        INITIALISING PORTAUDIO    (this can take some time, please ignore any errors below) ....
                        (...)
                        Audio device: 1 (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                        Samplerate 48000 supported in mono.

                        Selected Audio device = (API: ALSA ,NAME: Generic USB Audio Device: USB Audio (hw:1,0))
                        Second 0001, Current count 0025, Total count = 0025
                        Second 0002, Current count 0025, Total count = 0050
                        (...)

                        Second 0037, Current count 0024, Total count = 0926
                        Second 0038, Current count 0026, Total count = 0952
                        Second 0039, Current count 0025, Total count = 0977
                        DONE: timediff = 39 sec, 965 msec

                        In this case, it opened a audio-capturing session to the "Generic" audio-dongle, sampling at 48000 samples/second requesting 40 ms audio-frames. This is equivalent to 25 samples / second (1 sec / 40 ms).

                        The application will stop when it receives 1000 frames, which should take 40 seconds (1000 frames / 25 frames-per-second).

                        Using this dongle, it took 40 seconds, so that is good.



                        This is the same test but with a USB headset:
                        $ ./audiocapture_callbackcount 1000 40 48000 headset
                        INITIALISING PORTAUDIO    (this can take some time, please ignore any errors below) ....
                        (...)

                        Audio device: 2 (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                        Samplerate 48000 supported in mono.

                        Selected Audio device = (API: ALSA ,NAME: Sennheiser USB headset: USB Audio (hw:2,0))
                        Second 0001, Current count 0018, Total count = 0018
                        Second 0002, Current count 0018, Total count = 0036
                        Second 0003, Current count 0018, Total count = 0054
                        Second 0004, Current count 0017, Total count = 0071
                        (...)
                        Second 0053, Current count 0018, Total count = 0935
                        Second 0054, Current count 0017, Total count = 0952
                        Second 0055, Current count 0017, Total count = 0969
                        Second 0056, Current count 0018, Total count = 0987
                        DONE: timediff = 56 sec, 821 msec

                        So, in this case, it received 17 to 18 frames per second (instead of the 25 if should receive), which seams to indicate that about 20 to 25 % of the frames send by the audio-device never arrive in the RPi.

                        I've done tests with a number of different devices. Sofar, my conclussion is:
                        - it greatly depends on the device you have. Some devices do work pretty good. E.g. the griphin iMic I use for the digital modes on my PC seams to work very good).

                        - What also is strange is that I sometimes get different results with the same device. E.g. the cheapo USB dongle I have. (the "Generic" device).
                        When I connect it directly to the USB connector on the RPi, I have some frame-lost. The last check I did lost soem 15 frames out of 1000.

                        However, when I do not connect it directly but with a small 20 cm USB-cable inbetween, I do not have any frameloss!!!  (as shown in the test above)?.


                        So it's a very weird problem!!!



                        However, the nett result is that -as it stands now- using the USB audio-device for a digital modem (like the GMSK modem, or the APRS soundcard modem for packet / ARPS), the RPi does have a serious problem!

                        Modem-software usually is not designed to deal with losing complete audio-frames.



                        Thanks,
                        Michael KD4SGN

                        73
                        Kristoff - ON1ARF

                      • Ray Wells
                        I m used to uptimes of in excess of 300 days with Linux installations. The 10 day limit (for me) is disappointing however I ll persevere for now and keep my
                        Message 11 of 14 , Jan 20, 2013
                        • 0 Attachment
                          I'm used to uptimes of in excess of 300 days with Linux installations. The 10 day limit (for me) is disappointing however I'll persevere for now and keep my old P3 800MHz motherboard ready for a return to service, despite greatly increased input energy. Reliability is far more important.

                          I'm using a TL-WN721N device but a Realtek clone fared no better in the reliability stakes on the RPi.

                          Perhaps you were luckier than many with the particular USB/Ethernet chip on your RPi.

                          I see that the 723 and 721 dongles identify differently.  Significant??


                          vk2tv@vk2tv-RPi ~ $ lsusb
                          Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
                          Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
                          Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
                          Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
                          Bus 001 Device 005: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
                          Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
                          Bus 001 Device 007: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
                          vk2tv@vk2tv-RPi ~ $

                          Ray vk2tv


                          On 20/01/13 23:25, Brian GW6WTK wrote:
                          Hi guys
                             I have had WiFi running a simplex node (GMSK) uninterrupted for months without any crashes, the WiFi dongle I have always used is a TP-Link TL-WN723N, it's current 'uptime' is 18 days because of a Christmas holiday.
                          The R-PI is completely stand alone, with only the WiFi dongle and the USB to the GMSK connected directly to it, the power-supply to it is now dropped from the supply to the radio via a simple 5Volt regulator. I have no intention of shutting  down the R-PI in the near future as it appears to be extremely stable, logging is done automatically from ramdisk to remote webspace.

                          Perhaps is just a case of the suitability of the dongle, this one has always worked well for me.

                          Brian
                          gw6wtk

                          On 19/01/2013 21:43, Ray Wells wrote:
                           

                          Hi All,

                          I'm not convinced that the power supply is the only problem.

                          I run a RPi as an APRS gateway using a wifi link to my LAN. The RPi runs from a 7 port powered hub with a 2.1A supply. The supply is verified clean and stable with digital voltmeter and an oscilloscope. Feeding the hub is the RPi USB (in addition to its power suppy cable) and hanging from the hub is a four port USB/RS232 adapter for my TNC's (currently 2 but soon to be 3) and the wifi dongle.

                          My RPi (I've tried both of the two I own) will run for up to 10 days before crashing and sometimes much less. I've been through the process of trying different power supplies and different supply arrangements - 1 supply or 2 supplies. I've even used 12v to 5v adapters to run the RPi from battery backup to eliminate mains spike issues.

                          My "crash" is really a loss of the wifi link which appears to be up (green light on) but there is no activity. I now believe this is caused by USB failure and not complete failure of the RPi. I was running a cron job every 15 minutes to ping my router and write the results to a log. Even when the wifi link was lost  the RPi kept writing to the log file and reporting failed attempts.

                          The salient point I observed from system logs was that, every time, prior to the wifi failure, the ethernet port had fallen over. I don't use ethernet but it remains available and configured.

                          USB and Ethernet are controlled by the SAME chip.

                          After lots of Googling I stumbled across a script that checks some /sys files every minute from a cron job and, depending on the script output takes action to restore the chip to working once again. I have had the script invoked for 4 days now and so far the script log has not reported a failure, but, being that the RPi has been able to go for 10 days without failure, I can't yet be sure if I've found the solution to my wifi failure.

                          FWIW, take a look here ...
                          https://github.com/raspberrypi/linux/issues/151

                          Ray,
                          vk2tv

                          On 20/01/13 06:44, (KP4TR)Ramon Gonzalez wrote:
                           

                          You should use an external powered USB hub with a power supply rated at least 2 amps. I have done extensive tests and determined (in my situation) that even a 1 amp USB hub is not enough. I lose my USB after 1-2 hours of use, which includes the Ethernet module. By using one like the Belkin powered USB hub or the DLINK hub my Pi is very stable. A cheap powered USB hub I had didn't work well, but I replaced the cheap power supply with one from a Magellan GPS rated at 2 amps 5V and it solved my problem with stability as well.

                          I know that in many forums they say it is not recommended to power the Pi using a USB powered hub, but I have gone against this thinking and has worked very well for me. My setup is an IRLP node with changes recently released by VE7LTD (Dave Cameron) at http://www.irlp.net/pi and has a wired IRLP board powered by the Pi itself. Also in the mix is a USB soundcard and an Edimax wireless USB adapter.

                          Avoid cheap powered USB hubs. Their power supplies are bad and may not deliver enough current to keep the Pi stable.


                          On 1/19/2013 4:20 AM, Kristoff Bonne wrote:
                           

                          Hi,

                          As has been discussed and published a number of times on the net, there
                          seams to be a pretty serious problem with USB on the RPi, which has its
                          effects on using an USB audio-dongle on it.
                          From what I have found, it seams to be related to using a USB 1.1
                          device on the (USB 2.0) HUB of the Pi.

                          This has been my experience sofar:
                          - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                          audio-frames during audio-capturing. The number of frames dropped per
                          second does differ quite a lot per device. On some devices (like a USB
                          headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                          of 25).

                          - One trick seams to be to boot the Pi with the option set to limit the
                          USB speed to USB 1.1).

                          However, this seams to have a number of issues:
                          - in some cases, USB does not work anymore. E.g. my USB keyboard does
                          not work anymore.
                          - I had rapports of people where there are problems with the video
                          - When I use this trick and have 2 audio-devices active (both running at
                          48 Kbps full-duplex) at the same time, I have problems that the devices
                          says it does not have sufficient bandwidth for both sessions.
                          I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                          if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                          sampling, 16 bits/sample), I only have 3 Mbps / second

                          I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                          modem for VHF and UHF), so I do need two audio-connections (one for the
                          headset for the user and one for the GMSK modem connection to the radio).

                          What is the experience of people on this group about this?

                          Some question:
                          - is there somebody who has a revision 2.0 version of the RPi. Does it
                          also have this USB issue?

                          - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                          read, the problem with the USB-bus is related to using a USB 1.1 device
                          on the USB 2.0 bus. So does using a USB 2.0 device help?

                          73
                          Kristoff - ON1ARF





                        • kb9mwr
                          I have the model B rev 2 one. I can confirm that the SYBA SD-CM-UAUD USB CM119 audio adapter works and shows no lost audio frames using your tool. (And thanks
                          Message 12 of 14 , Jan 20, 2013
                          • 0 Attachment
                            I have the model B rev 2 one.

                            I can confirm that the SYBA SD-CM-UAUD USB CM119 audio adapter works and shows no lost audio frames using your tool. (And thanks for that tool by the way)

                            I tried to document the setup here:
                            http://kb9mwr.blogspot.com/2013/01/raspberry-pi-and-sound-input.html

                            Setting up /etc/asound.conf is the part that baffled me the most.
                            (And still does, as it's hard to figure out what to put in there)

                            If I get real bored, I have several different USB adapters that I could test with your tool.

                            My preference is to find someone who wants them and they could mess with them.

                            --- In Raspberry_Pi_4-Ham_RADIO@yahoogroups.com, Kristoff Bonne wrote:
                            >
                            > Hi,
                            >
                            >
                            >
                            > As has been discussed and published a number of times on the net, there
                            > seams to be a pretty serious problem with USB on the RPi, which has its
                            > effects on using an USB audio-dongle on it.
                            > From what I have found, it seams to be related to using a USB 1.1
                            > device on the (USB 2.0) HUB of the Pi.
                            >
                            >
                            > This has been my experience sofar:
                            > - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                            > audio-frames during audio-capturing. The number of frames dropped per
                            > second does differ quite a lot per device. On some devices (like a USB
                            > headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                            > of 25).
                            >
                            > - One trick seams to be to boot the Pi with the option set to limit the
                            > USB speed to USB 1.1).
                            >
                            > However, this seams to have a number of issues:
                            > - in some cases, USB does not work anymore. E.g. my USB keyboard does
                            > not work anymore.
                            > - I had rapports of people where there are problems with the video
                            > - When I use this trick and have 2 audio-devices active (both running at
                            > 48 Kbps full-duplex) at the same time, I have problems that the devices
                            > says it does not have sufficient bandwidth for both sessions.
                            > I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                            > if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                            > sampling, 16 bits/sample), I only have 3 Mbps / second
                            >
                            > I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                            > modem for VHF and UHF), so I do need two audio-connections (one for the
                            > headset for the user and one for the GMSK modem connection to the radio).
                            >
                            >
                            > What is the experience of people on this group about this?
                            >
                            >
                            > Some question:
                            > - is there somebody who has a revision 2.0 version of the RPi. Does it
                            > also have this USB issue?
                            >
                            > - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                            > read, the problem with the USB-bus is related to using a USB 1.1 device
                            > on the USB 2.0 bus. So does using a USB 2.0 device help?
                            >
                            >
                            >
                            > 73
                            > Kristoff - ON1ARF
                            >
                          • kenwaldek
                            Thanks for this one, and the documentation Kenny vanbillemont
                            Message 13 of 14 , Jan 21, 2013
                            • 0 Attachment
                              Thanks for this one, and the documentation

                              Kenny vanbillemont 


                              Op 21-jan.-2013 om 03:13 heeft "kb9mwr" <kb9mwr@...> het volgende geschreven:

                               

                              I have the model B rev 2 one.

                              I can confirm that the SYBA SD-CM-UAUD USB CM119 audio adapter works and shows no lost audio frames using your tool. (And thanks for that tool by the way)

                              I tried to document the setup here:
                              http://kb9mwr.blogspot.com/2013/01/raspberry-pi-and-sound-input.html

                              Setting up /etc/asound.conf is the part that baffled me the most.
                              (And still does, as it's hard to figure out what to put in there)

                              If I get real bored, I have several different USB adapters that I could test with your tool.

                              My preference is to find someone who wants them and they could mess with them.

                              --- In Raspberry_Pi_4-Ham_RADIO@yahoogroups.com, Kristoff Bonne wrote:
                              >
                              > Hi,
                              >
                              >
                              >
                              > As has been discussed and published a number of times on the net, there
                              > seams to be a pretty serious problem with USB on the RPi, which has its
                              > effects on using an USB audio-dongle on it.
                              > From what I have found, it seams to be related to using a USB 1.1
                              > device on the (USB 2.0) HUB of the Pi.
                              >
                              >
                              > This has been my experience sofar:
                              > - When I just plug in a USB audiofob on the RPi, I seams to be loseing
                              > audio-frames during audio-capturing. The number of frames dropped per
                              > second does differ quite a lot per device. On some devices (like a USB
                              > headset), I only have 17 to 18 audio-frames of 40 ms per second (instead
                              > of 25).
                              >
                              > - One trick seams to be to boot the Pi with the option set to limit the
                              > USB speed to USB 1.1).
                              >
                              > However, this seams to have a number of issues:
                              > - in some cases, USB does not work anymore. E.g. my USB keyboard does
                              > not work anymore.
                              > - I had rapports of people where there are problems with the video
                              > - When I use this trick and have 2 audio-devices active (both running at
                              > 48 Kbps full-duplex) at the same time, I have problems that the devices
                              > says it does not have sufficient bandwidth for both sessions.
                              > I find this a bit odd as USB 1.1 is -as far as I know- 12 Mbps and even
                              > if you take the worse-case senario (2 * full-duplex stereo, 48 Khz
                              > sampling, 16 bits/sample), I only have 3 Mbps / second
                              >
                              > I use my RPi for developing the the c2_gmsk modem (codec2-based GMSK
                              > modem for VHF and UHF), so I do need two audio-connections (one for the
                              > headset for the user and one for the GMSK modem connection to the radio).
                              >
                              >
                              > What is the experience of people on this group about this?
                              >
                              >
                              > Some question:
                              > - is there somebody who has a revision 2.0 version of the RPi. Does it
                              > also have this USB issue?
                              >
                              > - Has somebody ever tried this with a USB 2.0 audio-device? As far as I
                              > read, the problem with the USB-bus is related to using a USB 1.1 device
                              > on the USB 2.0 bus. So does using a USB 2.0 device help?
                              >
                              >
                              >
                              > 73
                              > Kristoff - ON1ARF
                              >

                            • Kristoff Bonne
                              Hi Steve, We seams to bumb into eachother at different places. ... I know your blogarticle. I m subscribed to the RSS feed of your blog and it was exactly that
                              Message 14 of 14 , Jan 21, 2013
                              • 0 Attachment
                                Hi Steve,



                                We seams to bumb into eachother at different places.


                                On 21-01-13 03:13, kb9mwr wrote:
                                 

                                I have the model B rev 2 one.

                                I can confirm that the SYBA SD-CM-UAUD USB CM119 audio adapter works and shows no lost audio frames using your tool. (And thanks for that tool by the way)

                                I tried to document the setup here:
                                http://kb9mwr.blogspot.com/2013/01/raspberry-pi-and-sound-input.html

                                I know your blogarticle. I'm subscribed to the RSS feed of your blog and it was exactly that article that pointed me to the yahoo-group. (for which my gratitude) :-)


                                Two questions, just to be sure:
                                - Is this device USB 1.1 orUSB 2.0?

                                I found this trick to find detect this:
                                $ lsusb
                                Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
                                Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
                                Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
                                Bus 001 Device 004: ID 0d8c:000e C-Media Electronics, Inc. Audio Adapter (Planet UP-100, Genius G-Talk)

                                The last line is my audio-dongle.


                                Then do this:
                                $ lsusb -v -d 0d8c:000e
                                (with the last argument being the USB device id).

                                You'll get a long verbose dump of the characteristics of the device, but what we are looking for is this:
                                bcdUSB               1.10

                                According this page, "bcdUSB" (binary coded-decimal ???) is "USB Specification Number which device complies too."


                                2/ Has the test you have done been done with the "limit USB-speed to USB 1.10" trick applied or not?


                                Now, as said, for me, I need two audio-dongles and limiting the USB speed to USB 1.10 does not seams to solve it. When I run two full-duplex audio session at the same time, the Pi gives an error about not having enough bandwidth on the USB-bus. :-(

                                Does anybody have a reference to a USB 2.0 audio-dongle that is good and -by preference- easy to get.


                                BTW.
                                Does anybody have a reference to a good audio-dongle for SDR? (e.g. providing sampling-rates of 96 or 192 Ksamples/sec).?


                                73
                                kristoff - ON1ARF
                              Your message has been successfully submitted and would be delivered to recipients shortly.