9 Replies Latest reply on May 29, 2016 1:33 AM by slaros

    Intel Edison mini breakout board w/ MPD

    Niise

      FYI, and do a record.


      This document would give a guide for playbacking flac or music file on Intel Edison with external usb DAC. Please understand that, I wrote this guide after my task done, so you would need make sure you have backup.


      I would use Burson Conductor as a target device, it adept with c-media cm6631a usb receiver chip.


      

      Requirement

      Before-guide

      Flash ubilinux, debian w/ Wheezy for Edison

      Setup wifi

      Install MPD for a client-server playback server.

      Compile new version MPD

      configure config

      Build your own kernel

      Configure ALSA



      Requirement

      HW requirement:

      1. Intel Edison mini breakout board
      2. otg usb micro b male to type B (usually dac with type b input)
      3. dc power core (7~15v)
      4. optional : wifi U.FL connect line

      SW requirement:

      1. Linux operation (Ubuntu or Debian is better for operation consistence.)
      2. other SW would be found in apt-get.

      Before-guide

      In this guide, if start from “#”, it mean comment on your host. If it start with “$”, it mean commend on Intel Edison. I would suggest operating on Linux. because we finally would compiler kernel for wifi driver support.

      Flash ubilinux, debian w/ Wheezy for Edison

      I prefer Debian than Yocto

      1. reference site: https://learn.sparkfun.com/tutorials/loading-debian-ubilinux-on-the-edison
      2. get image from http://www.emutexlabs.com/ubilinux
        1. #mkdir download
        2. #cd download
        3. #wget http://www.emutexlabs.com/files/ubilinux/ubilinux-edison-141030.tar.gz
        4. #tar -zxvf ubilinux-edison-141030.tar.gz
      3. install the flash tool first
        # apt-get install dfu-util
      4. flash image
        # cd toFlash
        # sudo ./flashall.sh
      5. after flash done, please wait reboot twice.
      6. maybe you need do some configure on Intel Edison.
        # sudo screen /dev/ttyUSB0 115200
        1. log on into edison with
          1. user : edison
          2. password: edison
        2. strongly suggest follow sparkfun’s reference site to add/modify the default user.
          1. sudo, ssh, etc.

      Setup wifi

      after flash ubilinux, wifi would be work now.  we would let it connect to wifi ap first, to make sure the device is workable.

      1. reference site: http://ubuntuforums.org/showthread.php?t=202834
      2. get hex_string
        $wpa_passphrase <YOUR_WIFI_SSID> <YOUR_WIFI_PASSWORD>
        1. got the psk and remember your psk value for later usage.
      3. $vim /etc/network/interfaces
        1. commend auto usb0 with “#”
        2. uncomment wlan0, the line start should not have “#”
        3. fill your ssid and psk to profile field.
        4. in my case, I use eap wifi auth, here is a sample
          auto wlan0
          iface wlan0 inet dhcp
          wpa-driver wext
          wpa-ssid <SSID>
          wpa-ap-scan 2
          wpa-eap PEAP
          wpa-key-mgmt WPA-EAP
          wpa-anonymous-identity <anonymous_identity>
          wpa-identity <ACCOUNT>
          wpa-password <PASSWORD>
          wpa-phase2 auth=MSCHAPV2
          post-up iwconfig wlan0 power off # lower the latency
      4. $ifup wlan0
        1. if wifi cant work, try iwconfig to check the quality and signal strength
        2. $iwconfig
          1. some like as Link Quality=70/70  Signal level=-36 dBm

      Install MPD for a client-server playback server.

      Compile new version MPD

      this step is for new features of MPD (maybe new bugs..., but some music format with better support)

      1. the version in ubilinux is old, but we could install it to configure some variable.
        $ sudo apt-get install mpd
      2. now we should compile it by yourself, remove mpd first (without --purge)
        $ sudo apt-get remove mpd
      3. apt-get install some necessary packages
        $ sudo apt-get install build-essential libglib2.0-dev git vim
      4. add the source repository
        $ sudo vim /etc/apt/sources.list
      5. remove “#” from deb-src or add it!
        $ sudo apt-get update
      6. use apt-build to update necessary packages.
        $ sudo apt-get build-dep mpd
      7. compiler mpd from source code tarball
        $ wget -O - http://www.musicpd.org/download/mpd/stable/mpd-0.19.7.tar.gz | tar -zxf -
        $ cd mpd-0.19.7
        $ make clean
        $ ./configure
      8. maybe you need to install some build tools here. check the missing dependent package and install them.
        $ make
        $ sudo make install
        $ whereis mpd (to check the mpd path)
      9. base on last command, do a software link for it.
        $ sudo ln -s /usr/local/bin/mpd /usr/bin/mpd

      configure config

      1. after compile and install, we need some configure let it work for our purpose.
        $ sudo aplay -lcard
        1. 1: Audio [USB2.0 High-Speed True HD Audio], device 0: USB Audio [USB Audio]
      2. make sure following path exist, and check some values that we care.
        $ sudo vim /etc/mpd.conf
        music_directory      "/home/<USER>/music"
        playlist_directory           "/home/<USER>/.mpd/playlists"
        #bind_to_address
        port                         "6600"
        audio_output {
                type            "alsa"
                name            "Burson Conductor" # any you like
                device          "hw:1,0" #value in aplay -l
                auto_resample    "no"
                auto_format      "no"
                auto_channels    "no"
        }
        mixer_type                     "disabled"
        replaygain                     "off"
        $ sudo service mpd restart
      3. Done!
        but no sound output here. because default configure of Intel ‘s kernel have not build in  snd-usb-audio module. we should follow next step.


      Build your own kernel

      remember back to your Linux workstation.

      1. reference site: Intel® Edison Boards and Compute Modules — Board Support Package (BSP) User Guide
      2. now we can build the new kernel for audio support
        # mkdir edison
        # cd  edison
        # wget -O - http://downloadmirror.intel.com/24389/eng/edison-src-rel1-maint-rel1-ww42-14.tgz#_ga=1.225557722.1979370645.1410536481 | tar -zxf -
        # wget -O - https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.17.tar.bz2 | tar -jxf -
        # cd ./linux-3.10.17
        # patch -p1 < ../edison-src/device-software/meta-edison/recipes-kernel/linux/files/upstream_to_edison.patch
        # cp ../edison-src/device-software/meta-edison/recipes-kernel/linux/files/defconfig .config
        # cp drivers/tty/serial/mfd_trace.h include/trace/
      3. add usb sound support
        # make menuconfig
        1. mark module M at device driver -> Sound card support -> Advenced Linux Sound Architecture -> USB sound devices -> USB Audio / MIDI driver
      4. add for wifi module boardcom 4334x
        # cp -rf ../edison-src/broadcom_cws/ .
      5. Now build it
        # make -j16  -p broadcom_cws/wlan/driver_bcm43x/ deb-pkg
      6. Wait it compil done, you would get three debs at parent folder “edison”
        linux-headers-3.10.17-poky-edison_3.10.17-poky-edison-1_i386.deb
        linux-image-3.10.17-poky-edison_3.10.17-poky-edison-1_i386.deb
        linux-libc-dev_3.10.17-poky-edison-1_i386.deb
      7. now copy file into your Intel edison, if you have already set up ssh on edison, you can use scp to transfer file.
        # scp *.deb xx.xx.xx.xx:/home/<USER>/
        1. change to your edison command line
        2. maybe you want to backup /boot before next step.
          $ cp -R /boot/* /home/<USER>/boot_backup
        3. Install all deb file to complete the kernel installation
          $ dpkg -i *.deb
          $ cp /boot/vmlinuz-3.10.17-poky-edison /boot/vmlinuz  (keep the vmlinuz-3.10.17-poky-edison would help you update package easier)
          $ reboot
        4. after here, you should have a snd-usb-audio workable kernel on Edison or got a brick!!!
          1. if fail, go to “toFlash”, try again…

        Configure ALSA

        1. now you should install some alsa packages.
          $ apt-get install alsa-utils
          $ su alsactrl init
          $ aplay -Dhw:1,0 any.mp3
        2. If you got music from dac, done.


          later you could use mpd client now.



           

          訊息由此人編輯:Niise Wu : fix reference document link

           

          訊息由此人編輯:Niise Wu : modify the command