본문 바로가기

카메라

캐논 EF 렌즈 프로토콜 - Canon EF Protocol

요새 나오는 미러리스 삼성 NX100 이나 NEX등에는 짧은 플랜지 백 덕분에 다양한 타사의 렌즈들을
사용할수 있다. 캐논 렌즈 같은 경우에도 사용이 가능하지만 캐논 렌즈 같은 경우 조리개 조절이 모두 전자식이므로
조리개는 항상 개방으로 놓고 사용해야 한다.

검색하다가 캐논 EF 렌즈 프로토콜을 찾았다..
SPI 통신을 사용하고 렌즈 제어 명령어가 나와있으므로 마이컴에 연결하면 제어가 가능할듯도 한데....

일단 참고용으로 복사해둔다.
 

http://www.canon.com/camera-museum/history/canon_story/1987_1991/densi.html :


http://photo.net/bboard/q-and-a-fetch-msg?msg_id=005nXu :

It's not just voltages, there is a serial communication protocol being used.

Pinout and pin functions:
Left to right, looking at the front of the body:

1. VBAT
2. P-GND
3. P-GND (pins 2 & 3 are common on the lens)
4. VDD
5. DCL
6. DLC
7. LCLK
8. D_GND

Pin Functions

VBAT - Motor power
P_GND - Motor power ground
VDD - Logic circuitry power
D_GND - Logic circuitry ground
DCL - Data from body to lens
DLC - Data from lens to body
LCLK - Clock

Data protocol: Motorola SPI; 8 bit serial; Such as the protocol used with the 68HC05 chip.

You will need access to the pins to experiment. Hack up the cheapest body you can find,
such as a broken Rebel or whatever. Good luck, experiment on a cheap lens first!


EF232 Lens Interface Protocol Definition

(v40.12, released 27 June 2006)

General comments
- format of commands is <xx><val><cr>
- <xx> is a case insensitive two character string (a..z,A..Z)
- <cr> represents a byte with the value 13 , and will latch a command and reset the input stream.
- <val> represents an optionally-signed decimal number (-,0..9).
- White space is not permitted.
- The adapter echoes all characters sent.
- Communication is 19.2Kbps, 8 data bits, no parity, on stop bit (8n1).
- This release was tested with 34 of approximately 124 lenses manufactured by Canon.
- Version 31 and previous can be found at the following location: Link

 Links to Command Type:

Commands List

IdentifyLens
Syntax id<cr>
Response OK<cr>
<rval1>mm,f<rval2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests the lens' distinct identifier. <rval1> is the current focal length in millimeters, and <rval2> is the maximum aperture (i.e. Minimum f-number).
This command requires library version 10.

 

HardwareVersion
Syntax hv<cr>
Response OK<cr>
<val><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns hardware revision number. Possible values are: 1, Canon EF.
This command requires library version 10.

 

DefineFocusAxis
Syntax df<cr>
Response OK<cr>
<rval><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
NOT IMPLEMENTED.

 

MoveFocusInfinity
Syntax mi<cr>
Response OK<cr>
<rval>,<flag><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the focus mechanism move to the infinity position. <rval> is the number of counts moved, <flag> is 1 if the lens reports having hit a stop, and 0 if it hasn't. Note: some lenses do not return a 1 until the second time the stop is hit.
This command requires library version 10.

 

MoveFocusZero
Syntax mz<cr>
Response OK<cr>
<rval>,<flag><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the focus mechanism move to the near focus position. <rval> is the number of counts moved , <flag> is 1 if the lens reports having hit a stop, and 0 if it hasn't. Note: some lenses do not return a 1 until the second time the stop is hit.
This command requires library version 10.

 

MoveFocusAbsolute
Syntax fa<val><cr>
Response OK<cr>
<rval>,<flag><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the focus mechanism move to the specified focus count position, specified in counts moved in <val>. If an input value would move the focus out of the legal range the value is rounded to the boundary (i.e. Min/max count). <val> is the actual position that the count has been moved to, <flag> is 1 if the lens reports having hit a stop, and 0 if it hasn't. Note: some lenses do not return a 1 until the second time the stop is hit.
This command requires library version 11.

 

MoveFocusIncremental
Syntax mf<val><cr>
Response OK<cr>
DONE<rval>,<flag><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the focus mechanism move incrementally the number of counts specified in the direction (sign) specified in <val>. If the number of counts specified is out of range, the mechanism will move as far as it can, <rval> is the actual number of counts moved, <flag> is 1 if the lens reports having hit a stop, and 0 if it hasn't. Note: some lenses do not return a 1 until the second time the stop is hit.
This command requires library version 10.

 

