Quantcast
Channel: Wardy's Projects
Viewing all articles
Browse latest Browse all 70

DS1077 + Arduino

$
0
0
I've finally had a chance to get around to playing with the DS1077 configurable oscillator!

The circuit to get it working is very simple, just hook up the Ardiono as the I2C master, I used a 10K pullup resistor on both the SCL and SDA lines.  I tied CTR0 and CTR1 on the DS1077 to GND to enable the chip all the time.  For the following video, I put the scope probe onto the OUT1 pin...



You'll see some substantial "ringing" on that scope trace in the video.  Ignore that :) it's because I'm sending fast rising and falling edges through a cheap breadboard, cheap hook-up wires, and a very cheap croc-clip oscilloscope probe.  This chip produces rather good quality square waves signals when under ideal circumstances.  This video simple demonstrates the nice smooth way that the frequency can be varied by sending I2C commands to the chip.


Here's a quick schematic for that hastily breadboarded demo circuit...

I like the pinout of this chip, as it clearly demonstrates deference to signal integrity design considerations for the PCB designer.  Notice how the VCC and GND pins are side by side.  That makes it very convenient to place a decoupling cap right on those lines as close to the chip as possible.


And of course here's the obligatory Arduino source code to drive the chip.  This is the code used for the video.  All it does is run through the entire frequency range supported by this chip.  Hopefully this will be of some help to fellow blogger Eldon (http://wa0uwh.blogspot.com/)who showed some interest in this chip from my previous post on the topic.


#include 

const int ds_address = 0xB0 >> 1; //DS1077 default address

#define MUX_HI_PDN1_BIT (B01000000)
#define MUX_HI_PDN0_BIT (B00100000)
#define MUX_HI_SEL0_BIT (B00010000)
#define MUX_HI_EN0_BIT (B00001000)
#define MUX_HI_0M1_BIT (B00000100)
#define MUX_HI_0M0_BIT (B00000010)
#define MUX_HI_1M1_BIT (B00000001)

#define MUX_LO_1M0_BIT (B10000000)
#define MUX_LO_DIV1_BIT (B01000000)

#define BIT_ON (0xff)
#define BIT_OFF (0x00)


void setup()
{
Wire.begin();
}

void loop()
{
long i;
for(i = 0 ; i <= 1025 ; i+=1)
{
i2c_write(ds_address, 0x02,
( 0
| (MUX_HI_PDN1_BIT & BIT_OFF)
| (MUX_HI_PDN0_BIT & BIT_OFF)
| (MUX_HI_SEL0_BIT & BIT_ON)
| (MUX_HI_EN0_BIT & BIT_ON)
| (MUX_HI_0M1_BIT & BIT_ON)
| (MUX_HI_0M0_BIT & BIT_ON)
| (MUX_HI_1M1_BIT & BIT_ON)
)
,
( 0
| (MUX_LO_1M0_BIT & BIT_ON)
| (MUX_LO_DIV1_BIT & BIT_OFF)
)
); //mux
delayMicroseconds(100);

i2c_write(ds_address, 0x01, (i >> 2), (i << 6) & 0xC0); //div
delayMicroseconds(100);
i2c_write(ds_address, 0x3F);

delayMicroseconds(10000 - i);
}
}

void i2c_write(int device, byte address) {
Wire.beginTransmission(device); //start transmission to device
Wire.write(address); // send register address
Wire.endTransmission(); //end transmission
}

void i2c_write(int device, byte address, byte val1) {
Wire.beginTransmission(device); //start transmission to device
Wire.write(address); // send register address
Wire.write(val1); // send value to write
Wire.endTransmission(); //end transmission
}

void i2c_write(int device, byte address, byte val1, byte val2) {
Wire.beginTransmission(device); //start transmission to device
Wire.write(address); // send register address
Wire.write(val1); // send value to write
Wire.write(val2); // send value to write
Wire.endTransmission(); //end transmission
}


This chip lets you output a 50% duty cycle square wave at any frequency given by 133,000,000 divided by any number between 1 and 1025 inclusive.  This divider is selected by sending a short I2C sequence to the chip from whatever microcontroller you prefer.  I'm using an Arduino here because there was some code easily available for it.  For my final purposes I'll be using a P8X32A Propeller to drive this chip.

This is a fun chip to mess with and has some substantial benefits for the advanced Parallax Propeller user, since this will let you experiment with letting the Propeller chip overclock itself on the fly!  Granular clock management and tuning is something I'm interested in experimenting in with the Prop and this chip will be a great way to do it!

I think this chip will also be of use to Ham radio enthusiasts because of it's frequency modulation abilities.  Although I suspect that it's stepped frequency brackets are a bit of a limitation for some of the really advanced shenanigans of the Ham community, this would be useful for some kind of carrier modulation or FDM projects.

Anyway, sorry for the long-winded post - hope you find this useful or at least interesting.

Wardy.

Viewing all articles
Browse latest Browse all 70

Trending Articles