INTRO ----- Because the NI 4462 has a 63-sample delay, we need a delay-line in between PulseBlaster (bit 15) and the NI 4462 (PFI0). This is implemented using a FIFO (AL422, 3 Mbit), clocked at 40 MHz and giving a time between 3200 - 9830400 ns with a jitter of < 12.5 ns. The FIFO is controlled and bypassed/inserted/prefilled by using an Arduino. This Arduino is programmed with firmware which speaks a simple command-protocol, and is interfaced to by a program on the host computer. [Update: the 40 MHz clock is now actually a 25 MHz clock, supplied by the NI4462, for perfect sync.] Note: it's possible to speak directly to the Arduino via Gtkterm (see below): this allows for a few more debugging commands. The protocol is documented at the start of the arduino sketch. NB see 2x README.WARNING.txt, about the FTDI232RL test pin (and fix) and the ftdi_eeprom (and fix). CONTENTS -------- arduino_eeprom_config/ - instructions on using ftdi_eeprom to set the USB properties of the Arduino nano in order to have a unique (and repeatable) entry in Udev. Includes udev rules. arduino_sketch/ - the program that actually runs on the Arduino. Use the Arduino IDE to build and upload this. src/ arduino_delay - runs on the host, talks to the Arduino. arduino_check - check the arduino is present on this system man/ - man pages LICENSE.txt - Free Software, GPL3+ README.txt - this file Makefile - controls build www/ - release version for upload to website (autogenerated by Makefile) Invoke programs with -h for more info. HARDWARE -------- See arduino_eeprom_config/ for instructions, regarding the EEPROM and Udev. See README.WARNING.txt for a problem (and solution) with the Arduino Nano v.3 COMPILE ------- Simply make, make install. ARDUINO IDE ----------- The Arduino IDE can be downloaded from arduino.cc ; use at least version 1.0. It in turn uses some other utilities: apt-get install avrdude binutils gcc-avr avr-libc openjdk-6-jre gdb-avr (though version 1.01 packages the compiler and libs within the download.) It's necessary to add self to the dialout and uucp groups. (eg: sudo gpasswd -a $USER dialout; newgrp dialout). Arduino is documented at arduino.cc (files end with .ino and the IDE requires them to be in a subdirectory of the same name). NB: Serial connection (by default, and in the IDE) resets the board. http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection => Disable DTR. On Linux, disable hangup-on-close for serial ports: "stty -F /dev/ttyUSB0 -hupcl" (or similarly in C) NB: When using the Arduino IDE, the serial-port works fine (but does auto-reset). When using GTKterm, there is no implicit auto-reset (if we already used stty), BUT it works in character-mode rather than line-mode, so BACKSPACES cause invisible trouble. Type carefully! The Arduino self-identifies as an FTDI 232R. See arduino_eeprom_config/ for how to change this, and add the Udev rule required. (Also, see http://arduino.cc/playground/Linux/Udev) To talk directly to the Arduino, just open GtkTerm, use 115200 baud, no flowcontrol, no DTR. Start with "HELP". It's possible to use Arduino "directly" in C, without the IDE. See: http://balau82.wordpress.com/2011/03/29/programming-arduino-uno-in-pure-c/ There is also a command-line set of utilities that does everything: ino. See: http://inotool.org/quickstart Note that we need to: make /usr/local/share/arduino a symlink to the actual arduino ide. Also picocom doesn't work well with simple "\n" delimiters. NB digitalWrite() is much slower than would be expected, and we need to use direct port access when clocking the fifo. NB the String object in arduino seems to be buggy, with some sort of buffer overflow/crash. It's also very heavy in memory use. Avoid it.