PositionOfFocus
Syntax pf<cr>
Response OK<cr>
<val><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests the current position of the focus axis.
This command requires library version 10.

 

FocusDistance
Syntax fd<cr>
Response OK<cr>
<val1>cm,<val2>cm<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests the focus distance. The number is returned as two distances, <rval1> the near distance, and <rval2> the far distance, both in centimeters, where 65535 represents infinity. Of the lenses tested thus far, eight unique ranges are returned for any given lens, and only the "EF200mm f/2.8L USM" and "EF28-105mm f/3.5-4.5 USM" return this information.
This command requires library version 10.

 

SetFocusCounter
Syntax sf<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Sets the focus counter to the the value specified.
This command requires library version 10.

 

Initialize
Syntax in<cr>
Response OK<cr>
DONE<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests the lens interface to establish a known state. The aperture will be reset to the full open position and the position of aperture counter is reset to zero. This command MUST be executed before Iris commands will work correctly. This command is executed automatically every time a lens is changed while the unit is powered up. If it is not executed before an MoveApertureClose is issued, damage to the iris in the lens may occur.
This command requires library version 10.

 

DefineApertureAxis
Syntax da<cr>
Response OK<cr>
f<rval1>,<rval2>,f<rval3><cr>

ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests a definition of the aperture axis. <rval1> is the aperture value associated with aperture position 0 in tenths of an fstop, <rval2> = Number of distinct encoder positions (N), <rval3> is the aperture value associate with aperture position N-1.
This command requires library version 10.

 

MoveApertureOpen
Syntax mo<cr>
Response OK<cr>
<rval1>,f<rval2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the aperture mechanism move to the full open position. <rval1> is the actual number of steps the aperture was moved, and <rval2> is the absolute position, of the aperture after executing the move, in tenth f-stops.
This command requires library version 10.

 

MoveApertureClosed
Syntax mc<cr>
Response OK<cr>
<rval1>,f<rval2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the aperture mechanism move to the full closed position. <rval1> is the actual the number of steps the aperture was moved, and <rval2> is the absolute position, of the aperture after executing the move, in tenth f-stops.
This command requires library version 10.

 

MoveApertureAbsolute
Syntax ma<val><cr>
Response OK<cr>
<rval1>,f<rval2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the aperture mechanism move to the specified encoder position, specified in half f-stops indicated by the user in<val>. If an input value would move the aperture out of the legal range the value is rounded to the boundary (i.e. Min/max aperture). <rval1> is the actual position that the aperture has been moved to in steps, and <rval2> is the absolute position in tenth f-stops.
This command requires library version 10.

 

MoveApertureIncremental
Syntax mn<val><cr>
Response OK<cr>
<rval1>,f<rval2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Makes the aperture mechanism move the specified number of encoder positions, in the specified direction, in quarter f-stops indicated by the user as <val>. If an input value would move the aperture out of the legal range the value is rounded to the boundary (i.e. Min/max aperture). <rval1> is the actual the number of steps the aperture was moved, and <rval2> is the absolute position, of the aperture after executing the move, in tenth f-stops.
This command requires library version 10.

 

PostionOfAperture
Syntax pa<cr>
Response OK<cr>
<val1>,f<val2><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests the current position of the aperture axis. <rval1> is the location in steps, and <rval2> is the absolute position, in tenth f-stops.
This command requires library version 10.

 

DefineZoom
Syntax dz<cr>
Response OK<cr>
<rval1>mm,<rval2>mm<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Requests a definition of the zoom axis. <rval1> is the minimum focal length in millimeters, <rval2> is the maximum focal length in millimeters.
This command requires library version 10.

 

ImageStabilization
Syntax is<cr>
Response OK<cr>
OK<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Begins image stabilization on applicable lenses.  Image stabilization will remain active and no new commands can be entered until another key is pressed.
This command requires library version 10.

 

ShutterState
Syntax ss<cr>
Response OK<cr>
<rval><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns the state of the shutter in <rval>. 1 = open, 0 = closed.
This command requires library version 12.


ShutterEnable
Syntax se<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Charges the shutter coil to 70 volts, allowing the shutter to open. When <val> is 0, the coil will be charged once. If <val> is any other value, the coil will be recharged every time the shutter is closed.
This command requires library version 12.


ShutterOpen
Syntax so<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Opens the shutter for <val> milliseconds. If <val> is 0, the shutter will remain open until a "SC" command is issued.
This command requires library version 12.


