Hey, everyone.
I am a second year undergraduate research intern. I am trying to program the mbed to generate the signal data needed to start a frequency sweep on a waveform generator chip, but I am unsure of how to connect pins on the mbed with pins on the chip. I am implementing the code from the application notes http://www.analog.com/static/imported-files/application_notes/AN-1044.pdf of a very similar chip to the chip I am using (AD5930). The data sheet is found http://uk.farnell.com/analog-devices/ad5930yruz/waveform-generator-smd-tssop20/dp/1274252?Ntt=ad5930
So far, I have written the following code:
- include "mbed.h"
SPI spi(p5, p6, p7); mosi, miso, sclk
DigitalOut cs(p8);
int main() {
Setup the spi for 16 bit data, high steady state clock,
second edge capture, with a 1MHz clock rate
spi.format(16,3);
spi.frequency(1000000);
while(1){
Select the device by seting chip select low
cs = 0;
Send 0x0FFF, the command to read the WHOAMI register
spi.write(0x0FFF);
FStart LSB
spi.write(0xCEB8);
FStart MSB
spi.write(0xD051);
Frequency increment for LSB
spi.write(0x2312);
Frequency increment for MSB
spi.write(0x3008);
To obtain a stop frequency of 10MHz from an Fstart of 1MHz, the increment register is loaded by 105A
spi.write(0x105A);
Deselect the device
cs = 1;
}
}
If anyone wouldn't mind looking over the data sheets and helping me out I'd appreciate it. I'm not sure if I am supposed to connect the MOSI pin to the CTRL pin of the chip or what to do with the chip select pin and the MISO or SCLK pins. I know the program is fine though b/c when I look at the signal on an oscilloscope on the MOSI output it appears correct.
Thanks!
Sarah
Hey, everyone.
I am a second year undergraduate research intern. I am trying to program the mbed to generate the signal data needed to start a frequency sweep on a waveform generator chip, but I am unsure of how to connect pins on the mbed with pins on the chip. I am implementing the code from the application notes http://www.analog.com/static/imported-files/application_notes/AN-1044.pdf of a very similar chip to the chip I am using (AD5930). The data sheet is found http://uk.farnell.com/analog-devices/ad5930yruz/waveform-generator-smd-tssop20/dp/1274252?Ntt=ad5930
So far, I have written the following code:
SPI spi(p5, p6, p7); mosi, miso, sclk
DigitalOut cs(p8);
int main() {
Setup the spi for 16 bit data, high steady state clock,
second edge capture, with a 1MHz clock rate
spi.format(16,3);
spi.frequency(1000000);
while(1){
Select the device by seting chip select low
cs = 0;
Send 0x0FFF, the command to read the WHOAMI register
spi.write(0x0FFF);
FStart LSB
spi.write(0xCEB8);
FStart MSB
spi.write(0xD051);
Frequency increment for LSB
spi.write(0x2312);
Frequency increment for MSB
spi.write(0x3008);
To obtain a stop frequency of 10MHz from an Fstart of 1MHz, the increment register is loaded by 105A
spi.write(0x105A);
Deselect the device
cs = 1;
} }
If anyone wouldn't mind looking over the data sheets and helping me out I'd appreciate it. I'm not sure if I am supposed to connect the MOSI pin to the CTRL pin of the chip or what to do with the chip select pin and the MISO or SCLK pins. I know the program is fine though b/c when I look at the signal on an oscilloscope on the MOSI output it appears correct.
Thanks! Sarah