SYSTEM INTEGRATION

From HPSDRwiki
Jump to: navigation, search

This section contains information useful in putting various pieces (modules) together to make working systems.

Ozy and Janus with Linux

Loading Ozy firmware

fxload [[1]] is the standard Cypress firmware loader for modern Linux distros.

Until we getting hotplug/udev support working (see the to do list), loading firmware with fxload requires a few manual steps.

The first step is to find your Ozy. Do this by using the lsusb utility from usbutils [[2]]:

lsusb -d 0xfffe:0x0007

The bus and device number displayed by lsusb can be used to construct the path (/proc/bus/usb/...) to the device that libusb-programs such as fxload expect. On my setup after a reboot, Ozy shows up on bus 4 and as device 10. (The device number will change as devices come and go.)

Next, given an Ozy, say, at usb bus 4, device 10, invoke fxload as follows to load the firmware on to the Ozy FX2:

fxload -t fx2 -D /proc/bus/usb/004/010 -I ./PowerSDR-163-OzyJanus-2007May11/Release/ozyfw-sdr1k.hex

Of course, substitute your device location for /proc/bus/usb/004/010.

Unless you adjust the permissions on the file, you will need to run this as root (e.g. via sudo).

Note: after the firmware loads, the device will be renumbered. You can find it at its new address by repearting the process above -- the vendor id (0xfffe) and product id (0x0007) remain the same once the firmware is running -- although this is probably a mistake in the firmware design.

Loading the FPGA

Using KD5TFD's tools -- these are in the svn repo -- you can load everything (firmware, fpga) and configure it with the following script, based on N8VB's DOS batch file.

 #!/bin/bash -e

 PATH=~/src/hpsdr/repos_sdr_hpsdr/KD5TFD/OzyUtils-Linux:$PATH
 RELEASE=~/src/hpsdr/PowerSDR-163-OzyJanus-2007May11/Release

 USB_VID=0xfffe
 USB_PID=0x0007

 loadFW $USB_VID $USB_PID $RELEASE/ozyfw-sdr1k.hex
 sleep 5

 loadFPGA $USB_VID $USB_PID $RELEASE/Ozy_Janus.rbf
 sleep 5

 #        1E 00 - Reset chip
 #        12 01 - set digital interface active
 #        08 15 - D/A on, mic input, mic 20dB boost
 #        08 14 - ditto but no mic boost
 #        0C 00 - All chip power on
 #        0E 02 - Slave, 16 bit, I2S
 #        10 00 - 48k, Normal mode
 #        0A 00 - turn D/A mute off
 write_i2c $USB_VID $USB_PID 0x1a 0x1e 0x00 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x12 0x01 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x08 0x15 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x0c 0x00 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x0e 0x02 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x10 0x00 0x00 2
 write_i2c $USB_VID $USB_PID 0x1a 0x0a 0x00 0x00 2

 exit 0

Adjust the paths as required.

To do list

This list needs to be fleshed out and triaged.

  • figure out the hotplug/udev magic to make Ozy firmware load automagically
  • packaging -- i can create and test a .deb for Debian and Ubuntu. i can also rough out the rpm for RHEL4/RHEL5/Fedora, but someone else will have to test and tweak it.
  • build the Ozy firmware using only FOSS
  • experiment to see if we can get a CIL version of libusb running with Mono [[3]] so that we can leverage N8VB's C# sources.
  • alternatively, continue on with KD5TFD's approach to the problem, which is to rewrite the code in C/C++ with native code lib
  • see if we can built the FX2 firmware using FOSS (probably sdcc [[4]]).