Posts mit dem Label CCC werden angezeigt. Alle Posts anzeigen
Posts mit dem Label CCC werden angezeigt. Alle Posts anzeigen

2013-12-11

Reverse Engineering (Micro) Four Thirds lens protocol

Based on the work of Lasse Bayer, who modified an Olympus lens to attach a logic analyser,
I'm trying to reverse engineer the rest of the Micro 4/3 lens protocol.

I found an interesting macro adapter that sits between mft camera and mft lens and has electrical contacts.
Thus I'm trying to modify this adapter and analyze not only one lens but a large number of combinations of lenses and cameras.

I'm currently working on this.
This blog-posting will be updated all the time!
Here are the logs!

Setup 


 
 


 

Pinout:

VDD=microcontroller power (goes low on lens-release button)
VCC=battery power (possibly for AF-motor,...)

preliminary MFT pinout:


signallogic analyser cablelogic analyser channelposition




ACK?BROWNCH4Right when Facing the Sensor
ACK?REDCH2
ClockORANGECH3
DataYELLOWCH1
Lens2Body?GREENCH0
Body2LensBLUECH5

GREYCH7
???PINKCH6

WHITEGND

BLACKGND
FEHLER(N/C)------Left when facing the sensor

 

Quote about the 2 additional contacts (from here):
In addition, the lens mount of the Micro Four Thirds System is equipped with two additional signal contacts for smoother Live View shooting with shorter time lags, faster higher communication speeds between the lens and body, and, of course, reduced lens and camera size.
These two contacts will also be used in high-speed data processing required for the movie handling capability expected in the future.




(Image again taken from Lasse Bayer)


SPI seems to be used at 500KHz with 8 bits LSB. Lens2Body and Body2Lens are pulled high by lens or body respectively to indicate that they are ready to receive/send the next byte and pulled low again to acknowledge the receipt.

The camera seems to pull the lines low (including clock) to pause communication.
  • when the shutter is pressed
  • when exposure has finished 
(confirmed for MFT)

General protocol

Everything seems to start with 4 byte commands sent by the camera to the lens,
followed by the lens answering.

Initial communication 

FT:  B0 F0 00 00  (first command on switch-on)
MFT: B0 F0 00 00 
 
FT: 
Followed by 2 values: A0 00 
 
MFT:
Followed by 2 values: 00 00 


Command: request lens data (MFT)

MFT: 80 ED 01 00
 
TODO: followed by some yet unknown data

Command: request lens data (FT)

FT:  C0 F0 20 00
There is quite a lengthy answer in 26 blocks: 

 Block 0

lens Id
lens designation(ASCII)
lens serial number
lens firmware version
number and length of the following blocks

 TODO : details

Block 1

 May be a list of all focal lengthes in mm - 1

Block 2

unknown

Block 3

unknown

Block 4

unknown

Block 5

unknown

Block 6

unknown

Block 7

unknown

Block 8

unknown

Block 9

unknown

Block 10

unknown

Block 11

unknown

Block 12

unknown

Block 13

unknown

Block 14

unknown

Block 15

unknown

Block 16

unknown

Block 17

unknown

Block 18

unknown

Block19

unknown

Block20

unknown

Block21

unknown

Block22

unknown

Block23

unknown

Block24

unknown

Block24

unknown

Block25

unknown

Block26

unknown

Regular polling (MFT)

 TODO: MFT seems to use multiple, regular polls.

81 E3 04 03
followed by yet unknwn data that does change while not touching the camera.

Regular polling (FT)


C0 F1 0 0 
Apparently the camera polls the lens every 104ms sending these 4 bytes.
The lens answers with 14 bytes including information on the current focus, focus mode, zoom distance, and a checksum.

