0
\$\begingroup\$

On some 32bit MCUs(PIC32MX, STM32F4), those SPI pins can read a continuous signal such as I2S/PCM.

So I thought to read a single-wire signal that has MHz fixed frequency as SPI.

First, I made a prototype with D flip flop circuit with a crystal oscillator with the same frequency as single-wire signal.

Sync curcuit with D flip flop

As shown in this logic analyzer image, a result signal was synchronized. But I can't get an accurate data because a signal deviation affected the interval.

Result signal

Increasing the oscillator clock reduces the uncertainty but MCUs can't receive so high frequency.

Increasing clocks

I also tried to divide the clock, but sometimes the edges changed, so I could not get the ideal result.

Clock divided curcuitResult signal

As this is a hobby at the moment, but I'll use other than if these are cheap as logic ICs. Is that possible?

\$\endgroup\$
  • \$\begingroup\$ You need a phase detector, to control a variable-N divider. A digital phase-locked-loop. \$\endgroup\$ – analogsystemsrf Apr 13 at 13:17
  • \$\begingroup\$ You might want to tell what the data signal is you are receiving. Many microcontrollers have timers with input capture units that can be used to receive weird data formats. \$\endgroup\$ – Justme Apr 13 at 16:56
  • \$\begingroup\$ I still need to study about an input capture function. At least my STM32F4 doesn't work for MHz frequency, I'll try and see this module is practical for my project. \$\endgroup\$ – Tank2006 Apr 15 at 11:00
0
\$\begingroup\$

What you need to know is that your sample clock must be greater then twice the input frequency to get you something you can resolve.

You will still get up to one sample clocks worth or jitter in the edge timing, but you can work with that.

Note also that metastability might be an issue, but your rates are so low that you should see it seldom.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.