ShutterClose
Syntax se<cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Forces the shutter to close.
This command requires library version 12.


ShutterHWInput
Syntax hi<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Allows an input override of the shutters function. <val> = 1 enables Hardware input, <val> = 0 disables Hardware input.


ShutterHWOutput
Syntax ho<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Enables the output pin (see electrical). <val> = 1 enables Hardware output, <val> = 0 disables Hardware output.


ShutterHWInputPolarity
Syntax ip<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Sets the polarity of the hardware input pin. The shutter will open when input pin = <val>, where a 1 indicates a high pin and 0 a low pin.
This command requires library version 12.


ShutterHWOutputPolarity
Syntax op<val><cr>
Response OK<cr>
ERR<eval><cr>
Command understood
Command completed with error
Sets the polarity of the hardware output pin, <val> = 1 enables Hardware output, <val> = 0 disables Hardware output.
This command requires library version 12.


ShutterTime
Syntax st<val><cr>
Response OK<cr>
<rval><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
When the shutter is opened, the coil will be held at 7 volts for a certain amount of time before dropping to 5 volts. This command sets the 7 volt time in milliseconds. <rval> is an echo of <val>.
This command requires library version 12.


ShutterVoltage
Syntax sv<val><cr>
Response OK<cr>
<rval><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns the voltage across the shutter coil.
This command requires library version 12.

 

BaudRate
Syntax br<val><cr>
Response OK<cr>
OK<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Sets the baud rate to a specified value <val>.  For applicable values, see baud rate table.  The response may appear at a different baud rate and be indistinguishable.  Once the connection is reestablished at the new baud rate, the response "OK" will occur when enter is keyed.
This command requires library version 10.

 

BaudStore
Syntax bs<cr>
Response OK<cr>
DONE<cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Stores the baud rate in non-volatile memory so the current baud rate will remain when the power is cycled.
This command requires library version 10.

 

SetResponseMode
Syntax rm<cr>
Response OK<cr>
<val><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Sets the response mode to either verbose or non-verbose.  "rm1" indicates verbose mode (returns nothing), "rm0" indicates non-verbose mode (returns 0). The result of this command will be stored in non-volatile memory. When in non-verbose mode the return for value for any command will be the least significant digit of the error code, where 0 signifies a success.
This command requires library version 10.

 

XModem
Syntax xm<cr>
Response OK<cr>
<string><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns a starter transmission character every second until the data has been sent. The result after completion is that of a power cycle. This command is used for updating the library - please go to the XModem Tutorial for further information on the use of this command.
This command requires library version 10.

 

SerialNumber
Syntax sn<cr>
Response OK<cr>
<val><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns the unit serial number.
This command requires library version 10.

 

VersionNumber
Syntax vn<cr>
Response OK<cr>
<val><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns the hardware/firmware revision number.
This command requires library version 10.

 

VersionString
Syntax vs<cr>
Response OK<cr>
<string><cr>
ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns the version string that includes the hardware/firmware revision level and compile date. For v1.5 <string> is "EF-232 Lens Adapter, v15, 26 March 2000.<cr>(c)1999,2000 Birger Engineering, Inc.<cr>"
This command requires library version 10.

 

LibraryVersion
Syntax lv<cr>
Response OK<cr>
<string1>,<string2>,<string3><cr>

ERR<eval><cr>
Command understood
Command completed without error
Command completed with error
Returns three strings indicating the version of the library. For example, a Canon EF Lens Controller with library version 11 will return "Canon EF v11."<cr>
This command requires library version 10.

 

 

 

 

F-numbers returned:

These numbers represent the ratio of focal length to effective diameter of the lens multiplied by ten. More information on F-numbers can be provided to qualified customers after the execution of a non-disclosure agreement..

Baud Rate Conversion Table

 Desired Baud Rate (bps)

 "br" Input Value

 300

 3

 1200

 12

 2400

 24

 4800

 48

 9600

 96

 19200

 192

 38400

 384

 57600
576

 115200

 1152

 

Error Values:

1 - Could not parse command.
2 - Lens set to Manual Focus.
3 - No lens present.
4 - Distance information not available.
5 - Lens not initialized.
6 - Invalid baud rate.
7 - No shutter present.
8 - Insufficient power.
9 - Invalid library.
10 - Lens communication error.

Unique XModem Errors
1 - Time Out (transfer not started within allotted time).
2 - Error in transmission.

THIS IS THE ALL INCLUSIVE LIST OF ERRORS THAT ARE CHECKED FOR IN THIS REVISION.

Page mise à jour le 19 septembre 2007 à 10h47