# Sync Pulse generator for Composite Video. (Stabilizing video)

I am trying to make a Composite Video Sync Pulse generator with the Help of a micro Controller STM32 ,

Short story.

I have a wireless video source that is transmitted from a VTX So there is a PAL Camera that is connected to the VTX . From the other side i have a VRX (receiver) that is connected to a monitor. When the video signal goes bad , Synch Loss , tearing, rolling etc , So i need to regenerate the Synch Pulses into the video out just as it was when the video was crystal clear and solid , in order to stabilize the image...

What i have done so far.

• -I can generate PAL or NTSC signal pulses from my Micro Controller.

• -I can get the Horizontal and VErtical synch pulses with the LM1881 from my video source.

i tried programmatically to monitor the timing for the Hsynch and Vsynch from the LM1881 while the video was Crystal clear, and right after that i tried to push back the "cloned" sync pulses with my micro controller , but it doesn't seem to synchronize, because i cant see any deference in the image.

SO before i start digging more into the code ,

First of all , id like to know from you guys if what i am trying to do is possible,

is there an IC that does this dirty job? (take a Composite video in and spit out a synced ,stable signal out?)

Sure, it's possible.

I'm not aware of any existing single-chip solutions (that would be a shopping question anyway, off-topic here).

The general idea is that you need to phase- and frequency-lock a master oscillator to the incoming signal, from which you generate your replacement sync pulses. The key problem is doing a better job of extracting the sync from the incoming signal than the existing monitor does.

You will likely need some custom hardware in addition to your microcontroller. A small CPLD or FPGA could implement the counters and rest of the digital logic. Here's a rough block diagram:

         +----------+     +---------+     +---------+
| 13.5 MHz |     | H count |     | V count |
|   VCXO   +-----+ divide  +--+--+ divide  +--+
|          |     | by 864  |  |  | by 625  |  |
+----------+     +---------+  |  +---------+  |
^                        |               |
|  Control voltage       |               |
+-------------+          |               |
|          |               |
+------+ H +-------+-------+  |   new H       | +----+
| sync +---+ phase compare +--+-----------------+    |
+--+ sep. | V |       +       |      new V       | | OR +----+
|  |      +---+  loop filter  +------------------+-+    |    |
|  +------+   +---------------+                    +----+    |
video |                                                         +--+--+
in ---+---------------------------------------------------------+     | video
| mux +-- out
replacement sync voltage -----+     |
+-----+


This isn't a design service, and I'm glossing over a lot of low-level details, but this should give you the general idea. For example, the V counter needs to generate two pulses per cycle for interlaced video.

Firmware on your microcontroller might be involved in the "phase detector + loop filter" section. I'm not familiar with the details of the STM32 — it might have suitable counters built-in to do the H and V counting.