Thursday
May302013

DSP References

Friday
Dec282012

GNU Radio with gr-osmosdr on OS X

Installing gr-osmosdr Alongside a Macports Install of GNU Radio

File Formats

Creating a GNU Radio compatible WAV File from an MP3

sox infile.mp3 -2 outfile.wav

Reference

http://lists.gnu.org/archive/html/discuss-gnuradio/2012-02/msg00171.html

Pre-reqs

Macports gnuradio install

sudo port install py27-opengl-accelerate
sudo port install gnuradio +grc +jack +orc +portaudio +python27 +qtgui +sdl +swig +uhd +wavelet +wxgui configure.compiler=llvm-gcc-4.2

gr-osmosdr

cmake

cmake -DCMAKE_INSTALL_PREFIX=/opt/local/  -  DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/lib python2.7.dylib - DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
make
sudo make install

export PYTHONPATH=/opt/local/lib/python2.7/site- packages:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

rtl_test

Air:bin jaykickliter$ rtl_test -t
Found 1 device(s):
  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0 29.0 34.0 42.0 
Benchmarking E4000 PLL...
[E4K] PLL not locked for 51000000 Hz!
[E4K] PLL not locked for 2219000000 Hz!
[E4K] PLL not locked for 1110000000 Hz!
[E4K] PLL not locked for 1242000000 Hz!
E4K range: 52 to 2218 MHz
E4K L-band gap: 1110 to 1242 MHz

Install Locations

Air:build jaykickliter$ make install
[ 34%] Built target gnuradio-osmosdr
[ 38%] Built target _osmosdr_swig_doc_tag
[ 42%] Built target _osmosdr_swig_swig_tag
[ 61%] Built target _osmosdr_swig
[ 84%] Built target pygen_swig_5af12
[ 92%] Built target pygen_python_c246d
[100%] Built target osmosdr_grc_xml_blocks
[100%] Built target pygen_apps_9a6dd
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/pkgconfig/gnuradio-osmosdr.pc
-- Installing: /usr/local/include/osmosdr/osmosdr_api.h
-- Installing: /usr/local/include/osmosdr/osmosdr_pimpl.h
-- Installing: /usr/local/include/osmosdr/osmosdr_ranges.h
-- Installing: /usr/local/include/osmosdr/osmosdr_device.h
-- Installing: /usr/local/include/osmosdr/osmosdr_source_c.h
-- Installing: /usr/local/lib/libgnuradio-osmosdr.0.1.dylib
-- Installing: /usr/local/lib/libgnuradio-osmosdr.0.dylib
-- Installing: /usr/local/lib/libgnuradio-osmosdr.dylib
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/_osmosdr_swig.so
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/osmosdr_swig.py
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/osmosdr_swig.pyc
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/osmosdr_swig.pyo
-- Installing: /usr/local/include/osmosdr/swig/osmosdr_swig.i
-- Installing: /usr/local/include/osmosdr/swig/osmosdr_swig_doc.i
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/__init__.py
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/__init__.pyc
-- Installing: /usr/local/lib/python2.7/site-packages/osmosdr/__init__.pyo
-- Installing: /usr/local/share/gnuradio/grc/blocks/rtlsdr_source_c.xml
-- Installing: /usr/local/share/gnuradio/grc/blocks/osmosdr_source_c.xml
Wednesday
Oct172012

Embedding a Dynamic Library in a Cocoa Application

Objective

Your application depends on a Dynamic Library that may not be on the users machine, and you don’t want to ship your application with an installer. The solution is to include the dylib in your application’s bundle. The problem is that dylibs have their path hard-coded in them. The solution is to use the Apple supplied command line tool install_name_tool to modify the path inside the dylib to match its location inside your application bundle.

Steps

  1. Add a new Copy Files build phase
  2. Add a Shell Script build phase

Note: These build phases need be added before the Link Binary Libraries build phase

Copy Files Build Phase

Click the + button, click on the dynamic library already added to the Xcode project.

Destination               = Shared Support
Subpath                   = leave blank
Copy Only When Installing = unchecked

Shell Script Build Phase

This buid phase needs to be after the Copy Files phase.

Here’s the soure code, which I downloaded from here. I had to play around with ynniv’s script to accound for spaces in path names. I’m guessing his projects didn’t have any spaces and he never ran into that problem.

#!/bin/bash
# In Xcode you actually enter the path for the shell
# you want to use in a text field about the shell source.
# So, !/bin/bash might not be necessary.

# Space separated list of libraries.
# Enter any dylibs you have in your Copy File Phase.
TARGETS=libusb-1.0.0.dylib

EXECFILE=${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}
LIBPATH=${BUILT_PRODUCTS_DIR}/${SHARED_SUPPORT_FOLDER_PATH}
NEWLIBPATH=@executable_path/../SharedSupport

for TARGET in ${TARGETS} ; do
  LIBFILE=${LIBPATH}/${TARGET}
  TARGETID=`otool -DX "${LIBPATH}/$TARGET"`
  NEWTARGETID=${NEWLIBPATH}/${TARGET}
  install_name_tool -id "${NEWTARGETID}" "${LIBFILE}"
  install_name_tool -change ${TARGETID} ${NEWTARGETID} "${EXECFILE}"
done
Tuesday
Oct022012

Cypress FX2 USB Microcontroller

References

Prerequisites

Cypress Provided Stuff

  • AN74505-Developing USB Application on MAC OS X using LIBUSB

File Types

  • bix: native RAM file type
  • iic: native EEPROM file type

Don’t brick it!

  1. Use fx2loader to load the firmware into RAM first
  2. Try loading the same firmware into RAM again, without resetting the device
  3. If that worked then load it into EEPROM

Examples