Shop OBEX P1 Docs P2 Docs Learn Events
Clocks — Parallax Forums

Clocks

RogerInHawaiiRogerInHawaii Posts: 87
edited 2010-03-17 17:25 in Propeller 1
I'm having some really odd behavior with a circuit and am hoping someone might have some insight.

I have a Propeller driving an Acam TDC-GP2. That's a high-resolution timing chip. I can successfully communicate with the TDC-GP2, sending it op-codes and retrieving register data from it. The next step is to get the TDC-GP2 to do a self-calibration. Sometimes it works, sometimes it doesn't, and I'm having a heck of a time figuring out why.

The difference between doing the simple send-op-code-retrieve-register-data communication and the self-calibration is that the self-calibration makes use of the two clock circuits attached to the TDC-GP2, so I suspect that there's something wrong with one of those clocks. There is a 32kHz oscillator circuit and a 4MHz oscillator circuit connected to the TDC-GP2. When I first tried doing the self-calibration is worked fairly consistently. But over time it worked fewer and fewer times, and now it hardly ever works.

I suspected that perhaps there wasn't good connection between the clock circuit (in particularly the 4MHz circuit) and the TDC-GP2. After all, the TDC-GP2 is an incredibly small (about 1/4" square), surface mount component with 32 connections. I use a Schmartboard for the mounting of the TDC-GP2, and even with a microscope it's difficult to see if the solder connections are actually good.

I decided to check the connections between the 4MHz clock connections (pins 1 and 2 on the TDC-GP2) and ground using a simple voltmeter to check the voltage. It turns out that the voltage measurements are about 1.5 volts. Now comes the really odd behavior. When I have the voltmeter probes touching a clock pin and ground, the self-calibration operation actually produces values! Normally, when it's not working, the calibration value that it produces is 0 or -1, indicating some sort of error (although not telling me WHAT kind of error, darn it). But when the voltmeter probes are connected the TDC-GP2 actually produces reasonable (or at least-non-error) values!

How in the world can the connection of voltmeter probes have an effect on the behavior of the TDC-GP2?


One thing I noticed is a bit of a discrepancy in clock circuits. The documentation for the TDC-GP2 shows a 4MHz ceramic resonator, a couple of capacitors, a 560 K Ohm resistor in parallel with the resonator and a 220 Ohm resistor in serial with it. That's what I implemented in my design, using the 4MHz ceramic resonator available from Parallax. But then, looking around the Parallax site, I find that that 4MHz ceramic resonator is used in the basic design of the Stamp 1. But all it uses is just the resonator. It does not employ any capacitors or resistors. Should I try using just the resonator and get rid of the other components?


I realize that this isn't really a question about the Propeller, but you guys have been so helpful with my other questions I'm hoping you can provide some insights into why I'm having trouble with this other circuit.

Thanks,

Roger

