sabato 10 agosto 2013

DS1077 programmable oscillator


welcome back to another ultra-interesting post! :D today we gonna waste our time talking about a DS1077, a programmable oscillator just arrived from the free sample foundation :p anyway, I wont talk long about the chip, RDFM (https://www.sparkfun.com/datasheets/Components/SMD/DS1077.pdf).






this is how the chip works in its simplest configuration:

a prescaler divide the master clock (133.3Mhz) by 1,2,4,8, the resultant is divided by N, a number between 2 and 1023 set in a register and then the signal is routed to OUT1.

that's all.

how to communicate with the chip? I really don't know why but the datasheet never says the magic word "I2C". This is the answer. two register are the most important, probably you wont need anything else than an arduino with the sketch attached below:

[code]
 #include <Wire.h>

#define DIV 2
#define MH_bit 1
#define ML_bit 1
//un-comment the next line to have the chip setting almost every usable frequency
//#define TEST

void setup(){
  Wire.begin();
  i2c_write(0x02, 0b00011000|MH_bit, 0b00000000|(ML_bit<<7)); //mux
  delay(50);
  i2c_write(0x01, (DIV-2)>>2, ((DIV-2)<<6)&0xC0); //div
}

void loop(){
  #ifdef TEST
  for(uint16_t i = 0 ; i < 1024 ; i++){
      i2c_write(0x01, i>>2, (i<<6)&0xC0); //div
      delay(50);
   }
   #endif
}

void i2c_write(byte address, byte val1, byte val2) {
     Wire.beginTransmission(0x58); //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
}
[\code]

the schematic is just 3 wire (2 for the I2C communication plus one for the ground). Remember the vcc for the chip :p

is simply write to the register 2 the M configuration and to the DIV register the value of N (see the description and the picture above).

and that's all, use the following value to set the prescaler:
1 MH_bit 0 ML_bit 0
2 MH_bit 0 ML_bit 1
4 MH_bit 1 ML_bit 0
8 MH_bit 1 ML_bit 1

Nessun commento:

Posta un commento