Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - funlw65

Pages: [1]
1
Reverse Engineering / Re: EF Lens communication protocol
« 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.

2
Reverse Engineering / Re: Does ML actuate the aperture by itself?
« on: February 27, 2017, 04:24:29 AM »
I wasn't sure about the multibyte form of his SPI transfer function so I asked the author

Quote
The first form of the function I understand (as per your example in
documentation - I send a byte, I receive a byte).
But I don't understand the second form, where a list of bytes is sent over
SPI:

list = spiTransfer([0x01, 0x02, 0x03], microDelay)

How it works? As the first form, where it sends the bytes from the list one
by one and at every byte sent it makes also a read which writes back in the
variable list, and then awaits "microDelay" before sending the next value?

The functionality can be simulated like following pseudocode?

list[0] = spiTransfer(0x01)
"microDelay"
list[1] = spiTransfer(0x02)
"microDelay"
list[2] = spiTransfer(0x03)
"microDelay"

Or is different than I understood?
Thank you very much for your time!

And he answered back:
Quote
Yes your understanding is correct, since SPI is full duplex a device can
write a byte back for every byte written, not all devices take advantage of
this and will not write back at the same time and instead you will get
nothing back on the write and will need to do additional reads after the
write to get the returned data.

3
Reverse Engineering / Re: Does ML actuate the aperture by itself?
« on: February 25, 2017, 04:58:27 AM »
The program in python can be translated in C without problems

Code: [Select]
import pymcu
 
fstops = {0:'0',0x8:'1',0xB:'1.1',0xC:'1.2',0xD:'1.2',0x10:'1.4',0x13:'1.6', \
          0x14:'1.8',0x15:'1.8',0x18:'2',0x1B:'2.2',0x1C:'2.5',0x1D:'2.5',0x20:'2.8', \
          23:'3.2',0x24:'3.2',0x25:'3.5',0x28:'4',0x2B:'4.5',0x2C:'4.5',0x2D:'5', \
          0x30:'5.6',0x33:'6.3',0x34:'6.7',0x35:'7.1',0x38:'8',0x3B:'9',0x3C:'9.5', \
          0x3D:'10',0x40:'11',0x43:'13',0x44:'13',0x45:'14',0x48:'16',0x4B:'18', \
          0x4C:'19',0x4D:'20',0x4E:'20',0x4F:'20',0x50:'22',0x53:'25',0x54:'27', \
          0x55:'29',0x58:'32',0x5A:'32',0x5B:'36',0x5C:'38',0x5D:'40',0x60:'45', \
          0x63:'51',0x64:'54',0x65:'57',0x68:'64',0x6B:'72',0x6C:'76',0x6D:'80',0x70:'91'}
 
mb = pymcu.mcuModule()
mb.lcd()
 
print "Enable SPI"
mb.spiEnable(1,100,0,0)
 
# Init Lens
lcheck = 0
while lcheck != 170:
    il = mb.spiTransfer([0,0xA,0,0xA,0], 400)
    lcheck = il[4]
 
focalMin = 0
focalMax = 0
print "Init Lens"
mb.lcd(1,'Init Lens       ')
il = mb.spiTransfer([0,0xA,0,0xA,0,0,0,0x80,0xA,0x98,1,0,0,0,0,0,0xB0,0,0,0,0xB0,0,0,0], 400)
focalMin = (il[10] << 8) | il[11]
focalMax = (il[12] << 8) | il[13]
print "Focal", str(focalMin) + '-' +  str(focalMax)
print "F-Stop", str(fstops[int(il[21])]) + '-' + str(fstops[int(il[23])])
mb.lcd(1,'Focal ' + str(focalMin) + '-' + str(focalMax))
mb.lcd(2,'FStop ' + str(fstops[int(il[21])]) + '-' + fstops[int(il[23])])
mb.pausems(2000) # Wait and give some time to read the LCD
mb.lcd()
# Clear F-Stop (Full Open)
print "Clear F-Stop"
mb.lcd(1,'Clear F-Stop    ')
mb.spiTransfer([0x90,0,0,0,0xC,0x13,0x80,0x90,0,0,0xF,0xA,0],300)
 
mb.pausems(500)
 
# F-Stop Full Close
print "F-Stop Full Close"
mb.lcd(1,'F-Stop Close    ')
mb.spiTransfer([0x13,0x58,0])
 
mb.pausems(500)
 
# Clear F-Stop (Full Open)
print "Clear F-Stop"
mb.lcd(1,'Clear F-Stop    ')
mb.spiTransfer([0x90,0,0,0,0xC,0x13,0x80,0x90,0,0,0xF,0xA,0],300)
 
mb.pausems(500)
 
# Focus Test Far
focusAmt = 100
print "Focus Test Far"
mb.lcd(1,'Focus Test Far  ')
for x in range(20):
    mb.spiTransfer([0xA])
    mb.pausems(20)
    mb.spiTransfer([0x50,0x2F,0xE0,0,0,0xEA,0,0,0,0,0,0,0x44,0,focusAmt],300)
    mb.pausems(20)
    mb.spiTransfer([0x90,0])
    mb.pausems(20)
    mb.spiTransfer([0xE,0])
    mb.pausems(100)
 
 
# Focus Test Near
focusAmt = 155
print "Focus Test Near"
mb.lcd(1,'Focus Test Near ')
for x in range(20):
    mb.spiTransfer([0xA])
    mb.pausems(20)
    mb.spiTransfer([0x50,0x2F,0xE0,0,0,0xE8,0,0,0,0,0,0,0x44,0xFF,focusAmt],300)
    mb.pausems(20)
    mb.spiTransfer([0x90,0])
    mb.pausems(20)
    mb.spiTransfer([0xE,0])
    mb.pausems(100)
 
mb.lcd(1,'Test Complete   ')

And the doc of the important functions
scaled by Vasile Guta-Ciucur, on Flickr

Part of the result
crop by Vasile Guta-Ciucur, on Flickr

And here are the specs of the board used for testing
http://www.circuitsforfun.com/pymcu.html#jquerytabs1-page-2

4
Reverse Engineering / Does ML actuate the aperture by itself?
« on: February 23, 2017, 02:01:08 PM »
Hi guys,

Does ML use it's own functions/routines to actuate the aperture, or just calls (jumps to) routines in the Canon binary? If it does, the initialization of the lens is made by the Canon binary, or ML takes control? Is here a schematic for a probing stand for lenses? Apologies if I ask too much!
Thank you!

Edit: for the question nr.1, somehow I found and answer of @huston on google group in 2010,
Quote
That's right -- we just call the Canon firmware functions to adjust
the lens and it does the rest.  Interestingly, the aperture values
reported in the lens protocol are the same as the ones that we
deduced, so it seems that Canon's interface is just a thin layer on
the SPI protocol.
and, if this continue to be true, then there is also the answer for the question nr.2.

But, meantime, I found the SPI initialization of the lens, lens info reading, aperture actuating for a PIC microcontroller that commands the lens. http://www.pymcu.com/spiLens.html
The author may have used the info from ML!?

Best regards,
Vasile Guta-Ciucur

Pages: [1]