Canon XL Spi bus lens protocol - Page 1
Forum section: electronics / projects

author: jsfotografie
author_rank: Newbie
timestamp: April 17, 2014, 05:35:38 pm
content: hey there :-) im working on controlling canon XL lenses.Here a little background:My Name is janosch im working full time as an engineer and in my free time as photographer and cinematographer.Because there is no affordable slow motion raw camera on the market i decided to build my own :-) the MiniRAWIts based on a small industrial point grey flea 3 usb3 camera which can shoot up to 120fps at 12 bit and 720p.One downsize is that the sensor is only 1/3" and it has a 7x crop compared to 35mm. Now the Canon XL comes in playit also has a 1/3" sensor and some fine optics! for example an 3-10mm which would be in 35mm world 21-70mm nice?Problem: The canon xl lenses work only with a canon xl1s attached cause there is no mechanical iris focus and zoom...Solution: try to emulate the camera with an arduino := worksi hijacked the spi bus with an saleae logic analyser and sent the data with an arduino back which works BUT now the tricky part:i know which byte is the iris and the zoom the focus not quiet sure. at the moment i sent pre recorded packets ( which contain 40 bytes each)and as you can see in the video it opens the iris and then the zoom and focus ring work..BUT because i sent always the same packets the lens is confused if it should listen to the arduino or to the lens input.any ideas how can program this? my goal is to mount the lens in front of my MiniRAW1 and control focus zoom and iris.hope thats understandablecheers and thxjanosch

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 17, 2014, 09:31:01 pm
content: ...

author: jsfotografie
author_rank: Newbie
timestamp: April 18, 2014, 08:06:27 am
content: nice find mechatrommer :-)but i still have noe idea how i can code this inside an arduino program :-/cheers janosch

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 18, 2014, 08:42:10 am
content: Quote from: jsfotografie on April 18, 2014, 08:06:27 amyou are on your own. i never heard or google anyone try to hack XL lens and probing spi comm. the xl1s service manual doesnt show detail implementation of it. good luck.

author: abyrvalg
author_rank: Frequent Contributor
timestamp: April 18, 2014, 11:21:03 am
content: Try making many SPI dumps changing one parameter at a time from camera's controls and writing down the values, then compare the packets to see which bytes are affected by which parameter and how do they match the values you see on camera body. Don't get messed by changing many things together or dumping many changes continuously, do it step by step: dump the camera power on (there can be some init), save it, note the values camrea shows, start clean acquisition, change i.e. F param one step +-, save the dump, attach a note "changed F from X to Y", etc

author: jsfotografie
author_rank: Newbie
timestamp: April 18, 2014, 12:04:38 pm
content: Quote from: abyrvalg on April 18, 2014, 11:21:03 amyeah thats what i did :-) and its working BUT my problem is that when i sent the same packets back ie the one for changing the aperture i want to sent only byte 20 which is the iris but the lens expects the other 39 bytes so when i sent the same bytes over and over the lens is confused when i try to change the focus on the lens. is that clear?

author: amyk
author_rank: Super Contributor
timestamp: April 18, 2014, 01:19:12 pm
content: What circuitry is inside the lens? It might help to find out what IC you're talking to, if by chance it happens to be a common one and not proprietary...

author: Rerouter
author_rank: Super Contributor
timestamp: April 18, 2014, 02:13:35 pm
content: the other approach as you have the camera would be to log it while performing each action (in manual mode so you are changing as few things at a time)

author: jsfotografie
author_rank: Newbie
timestamp: April 18, 2014, 02:24:16 pm
content: Quote from: amyk on April 18, 2014, 01:19:12 pmwill try to find that out@rerouterthats what i did :-) and what i sent with the arduino back but as i said this works but i want also to adjust the focus by handin manual mode i change ie the aperture and loged this with the saleae so now i know exactly what each aperture value is the only problem is how can i sent just this value without change the others :-)thx alot guys for the tips and the fast help love this place and the eevblog youtube stuff

author: Mechatrommer
author_rank: Super Contributor
timestamp: April 18, 2014, 03:10:08 pm
content: Quote from: amyk on April 18, 2014, 01:19:12 pmhaving serviced few canon lenses, and from understanding who they are, i suspect it will be "canon" brand chip aka proprietary, even if its common like say AVR, its just SPI IO, the hardest part is dechypering the proprietary comm protocol encoded in it. anyway, you may be luck finding the service manual from the net. i got xl1s body SM fromhttp://www.servicemanual.ws/search.asp?query=canon+xl&search=Search10 cents per pdf is like free, most of scattered SM in the net are all gathered in this one site, easy. good luck.

author: jsfotografie
author_rank: Newbie
timestamp: April 18, 2014, 04:40:29 pm
content: yeah the service manual for the camera i found also :-) but for the lens no luck hard stuff but exciting

author: abyrvalg
author_rank: Frequent Contributor
timestamp: April 18, 2014, 07:11:27 pm
content: So the problem is that SPI data you send contains focus value, but you are changing the focus manually and it doesn't match SPI data? But how does original camera body handle this? Maybe lens sends some "focus has changed to X" message back to the body, so the body uses that X in the next packets? Try dumping this situation too - adjust something like aperture, adjust focus manually, adjust aperture again, look for changes other than aperture in data packet and for some lens->camera data.

author: jsfotografie
author_rank: Newbie
timestamp: April 18, 2014, 08:15:19 pm
content: Quote from: abyrvalg on April 18, 2014, 07:11:27 pmgood point as i just want to use the lens without the canon xl1s perhabs i can sent something on the miso bus when i change focus by hand? damn why are they making it so complex and hard to hackBUT on the other hand i gain so much mor respect for camera manufactors!

author: abyrvalg
author_rank: Frequent Contributor
timestamp: April 19, 2014, 12:01:23 am
content: Btw, have you seen Canon EF protocol description?http://pickandplace.wordpress.com/2011/10/05/canon-ef-s-protocol-and-electronic-follow-focus/There are short commands, but perhaps your big 40byte packes are just many of those short commands combined together? Try matching bytes preceding known parameters in your dumps with command bytes for the same parameters from EF protocol.