Author Topic: Syncing a SelectIO serdes module?  (Read 1967 times)

0 Members and 1 Guest are viewing this topic.

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Syncing a SelectIO serdes module?
« on: March 16, 2018, 11:40:40 pm »
I'm working with a camera module and have run into a bit of a snafu.

I'm attempting to use the built-in SelectIO core generator to parse LVDS data from a sensor. This data begins streaming after a horizontal pulse from the sensor. The issue is that there's an almost random amount of LVDS clocks that occur after the horizontal pulse is seen by the FPGA.

What would be the best way to sync this? Would it be as simple as creating a second serdes module, not selecting the serialization option and using that to read in the start byte? This could then reset the SelectIO core that I'm using to parse in the data?
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Syncing a SelectIO serdes module?
« Reply #1 on: March 17, 2018, 10:05:04 am »
Hi, I am surprised no one else with more experience with Serdes has not answered ::)

Quote
The issue is that there's an almost random amount of LVDS clocks that occur after the horizontal pulse is seen by the FPGA
Bear in mind that serdes is not raw data being clocked. Since there is no seperate clock line, the data itself needs to generate clocking pulses, the data is re-encoded so that there are always pulses (to generate clocking pulses). I think serdes converts 8 bit data into 12 bits. This needs to be done to avoid 0x00 and 0xff which will have no pulses.

You really need to have a full understanding of the serdes protocol at the hardware level, then you need an understanding of the protocol that is runnung over serdes.
 

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Re: Syncing a SelectIO serdes module?
« Reply #2 on: March 17, 2018, 01:19:56 pm »
The exact format that I'm working with is:

Data is being transmitted out of the sensor over LVDS using four lanes.
Each lane streams data out for each fourth pixel in a 12-bit format.

Each line of data is framed by a horizontal pulse.
Each frame of data is framed by a vertical pulse.

Unfortunately the precise amount of LVDS clocks from the sensor is not entirely consistent from line to line and frame to frame. It's always +/- 3 LVDS clocks.

I have the auto-generated code configured such that it'll output this data in parallel.

The issue is the +/- clocks between that horizontal pulse and the framing byte.

What I'm thinking about doing is instantiating a second module and setting that to a data width of 1 and then bringing that out of reset on a horizontal pulse. Then letting it run until the 0xFF framing byte is read-in. Then using this as a flag to enable the primary serdes module so that we're always synced.

Could something like this work? Or could it be too simple?

What I'm thinking about doing is holding that SerDes module in a reset state and then instantiating a second one that's only connected to the first lane and the clock.
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: Syncing a SelectIO serdes module?
« Reply #3 on: March 21, 2018, 11:40:54 am »
Are we talking IOSERDES or GTx?

It does not sound like your data is 8b10 or 64b66 or such which is what you would normally expect if using a GTx, so I guess you are using an IOSERDES (Rate less then about 1.2Gb/s)?

I am not really clear what another serdes buys you, presumably you have some unique code that appears on lane 1 for "start active video" and another for "end active video" and are simply looking to tweak the word alignment to suit? Sounds like a job for a sequence detector and barrel shifter.

I think the problem with your idea is that a data width of 1 means that your logic looking for the framing will have to run at line rate, and that nearly never works, far better to sort it out in a parallel domain, maybe use a deserialisation factor of say 16, which then means your 0xff frame start flag should always fit into the first word out of the serdes if the random shift is only 3 bits.
You can then find that byte and use it to configure the starting phase of a gearbox to get you your 12 bit words.

The trancever serdes often have some of this built in, and often have the inherent ability to shift word alignment, but the availability of that depends on the part and I cannot recall if an IOSERDES can do this.

Regards, Dan.
 

Offline Pack34Topic starter

  • Frequent Contributor
  • **
  • Posts: 753
Re: Syncing a SelectIO serdes module?
« Reply #4 on: March 21, 2018, 02:32:28 pm »
The issue is alignment of bit0 of the data to bit0 of the output of the serdes. I was thinking of having it setup to watch the individual bits and then enable the SelectIO module at the proper time.

However, I think the cleanest method is likely to reset the module whenever I see a line framing pulse and then bitwise assigning the bits into a buffer after they show-up as the 24-bit vector. Increment down the list and then start tossing the bits into the correct bucket in a new buffer.

Similar to waiting for a start flag in firmware when processing a UART, reading the data into a buffer, and then memcpy that buffer into a mirror for processing.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3143
  • Country: ca
Re: Syncing a SelectIO serdes module?
« Reply #5 on: March 21, 2018, 06:23:52 pm »
It has a BITSLIP pin to align bits.

Concerning additional 1:1 channel - if it is slow enough that you can read it without ISERDES, why do you need ISERDES in the first place? How fast is it?
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Syncing a SelectIO serdes module?
« Reply #6 on: March 22, 2018, 08:53:05 pm »
For the most part, high speed per-pin Select I/O SERDES on Xilinx devices is only useful if the send and receiver are deriving their timing from the same clock.

