Generating a specific clock signal - Page 1
Forum section: electronics / projects

author: tszaboo
author_rank: Super Contributor
timestamp: September 01, 2023, 08:10:21 am
content: Hi. I would like to create a 1280KHz +/-0.5% clock signal for a project. It just need to be a regular 3.3V CMOS voltage level clock. So far I used a signal generator for it, but I need to make the setup more mobile and production ready. Do you have a good idea about for creating this clock signal?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 01, 2023, 08:45:20 am
content: Quote from: tszaboo on September 01, 2023, 08:10:21 amHow adjustable does it need to be. There are i2c Clock generator modules (eg Adafruit) based on Si5351A, that can set any frequency.A crystal, resonator, or a oscillator are the obvious choices, and an oscillator with divider is also an option.You can still buy 74HC6323 parts, which give many choices in SO8 /1 /2 /4 /8 allowing 2.56Mhz 5.12Mhz and 10.24Mhz as alternate choices.Or, you can use a 74HC4060 and 20.48MHz Xtal or Osc source to give /16 at 1.28MhzMouser have 5.12MHz ceramic resonators that have some pull range, needing a /4Digikey and Mouser have a lot of 20.48MHz crystals that will work with a 74HC4060

author: themadhippy
author_rank: Super Contributor
timestamp: September 01, 2023, 11:30:00 am
content: Are there still companys that "grow" custom crystals or have they all disappeared?

author: tszaboo
author_rank: Super Contributor
timestamp: September 01, 2023, 11:51:55 am
content: Quote from: PCB.Wiz on September 01, 2023, 08:45:20 amI need a 2^n * 40KHz. I'm trying to run a 40KHz ultrasonic transducer with a TDC1000-EVM. The original description was calling for a 1280KHz clock input (from the user manual), but now on the third look, it accepts anywhere between a 1-16MHz signal. I did this in the past with a signal generator, but as I said, it needs to be more mobile.I think on the final design, I should be able to generate this clock somehow with a microcontroller.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 01, 2023, 08:51:12 pm
content: Quote from: tszaboo on September 01, 2023, 11:51:55 amThe TDC1000 would need a crystal derived clock, for low jitter, but the spec says 0.06 ~16 MHz.It looks to support 2~256 divides, so can accept up to 10.24MHz, which is getting 'common enough' and easy to get from a Crystal + MCU clock out / timer.It's not clear if a higher CLK has any benefit, so you could divide more inside the MCU and less inside the TDC1000 for a lower RFI solution

author: TimFox
author_rank: Super Contributor
timestamp: September 01, 2023, 08:54:16 pm
content: There are companies that supply packaged crystal oscillators for the customer's frequency.One example (thanks to Google):https://pccomponents.com/datasheets/MF-h3291.pdf

author: tszaboo
author_rank: Super Contributor
timestamp: September 01, 2023, 09:26:31 pm
content: Quote from: PCB.Wiz on September 01, 2023, 08:51:12 pmTrue, that's what I see as well from the datasheet. Unfortunately the software doesn't support less than 1MHz otherwise I would have given it a 80KHz pwm made by a microcontroller.I think the 10.24 is probably the easiest for now. I haven't decided on the MCU yet, maybe it's going to be an ESP32 or an STM32. The first one would be more difficult to clock from that crystal.

author: ConKbot
author_rank: Super Contributor
timestamp: September 01, 2023, 11:50:07 pm
content: SItime "time machine II" and a blank programmable sample oscillator programmed to the frequency of interest.If I was at work at least, $300 for the programmer ain't very cheap for the home gamer.Iirc digikey does programming for some of them, so if there isn't an unreasonable minimum, that may be viable?Though I would be mindful of jitter on the cheapest mems oscillators. There is a reason the jitter spec is an integration of phase noise from 10 or 12 khz up, because they shoved all the phase noise somewhere.Using a lower jitter oscillator and a higher division ratio will crush that phase noise down into a narrower and narrower bandwidth. Though that's assuming that running an 8x higher frequency doesn't result in an 8x spreading of the oscillators phase noise plot.

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 02, 2023, 12:51:55 am
content: The LTC6907 is a bit expensive will do it with minimal external components.Also a cheap mcu running a 4MHz xtal with a timer output dividing the clock by 100.

