Magic Lantern Forum

Developing Magic Lantern => Reverse Engineering => Topic started by: JP79dsfr on November 24, 2016, 11:47:43 PM

Title: EF Lens communication protocol
Post by: JP79dsfr on November 24, 2016, 11:47:43 PM
Not compl├Ęte but enought for some applications ....... sorry for my baguette.

http://jp79dsfr.free.fr/_Docs%20et%20infos/Photo%20Tech%20_%20Canon%20EOS-EF%20Protocol.pdf

Arduino module for test lens

http://jp79dsfr.free.fr/_Docs%20et%20infos/Elec%20_%20Arduino%20-%20Testeur%20Canon%20EOS.pdf
Title: Re: EF communication protocol
Post by: g3gg0 on November 26, 2016, 12:11:28 AM
thanks a lot for this information!

it is a really good analysis of the protocol as far i can understand from it :D

BR,
g3gg0
Title: Re: EF communication protocol
Post by: Avenger 2.0 on November 26, 2016, 11:03:51 AM
Nice thanks, finally those french lessons will start paying off  ;D
Title: Re: EF communication protocol
Post by: g3gg0 on November 26, 2016, 01:35:45 PM
oh cool, so you can translate? :D
Title: Re: EF communication protocol
Post by: JP79dsfr on November 27, 2016, 03:46:19 PM
I do not know if it can help but this is the Word original file : http://jp79dsfr.free.fr/_Docs%20et%20infos/Photo%20Tech%20_%20Canon%20EOS-EF%20Protocol.docx

Title: Re: EF Lens communication protocol
Post by: SpcCb on November 28, 2016, 06:51:24 AM
Excellent JP !
Maybe it will help us to understand differences between 5D2 and 5D3 protocols.
Your web site is also full of interesting stuff, like about batteries mod etc.
Are you in the '79'?
Title: Re: EF Lens communication protocol
Post by: g3gg0 on November 28, 2016, 10:11:04 PM
@JP79dsfr:
according to your paper the serial number of the lens is not readable via the protocol?
only the TC serial number can be read, but not the lens one?
Title: Re: EF Lens communication protocol
Post by: JP79dsfr on November 29, 2016, 12:46:26 AM
Quote
according to your paper the serial number of the lens is not readable via the protocol?

Sorry, i dont find the SN register

All my lens and my body (5d3 last) dont read this info  in direct acces by the menu AF adjustement, but my 70-200 is II inject the valid SN into the picture's EXif with the 5D3. The Lens SN is therefore transmitted by the protocol.

I do not have time anymore for this search. If you may be looking into the excel file or the source logical analyser file (links are in the PDF)

Perhaps 0x84 function but i dont know how this can be coded => answer to the function 0x84=0xF4D4 046C D900 5849 0000, constant regardless the lens configuration, and SN = 0730010492.

Good luck.

Quote
Maybe it will help us to understand differences between 5D2 and 5D3 protocols.
I do not have a 5d2, maybe the 5d2 is the same protocol version of 40D

Quote
Are you in the '79'?
Near "La rochelle"  :)
Title: Re: EF Lens communication protocol
Post by: g3gg0 on November 29, 2016, 02:26:01 PM
thanks for your information!
Title: Re: EF Lens communication protocol
Post by: funlw65 on March 20, 2017, 07:45:31 AM
I'm reading the French documentation...
Regarding Aperture step-by-step moving commands [0x12,Value] on older Sigma lenses and [0x13,Value] on others, you can use signed values (positive to close the aperture and negative values to open the aperture) to go back and forth (BTW, there is an error in documentation, on the second element of the bullet identation). 

In reality, as reflex automated lenses are working (EOS included), we will never need to use negative values to open aperture in steps from a closed one. From the start, the aperture is already open at her maximum, allowing a good light into the optical viewfinder. The incrementation/decrementation of the aperture is happening virtually on the firmware, inside the RAM memory and displayed on LCD according to the "double array" which contains the values and codes of the aperture (of course, the minimum and maximum values are depending on the lens characteristics - and I understand that on zoom lenses, the maximum and minimum changes and the lens must be interrogated for these every time an aperture change is involved ). When a picture is shot, the aperture always goes mechanically from the her maximum opening to the value set in memory by the user, and this is happening also when the aperture preview button is pressed. And reverts back to the starting value with a single command.

I understood correctly? What I am trying, is to learn how to use an EF lens in a custom (read DIY) film camera, where the focusing is always on manual and because of that, I don't need to mess with focus related commands. The metering will be made with the sensor and firmware from here as a starting point http://kadookacameraworks.com/light.html UPDATE: It seems that the account is suspended for now... last checked April 9, 2017. Meanwhile see it here https://sites.google.com/view/vasihome/micro/kevin-kadooka-light-meter

