All entries in this blog series:
- Beaglebone Black Radio Challenge - Review
- Beaglebone Black Radio Challenge - Part 1: Project description
- Beaglebone Black Radio Challenge - Part 2: Getting the different components to work (this post)
- Beaglebone Black Radio Challenge - Part 3: User interface (Work in progress)
- Beaglebone Black Radio Challenge - Part 4: The Build
- Beaglebone Black Radio Challenge - Part 5: Project Finalisation
In this blog post, I document the actions that were required in order to get all hardware components of this project to run.
Beaglebone Black
After watching Ben Heck's episode on the BBB, I knew there were different ways to connect to it:
- Using an HDMI monitor and USB keyboard/mouse
- Using the mini USB connector
- Over the network via SSH
- Using the LCD cape
I connected the BBB on my local network using a UTP cable and powered it with a 5V power supply.
After booting, the IP address was reported on my router:
SSH is enabled by default, with no password for user "root":
Fredericks-MacBook-Air:~ fvan1$ ssh root@192.168.0.192 The authenticity of host '192.168.0.192 (192.168.0.192)' can't be established. RSA key fingerprint is d2:2d:7d:e6:9f:8e:03:38:f1:13:12:6d:f9:30:ad:0d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.192' (RSA) to the list of known hosts. root@192.168.0.192's password: root@beaglebone:~#
I found an Adafruit tutorial on updating the BBB's OS step-by-step: Overview | BeagleBone Black: Installing Operating Systems | Adafruit Learning System
Even with the BBB already running the latest version of Angstrom, I thought it would be a good exercise to flash it to get familiar with the procedure.
I downloaded the latest Angstrom image from BeagleBoard.org - latest-images: BBB-eMMC-flasher-2013.09.04.img.xz
After the download completed, I extracted the image and used "dd" to put it on an SD card.
I first listed the devices to get the proper disk id:
Fredericks-MacBook-Air:~ fvan1$ diskutil list /dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *251.0 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 250.1 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3 /dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *7.9 GB disk1 1: Windows_FAT_16 RECOVERY 1.3 GB disk1s1 2: Windows_FAT_32 boot 58.7 MB disk1s5 3: Linux 6.5 GB disk1s6
Then, I unmounted the SD card:
Fredericks-MacBook-Air:~ fvan1$ diskutil unmountDisk /dev/disk1 Unmount of all volumes on disk1 was successful
Finally, I wrote the image to the SD card using dd:
Fredericks-MacBook-Air:~ fvan1$ sudo dd if=Downloads/BBB-eMMC-flasher-2013.09.04.img of=/dev/disk1 bs=1m 3488+0 records in 3488+0 records out 3657433088 bytes transferred in 2280.014020 secs (1604127 bytes/sec)
40 minutes later, the image was written on the SD card, and ready to flash the BBB.
I inserted the microSD card in the proper slot on the BBB, held down the "user boot" button while powering it on. The 4 user LEDs lit up, and I released the "user boot" button.
40-45 minutes later, the 4 user LEDs remained lit up, meaning the flashing was done.
I powered down the BBB, removed the microSD card and powered it back on.
When I tried to log in via SSH again, a message appeared telling me the remote host key had changed.
This is for me an indication the flash was executed. I removed the exisiting entry from my known_hosts file and was able to log in via SSH again.
LCD Cape
The LCD cape provided for the roadtest is the "BeagleBone LCD4 Cape" from beagleboardtoys.com.
It supports resolutions up to 480x272 and has a resistive touch screen and some buttons.
The pins at the back of the LCD cape are numbered, just as on the BBB. I ensured the pin numbers were aligned and connected the cape.
I'm not sure if done on purpose or not, but the bottom part of the Adafruit BBB enclosure can still be used with the LCD cape connected.
This provides a firm and protective base for the BBB.
Even the LCD cape's power button fits nicely between the BBB's ethernet and power port.
After booting a calibration screen was displayed:
I had to repeat the calibration a few times, as it kept saying a mis-click was detected. On the fourth ( ! ) attempt, the calibration was accepted.
Once the calibration was done, the desktop was available:
Using the latest version of Angstrom, I can say the LCD cape was really plug-and-play.
Wifi Adapter
The wifi adapter provided for this challenge is the UWN-200 from Logic Supply.
Instructions on how to install it on the BBB are provided on the website. It is also mentioned that in the latest Angstrom image (2013-09-04), the drivers for this UWN-200 wifi adapter are included by default.
The remaining thing to do was to configure the wireless interface by editing/creating the wifi config file:
root@beaglebone:~# wpa_passphrase <ssid> <passphrase> network={ ssid="<ssid>" #psk="<passphrase>" psk=103f69f05b3fdd791067919813682829d5999a1be2a1e3a2c1b608c1def6d1d9 }
root@beaglebone:~# nano /var/lib/connman/wifi.config [service_home] Type = wifi Name = <ssid> Passphrase = <encrypted_passphrase_from_previous_command>
The documentation also mentions that the ethernet connection needs to be removed for the wifi to connect automatically.
So I sent the reboot command via ssh, removed the ethernet cable, waited for the device to boot and checked my router again for the new IP address.
The BBB was accessible via wifi and the interface was indeed up and running :
root@beaglebone:~# ifconfig ra0 ra0 Link encap:Ethernet HWaddr 00:0C:43:00:14:10 inet addr:192.168.0.121 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:43ff:fe00:1410/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6572 errors:0 dropped:0 overruns:0 frame:0 TX packets:307 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1487495 (1.4 MiB) TX bytes:49645 (48.4 KiB)
Again, very straightforward when using the latest Angstrom image.
Soundcard
I wanted to try two ways of getting audio from the BBB:
- via HDMI
- via a USB soundcard
HDMI
Using a microHDMI to VGA and Stereo out adapter, I was hoping to easily get audio out of the BBB.
However, when listing the soundcards of the BBB, none were found:
root@beaglebone:~# cat /proc/asound/cards --- no soundcards ---
root@beaglebone:~# aplay -l aplay: device_list:252: no soundcards found...
After some searches online, I came across Beagleboard:BeagleBoneBlack HDMI - eLinux.org where it is stated that audio is only supported when using specific video resolutions.
I removed the LCD cape, tried listing the soundcards again, and there it was:
root@beaglebone:~# cat /proc/asound/cards 0 [Black ]: TI_BeagleBone_B - TI BeagleBone Black TI BeagleBone Black
root@beaglebone:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Black [TI BeagleBone Black], device 0: HDMI nxp-hdmi-hifi-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0
The soundcard appeared, but my microHDMI adapter still didn't show any video via VGA, nor was there any audio via the stereo jack.
I decided to park the HDMI audio solution for now and go with the hopefully more straightforward USB soundcard approach.
USB
I've ordered a USB soundcard for further testing, but it hasn't arrived yet.
This means I'll be proceeding without any soundcard for now, and will be coming back on this topic later on ...
SDR Stick
Then came the final and what I believed to be the most challenging component to get up and running: the SDR Receiver USB Stick.
Before working on the BBB directly, I wanted to test the SDR Stick on my laptop, as I had never worked with such a device before.
Via the SDR USB Stick's product page on Adafruit, I found a nice graphical tool ported to Mac: gqrx. I installed it and started playing.
In a matter of seconds, I was listening to the radio:
Knowing the stick was working, It was time to figure out how to install the necessary packages on the BBB.
While searching the net for information on rtl-sdr and BBB, I came across this page: Beaglebone RTL-SDR
Following the instructions, I executed following commands:
root@beaglebone:~# opkg update root@beaglebone:~# opkg install libusb-1.0-dev root@beaglebone:~# mkdir build root@beaglebone:~# cd build/ root@beaglebone:~/build# git clone git://git.osmocom.org/rtl-sdr.git root@beaglebone:~/build# cd rtl-sdr/ root@beaglebone:~/build/rtl-sdr# autoreconf -i root@beaglebone:~/build/rtl-sdr# ./configure root@beaglebone:~/build/rtl-sdr# make root@beaglebone:~/build/rtl-sdr# make install
(Note: You can find the full output of every command in the file attached to this post.)
I logged in via SSH and executed a test command to see if my rtl-sdr installation succeeded:
root@beaglebone:~# rtl_test -t Found 1 device(s): 0: Realtek, RTL2838UHIDIR, SN: 00000001 Using device 0: Generic RTL2832U OEM Found Rafael Micro R820T tuner Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 Sampling at 2048000 S/s. No E4000 tuner found, aborting.
The device is recognised by the BBB and can now be used to listen to the radio!
However, without soundcard available or working (yet!), I ran the backend application on the BBB and the frontend on my laptop. This allowed me to run the SDR stick on the BBB, but control it from my laptop.
On the BBB:
root@beaglebone:~# rtl_tcp -a 192.168.0.121 Found 1 device(s): 0: Realtek, RTL2838UHIDIR, SN: 00000001 Using device 0: Generic RTL2832U OEM Found Rafael Micro R820T tuner Tuned to 100000000 Hz. listening... Use the device argument 'rtl_tcp=192.168.0.121:1234' in OsmoSDR (gr-osmosdr) source to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).
On my laptop, I started the gqrx application and provided the correct connection string, the BBB reported the client connected:
client accepted!
Radio was now working on my laptop via the BBB.
Conclusion
I managed to get all components provided in the roadtest kit up and running. The only pending hardware bit is getting a soundcard to work.
With (almost) all parts working, I can get started on the actual implementation of the features as described in my first post.
Update !
One day after posting this, my USB soundcard arrived. I should have been more patient ...
Using the same commands as before, I tried detecting the USB soundcard after plugging it in:
root@beaglebone:~# cat /proc/asound/cards 0 [Set ]: USB-Audio - C-Media USB Headphone Set C-Media USB Headphone Set at usb-musb-hdrc.1.auto-1.1, full speed
root@beaglebone:~# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Set [C-Media USB Headphone Set], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
Soundcard detected without any modifications. Feeling lucky, I tried playing out audio immediately:
root@beaglebone:~# rtl_fm -f 88.6e6 -s 200000 -r 48000 - | aplay -r 48k -f S16_LE Found 1 device(s): 0: Realtek, RTL2838UHIDIR, SN: 00000001 Using device 0: Generic RTL2832U OEM Found Rafael Micro R820T tuner Tuner gain set to automatic. Tuned to 88900000 Hz. Oversampling input by: 6x. Oversampling output by: 1x. Buffer size: 6.83ms Sampling at 1200000 S/s. Output at 200000 Hz. Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Audio was playing. Amazing. No need for driver installation, config file changes, etc ... just plug and play.