Monday, 20 August 2012

Using a DS1077 Programmable Oscillator with Arduino

I bought a DS1077 Programmable Oscillator a while back for a project but only recently blew the dust off it to try to get it going. It had been a little while since I had talked to components through I2C and I had some trouble talking to it right away. In case anyone else is having trouble talking to it with an Arduino I thought I'd post my code to speed them along.

Just as a first point, I've never been 100% sure if I needed to use pull-up resistors with I2C on an Arduino, as most of the time I haven't needed them. This time though they seemed to make a difference. I used 4.7kohm resistors to pull up SDA and SCL.

Here's the code:

A bunch of credit goes to the post on Hack A Day as well as the post on Semyon Tushev's blog (links below). I should note that I didn't really spend much time with the registers as I only wanted to get 16.2kHz out of it (for now) so I won't be very knowledgeable about that stuff.

References

Parts: 133MHz-16.2kHz programmable oscillator (DS1077)
http://www.hackaday.com/2008/11/28/parts-133mhz-162khz-programmable-oscillator-ds1077/

Measuring frequency with Arduino
http://tushev.org/articles/electronics/43-measuring-frequency-with-arduino

DS1077 Programmable Oscillator Breakout - 16.2kHz to 133MHz
https://www.sparkfun.com/products/9116

Arduino Forum: Need for I2C pullup resistors
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1286192280

5 comments:

  1. What range of numbers did the serial monitor output when you used the code above

    ReplyDelete
    Replies
    1. Between 15995 and 16350 ish... kind of rough. Not sure if it's the Arduino being inaccurate or the oscillator. Probably the Arduino measurements aren't that great. It was just to see if I was close really.

      Delete
  2. I keep getting 40000-41000 as my output no matter the settings. Any idea why?

    ReplyDelete
    Replies
    1. Did you uncomment the delays in the setup code? These made a big difference to me.

      Delete
  3. First off, I wanted to say thank you very much for providing this information and for keeping this up. Thanks again!

    I am trying to get this working for me for a project that I have been working on for a long time. I would truly appreciate your help with a couple quick questions:

    -Your code mentions using Pin 7. Is Pin 7 from the output of this chip or somewhere else?

    -If I open my serial monitor (after doing all of these steps and wiring), I don't see anything. Am I suppose to make another connection (such as TX on the Arduino to a FTDI cable)?

    ReplyDelete