Version 1.0
Page 41 of 44
SMT370v2 User Manual
Example code for 3L Diamond – Configuring registers/Data
capture/Pattern Generator.
This code can be used with system where the DAC outputs are connected directly to
the ADC inputs. The DAC is set to work continuously in Pattern Generator mode.
Once sine wave are generated, the ADCs sample them.
//*************************************************
// SMT 370 - Configuring DAC and clock synthesizers
//*************************************************
// This example code is to compiule with 3L Diamond V2.1.6
// Hardware configuration : S SMT370
///////////////
// 3L Header //
///////////////
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <SMT_SDB.h>
#define SMT361
#include "SMT3xx.h"
///////////////////////
// SMT 370 REGISTERS //
///////////////////////
#define REGISTER_0 0x00000400 // Reg 0 : Real data
#define REGISTER_1 0x100000ff
// Reg 1 : IDAC Fine Gain = 0xFF
#define REGISTER_2 0x200f0000 // Reg 2 : IDAC Coarse gain = 0xF
#define REGISTER_3 0x30ff0f00
// Reg 3 : QDAC Fine Gain = 0xFF
// Reg 3 : QDAC Coarse Gain = 0xF
#define REGISTER_4 0x40000000
#define REGISTER_5 0x509907E0 // reg5 : On board clocks selected for ADCs and DAC
// Reg5 : ADCs on-board clk=100 MHz (0x990 -> M=0x190=400 and N=0x4~4 => 400/4=100 MHz)
// Reg5 : DACs on-board clk=160 MHz (0xD90 -> M=0x190=400 and N=0x3~3 => 480/3=160 MHz)
#define REGISTER_6 0x60000033 // Reg6 : ADC ChannelA : Binary encoding
// Reg6 : ADC ChannelB : Binary Encoding
#define REGISTER_7_LOAD 0x73100000
// Reg7 : DAC ChannelA and ChannelB enabled
// Reg7 : Load Pattern Size register
#define REGISTER_7 0x73200000 // Reg7 : DAC ChannelA and ChannelB enabled
// Reg7 : Start Pattern generator
#define REGISTER_E 0xe0000000 // Reg E : Read back DAC SPI registers