If your source sensor is sending data at 500Mb/s +/- 50ppm, and your FPGA's IO clock is 500MHz but a different +/- 50ppm, then you are doing it wrong. Have the FPGA generate the sensor's clock, or connect the sensors clock to your FPGA's clocking infrastructure.

You cannot implement line-speed Clock Data Recovery using a SERDES, even if you are using a CDR friendly coding scheme. At best you will end up clocking your FPGA design faster, and then need a Data Enable Strobe to identify which cycles have active data. Regenerating a nearly-jitter-free pixel clock for video data or an I2S clock for audio data is not simple, (and maybe not even possible).

Differences in relative phase at the IO pins can be trimmed out using IDELAY and ODELAY primatives, or by adjusting the phase in the clocking infrastructure (MMCM or PLL). You can detect phase dynamically by having two SERDES modules sampling the same pin but at different phases (effectively sampling at 2x), and trimming the phase so the "dodgy samples" (the ones that occur on the rising/falling edges of the data bits) are all seen in one SERDES, thus ensuring that the other SERDES is seeing clean samples taken within the eye.

The only other way is to oversample the data (at 3x or 4x faster than the data rate), and then identify the transitions yourself and follow as the relative phase creeps this way or that. This technique tops out at about 300 or 400Mb/s per pin (due to the 1.2Gb/s max for a SERDES), and is extremely expensive in area, power, time and complexity. It also cannot work if you have sparse transitions in your data stream (i.e long runs of zeros or ones), which could be likely for sampled video data.


« Last Edit: March 22, 2018, 08:57:43 pm by hamster_nz »
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26896
  • Country: nl
    • NCT Developments
Re: Syncing a SelectIO serdes module?
« Reply #7 on: March 22, 2018, 11:08:46 pm »
I'm working with a camera module and have run into a bit of a snafu.

I'm attempting to use the built-in SelectIO core generator to parse LVDS data from a sensor. This data begins streaming after a horizontal pulse from the sensor. The issue is that there's an almost random amount of LVDS clocks that occur after the horizontal pulse is seen by the FPGA.

What would be the best way to sync this? Would it be as simple as creating a second serdes module, not selecting the serialization option and using that to read in the start byte? This could then reset the SelectIO core that I'm using to parse in the data?
Bitslip is your friend. You have to analyse the data and if it is not correct then you need to assert the bitslip pin which delays the input stream one input clock cycle. Repeat until the data makes sense.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline kony

  • Regular Contributor
  • *
  • Posts: 242
  • Country: cz
Re: Syncing a SelectIO serdes module?
« Reply #8 on: March 23, 2018, 10:05:23 am »
... Have the FPGA generate the sensor's clock, or connect the sensors clock to your FPGA's clocking infrastructure ...

Not that I have too much expirience with highspeed serial intefraces, however suggesting sourcing the clock from FPGA fabric for a highspeed data converter (be it image sensor or otherwise) is asking for a trouble. Dedicated clock synthetiser will have much better jitter performance, which will reflect into higher SNR of the converter due to smaller sampling aperture jitter. I don't really recall any occasion where the data converter had separatelly clocked I/O interface with clock being provided externally, decoupled from the converter sampling clock itself. In the other direction however, plenty of times.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
Re: Syncing a SelectIO serdes module?
« Reply #9 on: March 23, 2018, 10:49:42 am »
... Have the FPGA generate the sensor's clock, or connect the sensors clock to your FPGA's clocking infrastructure ...

Not that I have too much expirience with highspeed serial intefraces, however suggesting sourcing the clock from FPGA fabric for a highspeed data converter (be it image sensor or otherwise) is asking for a trouble. Dedicated clock synthetiser will have much better jitter performance, which will reflect into higher SNR of the converter due to smaller sampling aperture jitter. I don't really recall any occasion where the data converter had separatelly clocked I/O interface with clock being provided externally, decoupled from the converter sampling clock itself. In the other direction however, plenty of times.
It was more a general comment on using SERDES, and which particular configuration works for you depends on your needs.

Example 1- HDMI
Source provides clock, sink receives clock and uses that (after a PLL) to sample the data.

Example 2 - DDR DRAM
Clock is supplied to SDRAM DIMMs from the memory controller

Example 3 - OV7670 image sensor.
FPGA can supply the clock (XCLK) to the sensor
parallel data is supplied back to FPGA along with the pixel clock (PCLK).

In all three cases the timing is referenced back to the single clock source, so you only have to worry about relative phase issues, not frequency differences.

...and just to throw a spanner in the works, https://www.xilinx.com/support/documentation/application_notes/xapp589-VCXO.pdf - All Digital VCXO Replacement for Gigabit Transceiver Applications, where a local reference clock is 'adjusted' to match the incoming clock rate. (however this has little to do with SERDES blocks)
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf