Using PWM output from ATMega to provide external clock to external 3.3V device

I am creating an ultrasound time of flight system and am currently in the testing phase. I am using a TDC1000-TDC7200EVM board from TI for testing.

Currently, I have a 40 kHz ultrasonic transducer. My test board comes with a 8 MHz clock preinstalled. Given the divider values available (powers of 2), the closest output frequency I can get for the transducer is 31.25 kHz.

My idea is to use the PWM output from ATmega chip on an Arduino to generate an external clock source for the TDC board. I can generate 2.67 MHz PWM, then the TI board can divide that by 64 to get 41.7 kHz output.

My question is: How can I connect the PWM to the TI boards external clock pin?

Since the ATMega operates at 5V and the TI chips are 3.3V, I tried using a voltage divider to get a 3.3V PWM signal. However, this behaves in an unexpected way. I am using 330kΩ and 680kΩ in series. After the 330 kΩ resistor, by signal drops to ~30 mV peak-peak.

If I use smaller resistors, 3.3 kΩ and 6.8 kΩ, I get ~640 mV peak-peak, but the signal looks like a triangle wave instead of square wave.

• Why not use CTC instead of PWM? And why not run the ATmega at 3.3V? Dec 21, 2016 at 20:31
• Im a litttle new to this. Perhaps I am using CTC, Ill have to check when I get back to the lab. For now, I have an arduino with 5v regulator. I could change to 3.3V. In either case, how should I connect the output of the pin to the external clock of the tdc board. Just insert directly. Also, it would still be nice to know whats going with my voltage divider. Dec 21, 2016 at 20:40

If you follow your TDC1000-TDC7200EVM link, it takes you to the User's Guide. p35 shows the schematic for the EXT_OSC input. You'll see that it has a 51.1ohm load resistor across EXT_OSC input and its ground.

So your 5V-to-3V3 circuit has to be able to drive a 51.1ohm load. This rules out a potential divider. The ATmega chip can't source that much current from an I/O pin into such a divider.

Look at using an active circuit to do the job, such as a BC107 transistor or your nearest-to-hand equivalent NPN transistor. If you connect the collector to 3V3, the base to your ATmega output via a 1K series resistor and the emitter to EXT_OSC, that would do the trick. (Apologies for no circuit shown.)

• Well done. A simpler solution, however, would be to remove the jumper on JP6 and feed the clock directly to pins 5, 3 or 1 of JP6. Because driving this 50 ohm load really needs a strong driver.
– dim
Dec 21, 2016 at 21:30
• @dim, that's a good idea. I'd actually favour keeping the 51R1 load as it ensures a good quality clock with minimal reflections. Depends a bit on what the OP feels like adding to their lash-up :-) Merry Christmas, by the way. Dec 21, 2016 at 21:39
• Thanks for the ideas. I noticed that my voltage divider works like I described above even when I am not connected to the TDC1000-TDC7200EVM board. Any ideas why that is? In the meantime I will see what parts I have to try this. Dec 21, 2016 at 21:42
• @AlexK, if you are getting a distorted waveform with the 3K3/6K8 divider, you must have a weak drive from the ATmega or something else on that divider output. Can you put a 'scope probe on the AT mega pin and another on the divider output? Daft question but are you sure your 'scope probe isn't set to 50R? Dec 21, 2016 at 21:46
• @TonyM I tried using your idea with the transistor, still no success. I used 2N3904, only one I have, and a DC supply set to 3V3. [Here] (dropbox.com/s/nzviht6dtts1qlu/20161221_145449.jpg?dl=0) is what I see across the 1 kΩ resistor at the base, still a lot of distortion. The emitter output looks fine, but is only at 400 mV p-p Dec 21, 2016 at 23:01