author: bostonman
author_rank: Super Contributor
timestamp: September 04, 2023, 03:26:16 pm
content: I'm curious, can the LTC6907 be used to generate 50Hz?If it allows for a range of frequencies, then maybe it can be set to an odd frequency and then use dividers to get it to 50Hz, but will the jitter be too much to run 50Hz electronics?

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 04, 2023, 07:47:02 pm
content: Quote from: bostonman on September 04, 2023, 03:26:16 pmWhat exactly is50Hz electronics, and how much jitter can it tolerate ?The LTC6907 has museum level prices, if you are adding a divider to get to 50Hz, just add a divider that can run a crystal ?Eg x4060, AHC1G42xx, x4521, or even a vanilla MCU that has xtal pins.

author: tszaboo
author_rank: Super Contributor
timestamp: September 05, 2023, 09:39:44 am
content: Ok, so for now, I used a RP2040 with it's PWM generator to make a clock signal.The code is below. I plan to measure the accuracy of this signal this afternoon.It has some sort of fractional clock generator inside so in theory the signal is accurate, we will see. Unfortunately there is no specification or any publication on how it actually works or how accurate signal we can get. Code is circuitpython.Code:import boardimport pwmiopwm = pwmio.PWMOut(board.GP14, variable_frequency= True)pwm.duty_cycle = 128*256pwm.frequency =1280*1000

author: tszaboo
author_rank: Super Contributor
timestamp: September 05, 2023, 11:57:24 am
content: Frequency 1280KHz nominal, 1275.5KHz actual, that is a 0.35% deviation, which is acceptable.The next step in the PWM settings seem to be 1286.6KHz. Duty cycle is 49-50% according to the scope, and the rise time is 20ns.I don't think the transducer would mind if it's driven at 39.8KHz instead of the nominal 40KHz.After trying to get the system to work for like two hours, I found my settings file from 4 years ago for the TDC1000.

author: MathWizard
author_rank: Super Contributor
timestamp: September 08, 2023, 05:22:34 am
content: How good or bad is a typical microcontroller at outputting a user-defined clock pulse ? Why does it have to be 1280kHz ?

author: fourfathom
author_rank: Super Contributor
timestamp: September 08, 2023, 06:18:50 am
content: Quote from: PCB.Wiz on September 01, 2023, 08:45:20 amThis.You can get a Si5351 on a board with a (good enough) crystal for US$8 from Amazon, and cheaper elsewhere. If you can connect it to an I2C port it will do everything you want.

author: jbb
author_rank: Super Contributor
timestamp: September 08, 2023, 09:13:11 am
content: I’ve used TI CDCE913 before to good effect.But it’s got much the same specs as the Si5… part and probably costs more

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 08, 2023, 09:45:58 am
content: Quote from: jbb on September 08, 2023, 09:13:11 amAnother source has appeared for Si5351, and that works wonders on the price(both are now sub 65c/30+ at lcsc)Alternates are MS5351M MSOP10 and newer MS5351 eMSOP10, tho I've not seen anyone selling the EPAD version yet.

author: HalFoster
author_rank: Frequent Contributor
timestamp: September 08, 2023, 09:46:24 am
content: Mouser has many crystals and oscillators that would only need a divide by x to be exactly the value that you need.Hal

author: tszaboo
author_rank: Super Contributor
timestamp: September 08, 2023, 09:59:32 am
content: Quote from: MathWizard on September 08, 2023, 05:22:34 amIt's 40KHz x 32 for an ultrasonic project. I have my accuracy measurement for a RP2040 just above.

author: tszaboo
author_rank: Super Contributor
timestamp: September 08, 2023, 10:10:55 am
content: Quote from: fourfathom on September 08, 2023, 06:18:50 amThanks, this kind of info is exactly why I asked.Funny PCB.Wiz also posted this as first reply, but I somehow missed it. Seems to be 1.3 USD on aliexpress so I placed a few in my shopping basket.I was getting a bit of jitter on my measurements, and I suspect it to come from the RP20240 so let's try an update.