luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Getting vsync from hdmi.

Fri Jun 13, 2014 8:34 am

Hi There!

I did not really know what section to post this. Its digital communication interface so I tried here.
I have a project where I want to sync a motor to a video cameras shutter. I have done this quite easily before on Composite and VGA video which has a easily obtained VSYNC. I have not yet found a easy way to get the "vsync" from hdmi video. This product http://www.adafruit.com/products/609 can do it but a cheaper/simpler alternative would be interesting. I am looking for a broken monitor with hdmi in, hoping that it has a vsync output on the chip handling the HDMI signal for doing OSD.

Any tips is welcome, it doesn´t have to be cheap solution.

Best Regards

Ludvig

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Getting vsync from hdmi.

Wed Jun 18, 2014 8:21 am

You can use this board, it's from a sony lcd tv (KV30HS420).
The board has a Vsync signal, I can help you find it (schematics are available on the internet too).
With this board you can still send component video to a TV and sound from HDMI is also available.
It only needs 9Vdc power.

Edit: the broken monitor idea is close, but these monitors have the video converted in LVDS format so its sync signals can only be extracted with an LVDS receiver module. Or if you hack the LCD panel itself, for which documentation is very scarce.

luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 6:43 am

Thanks alot for your reply! I will buy this and try it out. Do you think it will give me proper vsync on all frame rates? Also do I need to output to something (edid) for it to work?

PiGraham
Posts: 4651
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 8:39 am

You could use an HDMI - VGA adaptor. The VGA connector has VSYNC and HSYNC.

Another option is to use a software function to synchronise with the frame, and use that timing to adjust the motor speed via GPIO. You may find that something like SDL_PrenderPresent() will sync your code to VSYNC timing if you set the renderer mode appropriately:

Code: Select all

SDL_CreateRenderer(pwindow,
                                 index,
                                 SDL_RENDERER_PRESENTVSYNC)

luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 1:20 pm

Yes I will get a vsync from a hdmi-vga adapter but it will always be at 60 or more Hz to produce vga signal that a typical crt monitor can handle? I will use 24, 25 and 30 Hz video and it is important that the vsync is as close as possible to when sensors is recording each frame. I don't really understand how you mean I can use software to do this? Perhaps I was not clear enough. The video camera is not connected to the pi in any way. It's just a normal video camera with hdmi output.

luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 1:33 pm

The vsync coming out of that Sony hdmi board is that before converting to analog video with the source refresh rate intact? I tried finding some schematic for it but I haven't had any luck so far. Is that a fpga under the heatsink?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5733
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 2:04 pm

You can use config.txt option "fake_vsync_isr=1" and the arm will get an interrupt each vsync (you'll need a kernel driver to use it).

Simpler would be to use dispmanx. The vc_dispmanx_update_submit callback will occur following a vsync.

PiGraham
Posts: 4651
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 2:14 pm

luuude wrote:Yes I will get a vsync from a hdmi-vga adapter but it will always be at 60 or more Hz to produce vga signal that a typical crt monitor can handle? I will use 24, 25 and 30 Hz video and it is important that the vsync is as close as possible to when sensors is recording each frame. I don't really understand how you mean I can use software to do this? Perhaps I was not clear enough. The video camera is not connected to the pi in any way. It's just a normal video camera with hdmi output.
I see.

I had assumed this was somehow related to Raspberry Pi.

Sorry, can't help.

luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Re: Getting vsync from hdmi.

Tue Jun 24, 2014 3:10 pm

I had planned in using the PI and or some arduino to control the motor with PID. But to extract the vsync from the hdmi signal I need something special. The PI will be used to control other things such as light intensity, relays etc.

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Getting vsync from hdmi.

Wed Jun 25, 2014 10:21 am

luuude wrote:The vsync coming out of that Sony hdmi board is that before converting to analog video with the source refresh rate intact? I tried finding some schematic for it but I haven't had any luck so far. Is that a fpga under the heatsink?
That vsync is decoded from the HDMI signal, so it's the original.
Check out the SiI9993 hdmi chip description here.

luuude
Posts: 7
Joined: Tue Feb 04, 2014 12:28 pm

Re: Getting vsync from hdmi.

Wed Jun 25, 2014 5:50 pm

That is very good news!

I have been looking at that chip and found out that its hdmi 1.0. Do you know of similar modular but newer hdmi chips? Most modern TVs have it all on the mainboard it seems, I took apart an old broken phillips tv yesterday and that also had a VSYNC out from the HDMI reciever. But I imagine that its difficult to get that to work since the whole mainboard needs to get all the right inputs etc.

My output is 1080p 24, 25 and 30 fps. Hopefully the flavor of 1080p25 the blackmagic pocket camera is outputting is supported on that card you linked. Its not so expensive to try anyway so I ordered it. How would you go about tapping into that tiny leg, any tips?

And again, thank you very much!

ceteras
Posts: 239
Joined: Fri Jan 27, 2012 1:42 pm
Location: Romania

Re: Getting vsync from hdmi.

Thu Jun 26, 2014 10:59 am

I've sent you a link to a schematic. You can identify the trace on the schematic going to two pins on the "IC9517 HD64F3694 SUB MICRO". Pins 27 and 28. It's a lot easier to tap there as they are two adjacent pins so you can stick a thin wire between them and carefully solder it.
I've successfully used one of these sony boards with a raspberry pi.
However, I realise your resolution might not be supported by its HDMI chip (480i/576i/480p/576p/720p/1080i) .

Edit: Here you can see another solution that can go 1080p 60Hz.
It's based on ADV7611 from Analog Devices. "The ADV7611 enables portable designers to achieve 1080p/60f display resolution with 24-bit color." Link
Original Vs is on pin 47 of ADV7611.

Return to “Interfacing (DSI, CSI, I2C, etc.)”