TOP Coil Protocols ======================== Started 16 Feb 2007 Alan Stummer Last revised 14 September 2007 OVERVIEW ========== Offline, the USB loads a series of amplitude records. Each record defines an amplitude curve. It can be straight, ramp up or ramp down. Several hundred records can be loaded, exact number TBD. In realtime, the first Trigger input enables the coils and implements the amplitude as defined in record #0. After record #0 is finished, record #1 is loaded. If record #1 says to wait for a Trigger input before starting then wait for a Trigger input. Upon the next Trigger input (or start right away if no Trigger is asked for), execute record #1. Records are executed until all record are executed, or the USB clears all records, or the Disable input is true. Once all records are executed, the last amplitudes are maintained until either the external Disable input or the USB resets them. If after the last record is executed and there is another Trigger input, the records roll over and the first record is executed. This would happen if an experiment is finished and the next experiment started again without any USB intervention. AMPLITUDE GAIN EQUATION ======================= V = K * 10^(n/4095) where I is peak current in Amps, n = amplitude number from 0 to 4095, K is an emperical constant. USB WORD PROTOCOL ================= This transport layer encapsulates the bytes for the record, or to control the record execution and also to set the digital outputs (BNCs on the back). [7:0] Data [9:8] Command function as follows (binary values): 00: Reset: clear all amplitude records, turn off coils. 01: Load part of a amplitude record. 10: Return to start of records but leave them intact. 11: Unused, does nothing. [10] Load data and function (active low, loads on rising edge). [15:11] Don't care, ignored. Notes: Amplitude records are built up byte by byte, where one record is 6 bytes. Records accumulate as long as they are loaded up to a maximum of 2,028 records. AMPLITUDE RECORD PROTOCOL (shown as one contigious record) ========================================================== An amplitude record has seven fields in a total of 48 bits from 6 bytes. [11:0] 12-bit Starting gain value. [23:12] 12-bit Number of gain steps {'StepCtr' in Verilog}. [25:24] 2-bit Gain step direction (00 = inc amplitude, 01 = no change, 10 = dec amplitude, 11 = n/a ignored). [35:26] 10-bit Number of 20uS clock cycles per gain step, max 20.48mS {'ClkCtr in Verilog}. [37:36] 2-bit Axis this applies to (00 = disable both, 01 = X, 10 = Y, 11 = both). [38] 1-bit Wait for external Trigger before executing this record (0 = don't wait, 1 = wait). [39] 1-bit Unused. [47:40] 8-bit Phase (00 = 0°, FF = +180°). Notes: First amplitude record must wait for trigger. AMPLITUDE RECORD PROTOCOL (shown as loaded byte by byte) ======================================================== Byte #1) xxxxxxxx -- 8-LSB of starting gain value Byte #2) xxxx xxxx ---- ---- | | | ----- 4-MSB of starting gain value ---------- 4-LSB of number of steps Byte #3) xxxxxxxx -- 8-MSB of number of steps Byte #4) xxxxxx xx ------ -- | | | ---- Step direction -------- 6-LSB of clock cycles per step Byte #5) x x xx xxxx - - -- ---- | | | | | | | --- 4-MSB of clock cycles per step | | ------- Axis record applies to | --------- Wait for trigger before starting |---------- (not used) Byte #6) xxxxxxxx -- 8-bits of phase