I will opt later for a full manual Leica II shutter, or an electromagnetic shutter recovered from a broke film camera (I have one in a defective Yashica AF-230). The mirror should be actuated with a servo...

Why not an (old and not in production anymore) EOS film camera? Well, I won't mind, but I hate film winders based on motors, that is always a source of troubles (one of the problems of my Yashica). A DIY camera is a camera that can be repaired/remade by you when it breaks but Cooke triplet lenses are a bit harder to build, and EOS lenses have the best electronic interface from all modern fullframe reflex cameras. Of course, full manual lenses (Rokinon, Samyang) can be also a solution, but it won't help with the automatic light metering , requires additional actions from the user.
Title: Re: EF Lens communication protocol
Post by: eos-dacious on April 10, 2017, 10:59:14 PM
@JP79dsfr:
The lens serial number for Canon EF-lenses is transmitted with the 0x85 command.
Title: Re: EF Lens communication protocol
Post by: g3gg0 on April 11, 2017, 12:38:33 AM
thanks!
Title: Re: EF Lens communication protocol
Post by: jkenny23 on April 13, 2017, 03:03:48 AM
Does anyone happen to have a mirror of the code listed here: http://www.butterflybikers.cz/index.php/cz/elektronika/item/1-canon-eos-protocol-convertor-for-old-sigma-lens

I'm looking for the file "Sigma_digital_EOS_protocol_interface_v_1_1_0.zip", it appears to be taken down from the site since I believe the author is selling these boards now and has moved it to closed source. I've found the code for the ATtiny24 (older version), but would like to use the ATtiny10 since I have those on hand and it has lower power consumption.
Title: Re: EF Lens communication protocol
Post by: BBA on May 13, 2017, 04:30:27 PM
For those interested, I found this thread on a german site "Canon-EOS-Protokoll"

http://www.dslr-forum.de/showthread.php?t=649529 (http://www.dslr-forum.de/showthread.php?t=649529)
As I can't understand german, I will have to "google translate".

I also saw they made a "micro controller based" adapter (to be soldered in the lens) to transcode/translate new Canon commands to pilot an old Sigma lens. 
[added]
http://www.martinmelchior.be/2013/04/conversion-of-old-sigma-lens-to-work.html (http://www.martinmelchior.be/2013/04/conversion-of-old-sigma-lens-to-work.html) (in french)
http://www.butterflybikers.cz/index.php/cz/elektronika/item/1-canon-eos-protocol-convertor-for-old-sigma-lens (http://www.butterflybikers.cz/index.php/cz/elektronika/item/1-canon-eos-protocol-convertor-for-old-sigma-lens) (in english)
Title: Re: EF Lens communication protocol
Post by: JP79dsfr on May 25, 2017, 12:44:15 PM
Quote
@JP79dsfr:
The lens serial number for Canon EF-lenses is transmitted with the 0x85 command.

Sorry, but i don't think so. The command 0x85 is no active with my lens (old 38-76, 50/1.4, 50/1.8 stm, 70/200 is v2 ....)

What are your sources out of curiosity ?
Title: Re: EF Lens communication protocol
Post by: eos-dacious on May 29, 2017, 10:18:24 PM
Out of the lenses I tested, only a few transmit the serial number. I think currently only the professinal line of lenses with the red "L" marking released in recent years transmit the serial number. I can confirm 0x85 working on the Canon EF 24-105mm f/4 L IS II USM.

You can test it by connecting the lens to a recent camera body, like a EOS 5DmIV. If the serial number is shown in the sub-menu for the AF microadjustment, then this command should work. It then will also write the serial number correctly to the EXIF information in the JPEGs.

You are correct that that the EF 50mm/1:1.4 (too old) and EF 50mm/1:1.8 STM (too cheap) do not transmit the serial number.
Title: Re: EF Lens communication protocol
Post by: JP79dsfr on June 11, 2017, 01:00:12 PM
Quote
I can confirm 0x85 working on the Canon EF 24-105mm f/4 L IS II USM.

My most recent lens is a 70-200 is II or 50 stm .......... but, the serial num is also in the exif (just like the old 300/2.8 ), and effectively not in the micro Af adjust menu.

Are you the complete format of the dialogue for uptade of my doc ?
Title: Re: EF Lens communication protocol
Post by: eos-dacious on July 06, 2017, 07:57:13 PM
When the lens has a serial number "1234567890" engraved, the encoding sheme is simple binary coded decimal (BCD):
Code: [Select]
DCL 0x85 0x00 0x00 0x00 0x00 0x00
DLC ...  0x12 0x34 0x56 0x78 0x90