DiscFerret:Downloads
Access libraries
libdiscferret (C library)
Libdiscferret allows applications written in C or C++ to access the DiscFerret, without having to worry about USB transaction management, packetisation and other low-level issues. It is known to run on any UNIX platform which provides the libusb-1.0 API. At the time of writing, this includes:
- Linux
- FreeBSD 8 (or later)
- Mac OS X (Darwin)
To build it:
tar -zxf libdiscferret-1.3.tar.gz make
To install it:
make install
By default, the libraries and headers are installed in /usr/local/lib and /usr/local/include respectively. To change this, append "PREFIX=path" to both the "make" and "make install" commands. For example, to install in /opt/discferret, use these commands:
make PREFIX=/opt/discferret make install PREFIX=/opt/discferret
The latest version is Release 1.3, which can be downloaded from here: libdiscferret-1.3.tar.gz.
Change history
Release 1.3
update microcode to REL_0026 fix bad syntax in register header (ahem) update registers for microcode 0025 and later fix building of test application update udev rules for newer versions of udev Add udev rules file for DiscFerret devices hide output from rm during solib link fix makefile so libdiscferret also builds on Linux add idplatform.sh (req'd for new build system) Changes to allow libdiscferret to build on Mac OS X More fixes to use stdlib.h instead of malloc.h use stdlib.h instead of malloc.h (ooops!) fix uninitialized value warning tag release builds in the copyright notice, not just debug builds separate building of docs from main library Add missing microcode image (RBF file) and a README BUGFIX: fix issues with accidental double-stepping increase USB timeout to 1 second (from 100ms) fix issue with discferret_microcode.o not being linked into solib fixes for const-correctness, bump version to 1.2r2 Include local copy of the DiscFerret microcode use DISCFERRET_ERROR enum where appropriate
Release 1.1r1
- Add support for the "Track 0 Reached During Seek" status bit
- Add discferret_seek_* functions to simplify head seek operations
Microcode
Microcode bundles (RBF files) are included with release versions of the C and Python APIs. Generally speaking, you should only use the microcode version which was included with a given version of the API. To upgrade to a later microcode version, upgrade the API.
For reference, the latest 'release' Microcode is version 0021, which is available to download here: microcode_0021.rbf.
Microcode change log
Rev 0021 (2011-MAR-21)
- Add "track 0 reached during seek" status bit.
- Improve seek logic to prevent "over-stepping" (seeking to a track below Track 0).
Firmware
The latest firmware package is version 001C, which can be downloaded from here.
Change history
Version 001C (2011-FEB-13)
- Fix a serious bug relating to USB hot-plugging. If the DiscFerret was powered up before the USB cable was connected, then the USB stack may not start up correctly. Additionally, if the USB cable is unplugged while the DiscFerret is powered up, the USB PHY may lose sync with the host.
Identifying the firmware version your DiscFerret is running
To identify the current firmware version of your DiscFerret (and its MCU Serial Number), use the id_program.py tool from the Firmware Source Code archive:
./id_program.py --info
This will display a screen similar to the following:
Device opened successfully Device information: product: DiscFerret magnetic disc analyser microcode_ver: 0x0020 serialnumber: TARKA firmware_ver: 0x001B microcode_type: 0xDD55 hardware_rev: 0I06 manufacturer: Red Fox Engineering
The Microcode Type and Microcode Version will only be valid if a microcode bundle has been uploaded to the DiscFerret (i.e. if an application which uses the DiscFerret has already been run). If the Microcode Type is anything other than `0xDD55`, then the microcode version will not be valid. Device information can only be queried when the DiscFerret is running the operating firmware; the bootloader has no support for firmware version querying.
Upgrading the firmware
To upgrade the firmware on a DiscFerret, you will need a copy of the "mphidflash" program from http://code.google.com/p/mphidflash/.
The upgrade procedure is as follows:
- Disconnect the USB and power cables from the DiscFerret.
- Install a jumper cap over the two-pin header marked "BOOT".
- Reconnect the USB cable, then the power cable.
- The amber "MCU Status" LED should now be blinking rapidly.
- Copy the firmware HEX file and mphidflash into the same directory.
- From a command prompt, change into the directory containing mphidflash (e.g. `cd mphidflash`).
- On Linux, run the following command:
./mphidflash -r -n -v 04d8 -p fbba -w discferret_firmware_XXXX.hex
(replace XXXX with the firmware version number). - On Windows, run the following command:
mphidflash -r -n -v 04d8 -p fbba -w discferret_firmware_XXXX.hex
(replace XXXX with the firmware version number). - Unplug the DiscFerret, remove the BOOT jumper, then reconnect the USB and power cables (in that order). Your DiscFerret should now be running the latest firmware.
Bootloader
If the DiscFerret will not enter the bootloader even with the BOOT jumper installed, the bootloader may have become corrupted. In normal use, this should not be possible. It is, however, still possible to recover the DiscFerret, as long as you have a suitable PIC programmer. To do this, five wires must be soldered to the programming pads on the bottom of the DiscFerret PCB, and a PIC programmer (e.g. a Microchip PICKit 2) is connected to these wires. See the DiscFerret circuit diagram for the pin configuration of these pads.
NOTE: The DiscFerret uses a PIC18F85J50 microcontroller, which uses 3.3V Low Voltage Programming. Make ABSOLUTELY SURE your PIC programmer supports this programming mode (the PICKit 2 and PICKit 3 do), and that the device is set to "PIC18F85J50" (NOT auto-detect). Failure to follow these instructions WILL destroy the microcontroller IC!
After reprogramming the bootloader, the Unit Serial Number must be reprogrammed using id_program.py, which is included in the Firmware Source-Code Bundle, under the "test" directory. You will need to install the Python LibUSB wrapper library (on an Ubuntu Linux system, this is in the package `python-usb`) in order to use this tool.
DISCLAIMER: Damage caused by incorrectly reflashing the bootloader is NOT covered by the warranty! If you are not confident in your abilities, contact Red Fox Engineering to arrange for your DiscFerret to be re-programmed (a small charge may be made in order to cover postage and packing costs).
Bootloader HEX file: Bootloader Release 1.0 Final.