(I'll insert details here)

Here is what Lasse found out:
 Byte Number:

 1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,  9 ,  10,  11,  12,  13,  14,  15,  16,  17,  18
----------------------------------------------------------------------------------------

    Infinity focus:

192, 241,   0,   0, 177,  11,   0, 160,   0,  31, 255, 255,   2,   5,   0,   0,   0, 196

    Focusing closer:

192, 241,   0,   0, 177,  11,   0, 128,   0,  31,  43,   1,   2,   5,  11,   2,   0, 223
192, 241,   0,   0, 177,  11,   0, 128,   0,  31, 155,   0,   2,   5,  85,   3,   0, 153
192, 241,   0,   0, 177,  11,   0, 128,   0,  31,  87,   0,   2,   5, 121,   5,   0, 123

    Close focus:

192, 241,   0,   0, 177,  11,   0, 144,   0,  31,  78,   0,   2,   5, 254,   5,   0,   7

----------------------------------------------------------------------------------------

Byte 8:   0 - 0000 0000 - Single Autofocus active
        160 - 1010 0000 - Manual Focus @ infinity
        144 - 1001 0000 - Manual Focus @ close-up
        128 - 1000 0000 - Manual Focus in between

Byte 10: Changes linearly while zooming from 31 @ 45mm to 0 @ 14mm

Bytes 11 + 12: FF FF - 65535 - infinity focus
               4E 00 -    78 - close focus
               Focus distance ?

Bytes 13 + 14: Seem to depend on the zoom position at switch-on.
               Do not change while zooming or focusing manually.

Bytes 15 + 16: 00 00 -     0 - infinity focus
               FE 05 -  1534 - close focus
               Focus mechanism position ?

Byte 18: Checksum of Bytes 8 to 17, maybe 7 to 17

The first 4 Bytes are sent from Body to Lens, the remaining 14 from Lens to Body.

Command: Start/Stop exporure (FT)

A0 B0 FE  0  ? stop of exposure ?
A0 B1  0  0  ? start of exposure ?
 TODO: different on MFT

Command: Change Aperture (FT)

Like the polling is a 4 byte sequence, this seems to be 4 byte too.
close aperture: 176  210 xxx xxx
open aperture:  176  215 0   0
 TODO: verify list of epertures

Aperture values as determined by Lasse:
aperture         command
value               data
                   
estimated
                   
1.0               0    0
1.1              85    0
1.2             170    0
1.4               0    1
1.6              85    1
1.8             170    1
2                 0    2
2.2              85    2
2.5             170    2
2.8               0    3
3.2              85    3
3.5             170    3
                   
determined                my own notes:
4                 0    4  (base value for comparison) 
4.5              85    4   (+85 )
5.0             170    4   (+170)
5.6               0    5   (+256)
6.3              85    5
7.1             170    5
8                 0    6
9                85    6
10              170    6
11                0    7
13               85    7
14              170    7
16                0    8
18               85    8
20              170    8
22                0    9

 determined
                   
3.5             157  131     my own notes:
3.6             171  131
3.7             198  131
3.8             211  131
3.9             236  131
4.0             248  131     (base value for comparison) 
4.1              17  132
4.2              28  132
4.3              51  132
4.4              62  132
4.5              84  132     (+77 instead of +85 =-10%)
4.6             106  132
4.7             116  132
4.8             137  132
4.9             156  132
5.0             166  132     (+162 instead of +170 =-5%)
5.1             176  132
5.2             195  132
5.3             213  132
5.4             222  132
5.5             231  132
5.6             249  132     (+257 instead of +256 =+0,4%)
 
 
Quote from a camera manufacuter I recently got:
"The electronic feedback from the lens tells the camera where it is in 
regards to f-stop, and the camera then interprets that information." 

Command:  shutdown (MFT)

Sadly the shutdown sequence seems to use different commands.
No clear command sequence to see yet.

-->
14-42PZ14-42PZ14-42PZ
14mm14mm14mm14mm
















23,89ms12,32ms32,09ms
14,06ms29,83ms21,92ms23,86ms
SDO: A1 D7 00 00 11 05 7D 07 SDO: F1 CF 00 00 11 05 7D 07 SDO: B1 D7 00 00 11 05 7D 07
SDO: 31 CF 00 00 08 04 3F 02 SDO: 31 C7 00 00 08 02 BF 00 SDO: 21 9E 00 00 00 00 3F 00 SDO: F0 9E 00 00 80 00 BE 06
SDI: A1 D7 00 00 11 05 7D 07 SDI: F1 CF 00 00 11 05 7D 07 SDI: B1 D7 00 00 11 05 7D 07
SDI: 31 CF 00 00 08 04 3F 02 SDI: 31 C7 00 00 08 02 BF 00 SDI: 21 9E 00 00 00 00 3F 00 SDI: F0 9E 00 00 80 00 BE 06








lens folding up...lens folding up...lens folding up...




716,8ms705,43ms725,16ms
336,96ms352,76ms344,85ms346,89ms
SDO: 42 FF 07 00 C6 16 02 00 SDO: 62 FD 03 00 C6 16 02 00 SDO: 42 FF 03 00 C6 16 02 00
SDO: E2 FF 07 00 60 08 00 00 SDO: 62 FF 03 00 C2 12 00 00 SDO: 42 FE 07 00 C0 10 00 00 SDO: E0 FF 07 00 C0 10 00 00
SDI: 42 FF 07 00 C6 16 02 00 SDI: 62 FD 03 00 C6 16 02 00 SDI: 42 FF 03 00 C6 16 02 00
SDI: E2 FF 07 00 60 08 00 00 SDI: 62 FF 03 00 C2 12 00 00 SDI: 42 FE 07 00 C0 10 00 00 SDI: E0 FF 07 00 C0 10 00 00
















790,6ms761,32ms794,78ms
393,21ms414,12ms370,9ms384,84ms
SDO: 7C 31 10 SDO: 7C 31 10 SDO: 7C 31 10
SDO: E0 00 08 SDO: C0 00 0C SDO: E0 00 18 SDO: E0 00 18
SDI: 7C 31 10 SDI: 7C 31 10 SDI: 7C 31 10
SDI: E0 00 08 SDI: C0 00 0C SDI: E0 00 18 SDI: E0 00 18








VDD going lowVDD going lowVDD going low
VDD going lowVDD going lowVDD going lowVDD going low

 

I also looked at this on the Blackmagic Pocket Cinema Camera...
not only does the #BMPCC not send the proper lens shutdown sequence, it also has some really bad noise on the VDD line while being switched off. 

Command: prepare for shutdown (FT)

176 160   0   0         prepare for shutdown
 TODO: verify 

Command: focus

176 161 xxx xxx  change focus to/by value
176 173   0   0  start single autofocus
 TODO: verify 

 Other commands

192 241   0   0  poll
192 246   0   0  ?(sent after initial command and before requesting the full lens data))