Comments

  • LeonLeon Posts: 7,620
    edited 2009-06-01 20:31
    They are probably altering the capacitances associated with the oscillator circuit, causing it to work properly. Please post your schematic.

    Voltmeters aren't much use for checking oscillators, a scope and high impedance probe will help a lot more.

    If you have used a two-terminal resonator, you need to include two feedback capacitors. Three terminal resonators include the capacitors.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 6/1/2009 8:36:26 PM GMT
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-01 20:44
    This is the circuit I used for the 4MHz clock.
    The actual 4MHz component is the one availbale from Parallax: http://www.parallax.com/Store/Components/ResonatorsCrystals/tabid/153/CategoryID/53/List/0/SortField/0/Level/a/ProductID/359/Default.aspx


    TDC-GP2.jpg
  • LeonLeon Posts: 7,620
    edited 2009-06-01 20:56
    That resonator should be OK. The two outer pins go to Xin and Xout on the chip, the central pin should be grounded. It should be close to the chip. Do you have access to a scope?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-01 21:09
    Leon said...
    That resonator should be OK. The two outer pins go to Xin and Xout on the chip, the central pin should be grounded. It should be close to the chip. Do you have access to a scope?

    Leon

    But does it need those resistors as well? Or should I just connect the resonator directly to the Xin and Xout pins (and ground)?

    No, no scope. Only the most rudimentary electronics equipment, i.e. a multimeter. I know, I know, I'm building a complex high-speed project and trying to do it with paper clips and rubber bands (not even duct tape).
  • LeonLeon Posts: 7,620
    edited 2009-06-01 22:00
    The resistors are more appropriate for a crystal.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-01 23:58
    Leon said...
    The resistors are more appropriate for a crystal.

    Leon

    I removed the resistors since, as indicated, they are more appropriate for a crystal, and the resonator that I'm using is a ceramic resonator, and I removed the capacitors since the ceramic resonator has those built in to it. That leaves just the ceramic resonator connected to Xin ad Xout and its central pin connected to ground.

    And it doesn't work. Whereas before if I put my voltmeter probes across Xin and ground or Xout and ground it would cause it the TDC-GP2 to occassionally generate reasonable calibration numbers (possibly due to inadvertantly modifying the capacitance), now it consistently generates the error value (all 1s) for the self-calibration number.

    So, this seems to be a step backwards.
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-01 23:59
    Does it matter which of the two outer pins on the ceramic resonator is attached to Xin and which is attached to Xout?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-02 01:45
    No, the resonator is completely symmetrical. I'm not sure about removing the resistors and caps, though. Even some BASIC Stamps that use resonators include the parallel resistor and an additional cap. It's not just a crystal thing and depends on the drive level provided by the oscillator.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 6/2/2009 1:52:21 AM GMT
  • hoguzhoguz Posts: 1
    edited 2009-06-08 15:42
    Hi,

    do you have circuit diagram TDC-GP2 for liquid level?

    Best Regards.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2009-06-08 16:07
    Don't remove the resistors. The 560k is probably necessary to bias the oscillator, and it might help to try a lower value, like 100k. The 220 Ohm could probably be reduced to zero ohms, but not literally removed. The Parallax resonator does have built-in caps, but it sometimes helps to add on the order of 10pF on Xout. With a 'scope and 10x probe, the usual criterion is to see a solid sine wave on Xout, that comes near the rails but does not saturate. Is the resonator located close to the chip?

    One approach would be to pull out the xtal and feed 4mHz directly to Xin (4 mHxz perhaps from a Prop counter output). See if the circuit operates. Monitor the output on Xout. That would verify the solder connections.

    Link for the TDC-GP2 data sheet?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-08 19:01
    I've attached·the data sheets for the TDC and also for their evaluation system.

    It's interesting that you suggest replacing the 560K resistor with a 100K resistor. On the chip's datasheet it shows a sample circuit with a 560K resistor, but on the evaulation system specs it shows 100K.

    I've got the clock circuit as close as I can get it to the chip.

    Can I really generate a 4MHz clock directly form the Propellor? that would be great. Exactly what code would I need to do that? Can it also generate the 32kHz clock? It would be great if I could simply eliminate the clock circuits from the TDC-GP2 and replace them with simple lines from the Propellor.

    - Roger
  • TimmooreTimmoore Posts: 1,031
    edited 2009-06-08 19:18
    synth.spin - in the prop tool download
    heres an example of generating 32K I use - the A is whether to use counter A/B, so if you are using it twice, dont forget to use B in the 2nd.

    freq.Synth("A", _mclk, 32768) 'start clock 32KHz for A2D
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-08 20:44
    Tim,

    Thanks, I'll give that a try.

    - Roger
  • RogerInHawaiiRogerInHawaii Posts: 87
    edited 2009-06-16 06:48
    Timmoore said...
    synth.spin - in the prop tool download
    heres an example of generating 32K I use - the A is whether to use counter A/B, so if you are using it twice, dont forget to use B in the 2nd.

    freq.Synth("A", _mclk, 32768) 'start clock 32KHz for A2D
    ·Tim,

    Thank you so much. That works! I was able to get rid of the clock circuits and just use your suggested code and direct line from the Propellor to th TDC-GP2 chip.

    Excellent!

    - Roger
    ·
  • ProseccoProsecco Posts: 1
    edited 2010-03-17 17:25
    Dear Roger,
    I am just starting to experiment with the TDC-GP2 chip, would you be kind enough to share the code you used to communicate with the chip?
    Is it in 'C' or Assembler?

    Ciao,
    Diego from Italy
Sign In or Register to comment.