Hi allI have problem in changing reference clock (148.5MHz <-> 148.35MHz) for SDI receiver. In the SDI user manual, there's a paragraph related to my problem. "You must supply two receive reference clocks (for example, 148.5 MHz and 148.35 MHz) to the SDI receiver. Implement the PPM detection function in the user logic to detect the ppm difference between the receive reference clock and the recovered clock. Based on the difference detected, you must switch between the two receive reference clocks by toggling the rx_serial_refclk_clkswitch signal." My question is how to generate this PPM detection function? Does Altera provide any example? Thanks.
Create two counters, counter_1 incremented by the recovered clock, and counter_2 incremented by the 148.5 clock. Once counter_2 reaches a specific value (say 100000), check counter_1. If the two counters differ by a margin of +/- 1.001, then you know that the recovered clock is 148.35. If not, it is 148.5. The higher the count value (100000), the more precise the ppm detector is, but the longer it takes to detect the ppm. You will have to create some min and max count to prevent false detection when the recovered clock the reference clock only differ by a few ppm. I believe SDI has a max tolerance of 100ppm. You will also have to deal with CDC issues since the counters are in two different domains and you have to compare them.