192 250 xxx xxx  ?
192 251   0   0  ?
  TODO: analyse these

2013-05-31

GulaschProgrammierNacht

First day of GulaschProgrammierNacht #GPN was great.
I took a few minor projects with me that I didn't have the time to finish in recent month.
A small, slow going hacker meet is exactly what I need to finish them.
Currently I'm on the train back home to take a shower and collect some missing that tools.
My 3d printer had been resurrected.
I hacked an IPreAmp into the 20 eur phantom power injector with additional headphone output.
Planning to attach the larger stepper onto my 4th axis of the CNC and finish some Arduino work later.

2013-03-26

CCC Freiburg visits RaumZeitLabor Mannheim

Last weekend the CCCfr Hackspace visited the RaumZeitLabor Hackerspace in Mannheim.
Smaller then the ShackSpace in Stuttgart, we visited before, but wich much more food. ;)
We made us 3 CCCfr T-Shirts using the cool cutting plotter and shirt-press they had to offer and I found the time to drill and solder the PCB I made.
(Originally wanted to drill it on the CNC but I didn't have the right collets to mount the tiny drills.)






2013-03-20

My first PCB

My first (hopefully) working, etched PCB.
Made in CCCfr last night.
This time the problem was not the (stored warm and brightly lit) PCB from the store but that my acid simply cooled down.
I didn't have access to a heated machine this time, so I used a 10eur kit and hot water.
We tried to warm it up again using hot air from a distance and later a large hot water tub but it just didn't work again.
Maybe it was already saturated.


2013-01-27

CCC-Freiburg "Hack 'n Play"

Had a very nice evening at CCCfr during today's "Hack'nPlay".
A mixture of talks and lightning talks and a free software lan-party.
Including a ton of retro games. Handheld, console and early PC based.

We're so lucky to have share in the infrastructure of the ArTik with our small Club in Freiburg.

I was called to help my record the talks while hackers from Karlsruhe would take care of a live stream and a media trainee took photos. (Being there, of cause I took my fair share of photos too.)
I hope to have my photos up on Tuesday. The videos will take a few days as I have to get the official audio recording first and sync my clips to it.


Met some nice folks from Chaos Computer Club in Zurich, Switzerland.

2013-01-22 CCCfr HackNPlay

2012-08-25

First CNC milling

Got down to business with my CNC mill.
X and Y axis sometimes skip steps.
Slowing down helps only do far.
T slot tables are really good at collecting shavings.
Spindle doesn't run as hot anymore.
Was probably just the hot weather outside.
Milling much faster and deeper then in the first tests now.
Still need to add end stops.
My 6mm CNC edge finder arrived.
Will have to play around with it

2012-04-18

Show Firefox Passwords for Android updated

On the Chaos Computer Club meeting today I updated the free version of ShowFirefoxPasswords.
It now has a menu to allow filtering the lists on devices that have no menu-button anymore.
(Formerly you long-pressed the menu button to filter lists that implement the Filterable interface.)
I also added support for GoogleTV. It should appear in the market on the TV any time now.
(No sideload nonsense.) 

2012-04-06

EasterHegg Basel 2012 - Decoded the Zoom H4n remote control protocol!!!


(Update: I'm doing the same for the new Zoom H5 too.)

For the next 4 days I am on EasterHegg and reverse engeneering the protocol spoken between the RC04 remote and the Zoom H4n audio recorder.
This posting is constantly being updated and rewritten with details as they come up.
Newsticker:
  • Friday
  • So far no luck with the OpenBench logic sniffer. 
  • Can't figure out if the buffered inputs support 3.3V signals or only 5V signals. We are trying to verify this by connecting and disconnecting the on-board 3.3V supply to an input-pin to get a known signal.
  • But we are out of chocolate and coffee!!!
  • Saturday
  • I fetched my pocket-oscilloscope from home but forgot 2 cables.
  • Contacted "Nussgipfel" for an oscilloscope because he holds an oscilloscope-workshop tonight. So he must have a working device. Hope to verify that the signal is 3.3V and count it's frequency/bitrate to get the OpenBench to work on decoding it. 
  • Hacked my pocket-Oscilloscope. Found a 5V signal (-0.5 to 4.5V and -1 to 4V) in the 600-800Hz range.
    Aus 2012-04-07_EasterHegg
  • Decoded the signal
    Aus 2012-04-07_EasterHegg
  • Batteries died while decoding the LED signals. Buttons are decoded.
  • Sunday
  • Trying to find Nussgipfel again to make screenshots of the undistorted waveforms and document my findings below.
  • Found a second signal being transmitted with >100ms delay after the first signal. Need help analysing it.
    Aus 2012-04-07_EasterHegg
  • checked the signal using a larger scope. Seems I had GND and Signal confused on the small one. Low<->High. May be RS232 after all? With start+stop -bit the signal checks out. 2.400 = 417 µs per bit seems to match our 0,4ms per bit.
  • Making a break to eat some fondue down in the huuuuuuge bunker below this building. Planning to use a larger logic analyser later.
  • ...
  • Monday
  • ...

Aus 2012-01-22_RC04
Observations:

The 4 connections between RC04 remote and H4n are labeled 3.3V, RX, TX and GND.

The single chip on the remote is labeled "D78f0500A"
It could be an NEC microcontroller µPD78f0500.
The number of pins and the pins connected to RX, TX and SCK seem to match.
The datasheet is in Korean but what I can make out is that this should be a 5MHz microcontroller that can run on 3.3V and 5V. No details from the datasheet cast and light on the strange encoding used(described below).

What I found out about the protocol being transmitted by the RC04 remote on the 2 lines "RX" and "TX" when certain buttons are pressed on the remote or the Zoom H4n lights up certain LEDs is as follows:

Findings:


 The protocoll is RS232 at 3.3V with 2400bps 8n1
The remote sends 2 sequences of 2 bytes with a small delay:
Record: 0x81 0x00 | 0x80 0x00
Play:   0x82 0x00 | 0x80 0x00
Stop:   0x84 0x00 | 0x80 0x00
ffwd:   0x88 0x00 | 0x80 0x00
rwd:    0x90 0x00 | 0x80 0x00
vol+:   0x80 0x08 | 0x80 0x00
vol-:   0x80 0x10 | 0x80 0x00
rec+:   0x80 0x20 | 0x80 0x00
rec-:   0x80 0x40 | 0x80 0x00
mic :   0x80 0x01 | 0x80 0x00
ch1 :   0x80 0x02 | 0x80 0x00
ch2 :   0x80 0x04 | 0x80 0x00

It receives a single byte that is a bitmask of the LEDs to light up:



? && 0x01 = record LED
? && 0x10 = MIC LED
? && 0x60 == CH1+CH2 LED = 0x20 + 0x40
? && 0x20 = CH1 green
? && 0x40 = CH2 green
? && 0x04 = CH1 red 0x16?
? && 0x08 = CH2 red


? && 0x24 = CH1 yellow (red+green)
? && 0x48 = CH2 yellow (red+green)




Links




Next step: implement this in an ATTiny13 using a softUart. Maybe use a CMOS 4019 /
4052 or MAX4619 to trigger something else too.

2012-04-04

CCC Hackerspace Freiburg

I was away for15 month due to an Android project that got extended again and again.
During this time the Chaos Computer Club Freiburg (of which I am a founding member) managed to create it's own Hackerspace.
Now for the first time I get to see it...
It is located in a former subterran walkway that has been extended and fittet with ventilation, power, internet, security system,...

2011-07-20

CCCamp planning has started

CCCamp 2011 is drawing near and I'm starting to plan the last details of my stay there on this wiki page.

I plan to:
  • do 3d printing (of cause)
  • get more experience in interviewing people by doing so for [REPORT]-style videos for my YouTube channel. Where they can present their project.
  • Provide a place where people can plug in their recorder/laptop to record podcasts

<<Wiki page

2011-06-22

Me live on Freibyte

Remember a while ago when I recorded a show for Freibyte (a local radio show of the Chaos Computer Club Freiburg distributed by Radio Dreyecksland across 3 countries)?
My show has just been aired recently! :)

2011-06-08

Video: [REPORT] EasterHegg 2011

I finally found the time to finish my EasterHegg video.
it was supposed to become a report with lots of talk and facts about 10 years of easterhegg.
In the end it has just become a general vacation video with impressions from the event.
As my recording of the "10 years of EasterHegg" failed, numerous requests for the slides where unanswered and CCC-Wiki, Wikipedia&co did not provide much info I simply skipped all the talking and inserted CreativeCommons music instead.




2011-05-10

Freibyte II

Wow....doing some audio takes a LOT more effort then I though it would.
I recorded that Freibyte -part I was asked to do yesterday.
Couldn't use the very good Zoom H4n internal microphones because my hotel room has a lot of echo to it.
The clamp of the Lavalier was missing, so that one rubbed against my clothes and was unusable.
Leaving only the Sennheiser MKE-400. A directional mono-microphone intended as a good replacement for camera-internal microphones in video.

Turned out it was very good at not picking up the echo.
The slightly higher noise-floor compared to the more expensive H4n was easy to reduce using audacity.
But it DID pick up lots of other, unwanted sounds that came from my direction.
Me inhaling between sentences and some noise from my clothes and water in my mouth.
Luckily I spoke loud enough so they are only noticable in the pause between sentences.
It's a lot of work though to manually go through each and every sentence to remove these by hand. :(

2011-05-04

Freibyte

I was just asked to do the next Freibyte show.
(A regular show from 2 guys of the CCC Freiburg.)

Checking out the past shows to see,
what I would get myself into,
I found that one of them had posted the preview-version of the introductory-video I did for my YouTube channel to the Freibyte-Site.
Not sure what to do about it.
Would have been nice to be asked about it first.


2011-04-24

HOWTO hand soldering 0.N mm pitch chips

Here on Easterhegg,
I was asked to record a 15min howto about hand soldering very small pitch chips.

I used 2 cameras and some vintage high aperture lenses as well as a professional audio recorder (using 24 bit 96KHz...more then will ever be required) and it turned out quite well.

I cut everything here on Easterhegg (lip-sync, intro, end, switching between cameras, cleaning up, ...) and gave it to the people who asked be for it.
They will finalize my cut and I asked to be allowed to present the final video
on my YouTube channel, when it is done.

Freiburg becomes an Erfa-Kreis

I'm an old time member of Chaos Computer Club and one of the founding members of Chaos Computer Club Freiburg e.V. .
As such it's with great pleasure, that with a nearly unanimous vote, here on Easterhegg Freiburg has been declared an official Erfa-Kreis of the Chaos Computer Club.

2011-04-02

(EN) hackerspace for Chos Computer Club Freiburg

The Chaos Computer Club - Freiburg is looking for a location to create a Hackerspace for some time now.
Last night I was out, meeting 3 other club members at the local airport.
Aparently the amateur radio operators have a house there that we may use for events.
They are discussing it with thei administration and we with ours and in may or june there may be a decision.

2011-02-09

(DE) Besuch beim CCC München

Gestern mal Gelegenheit gehabt die Räume des CCC in München zu besuchen.
Geil!
So stelle ich mir das sich für Freiburg vor.
Gemütliche Sofa Ecke, gut ausgestattete Werkstatt, kleine Küche, Serverraum und ein großer Tisch zum ruhig Arbeiten am Laptop.


Hab die Werkstatt gleich mal genutzt um den Gimbal an der Steadycam etwas tiefer zu setzen.
Ist jetzt bei gleichem Gewicht durch die größere Hebelwirkung besser ausbalanciert.
Mal sehen ob ich heute dazu komme, Test Aufnahmen zu machen...

2010-12-27

(EN) OSM at the 27C3

You can find he there for the next few days...
Published with Blogger-droid v1.6.5


Streams at http://27c3.fem-net.de/ (don't work at the moment)