Author Topic: ADTG and CMOS registers  (Read 79753 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10723
  • 5D Mark Free
ADTG and CMOS registers
« on: June 25, 2013, 11:01:20 AM »
Code: https://bitbucket.org/hudson/magic-lantern/src/tip/modules/adtg_log/

Notes: http://magiclantern.wikia.com/wiki/ADTG

Logs:
read, compare and understand:
http://upload.g3gg0.de/pub_files/f00fa2c2cea01ee32408009b6e02fcc6/ADTG_CMOS_Writes.7z

this is only the data written to ADTG and CMOS.
try to find out as much about the registers as you can.

if all that is understood, then we have about 10% of the necessary stuff for custom resolutions.

good luck ;)

Andy600

  • Hero Member
  • *****
  • Posts: 1838
  • Have you tried turning it off and on again?
Re: ADTG and CMOS registers
« Reply #1 on: June 25, 2013, 11:40:27 AM »
Looks like a big find.  8)

Is it safe to try on older cameras?
Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10723
  • 5D Mark Free
Re: ADTG and CMOS registers
« Reply #2 on: June 25, 2013, 11:47:26 AM »
First you need to find some stubs, they are hardcoded for 5D3 now.

Then, take the battery out as soon as you see distorted images. It will look like the CMOS is dieing ;)

I have no idea if it's actually dangerous or not. It probably is.

If you manage increase the sampling area, be prepared for buffer overflows.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #3 on: June 25, 2013, 03:26:18 PM »
thanks for consolidating the data and setting up the wiki page!
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #4 on: June 25, 2013, 03:45:23 PM »
my theory about:
 8060 - shutter blanking without zoom

i think it specifies the time to wait until sensels are powered.
when they are powered, all incoming light causes the charge to increase.
as soon the video timer has expired, the ADTG will read out the sensels.

why this way and not power the sensels immediately and read out after the specified time ticks?
this way the sensels are not floating/unpowered and thus dont lose any charge before they get read out.
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10723
  • 5D Mark Free
Re: ADTG and CMOS registers
« Reply #5 on: June 25, 2013, 03:51:43 PM »
This theory explains perfectly the shutter speed changes when using FPS override (you know the formula from fps-engio.c: EA = (E0 + (1/Fb - 1/F0)) * Ta / Ta0).

(changing FPS timer B in digic, but not in ADTG, will keep the blanking time constant and will stretch the exposure time)

ilguercio

  • Hero Member
  • *****
  • Posts: 843
Re: ADTG and CMOS registers
« Reply #6 on: June 25, 2013, 05:03:11 PM »
I like these kind of threads :)
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

dlrpgmsvc

  • Senior
  • ****
  • Posts: 398
  • The 7D and 50D Robin Hood
Re: ADTG and CMOS registers
« Reply #7 on: June 25, 2013, 05:29:06 PM »
my theory about:
 8060 - shutter blanking without zoom

i think it specifies the time to wait until sensels are powered.
when they are powered, all incoming light causes the charge to increase.
as soon the video timer has expired, the ADTG will read out the sensels.

why this way and not power the sensels immediately and read out after the specified time ticks?
this way the sensels are not floating/unpowered and thus dont lose any charge before they get read out.

Because they must start collecting photons and then read in a precise time slot. If you power up all the rows together and then, after a while, you start to read the first row, then the second row... every subsequent row has collected too many photons if compared to the first ones, so uneven exposure. If this is your question... or try to explain better if I misunderstood you.
Normal CMOS row timings in video mode (shutterless) are normally as follows (as an example) : - power to row 1  - power to row 2 - power to row 3 - read row 1- power to 4 - read row 2 - power to row 5 - read row 3 - ... and so on...  and in photo mode (with shutter) are : - shutter down - power to all rows - shutter up - wait - shutter down - read row 1 - read row 2 - ... and so on
If you think it's impossible, you have lost beforehand

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: ADTG and CMOS registers
« Reply #8 on: June 25, 2013, 07:16:25 PM »
Have to try this on 6D, should work like 5D3.. 50D and others will have to post logs.. maybe can undo removing 0 from the shutter list since a1ex applied that fix.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #9 on: June 25, 2013, 08:07:37 PM »
@dlrpgmsvc:
My question was a rhetorical one which i immeadiately answered :)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: ADTG and CMOS registers
« Reply #10 on: June 26, 2013, 01:10:42 AM »
For 6D I found

805F
8061

move when shutter is turned.

But

//~ #define FRAME_SHUTTER_BLANKING_ZOOM   (*(uint16_t*)0x4045184C) // ADTG register 805f
//~ #define FRAME_SHUTTER_BLANKING_NOZOOM (*(uint16_t*)0x40451850) // ADTG register 8061

This did not work. Got lines and shutter read as 1/24

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: ADTG and CMOS registers
« Reply #11 on: June 26, 2013, 02:05:18 AM »
How do I parse this? Do you have to hook GDB to the camera?

adtg.bin
https://mega.co.nz/#!J4RGjDCb!PDdbfC6G7QE-IuZ0AO4AyQu7b-ZKk9WeVRZbUzB-lm4

50D is 105F and 1061

Also.. on 6D the shutter bounce +/- 1? like the fps override did.. 50D is solid one setting.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #12 on: June 27, 2013, 12:31:10 AM »
the bin can be parsed with the python script in the module directory ;)
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!


g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #14 on: June 27, 2013, 10:14:44 AM »
i uploaded modified versions of adtg_log and trace to my repository.
see https://bitbucket.org/g3gg0/magic-lantern

using these modules, can someone trace crop mode ADTG configuration on 60D or 600D?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

dlrpgmsvc

  • Senior
  • ****
  • Posts: 398
  • The 7D and 50D Robin Hood
Re: ADTG and CMOS registers
« Reply #15 on: June 28, 2013, 11:38:54 PM »
I wish to be of help into porting this to 550D : can someone help me into specify what to do ? Even preliminary tests or logs reports... but please, even if I'm a programmer, I'm quite new to this programming environment, so, something I managed to understand, while other things not: can you be as specific as you can, so I can get the point ? Many thanks in advance !  ;D
If you think it's impossible, you have lost beforehand

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #16 on: June 29, 2013, 01:10:15 AM »
the most important part is trying to understand what the registers in the logs mean.
this means, finding and identifying numbers that could make up the vertical and horizontal resolution etc.

to use adtg_log, you have to find the ADTG_Write function on your camera.
its easy as it usually contains these strings:
"[REG] @@@@@@@@@@@@ Start ADTG[CS:%lx]"
"[REG] ADTG:[%08x] <----- Excel Tab Number"

same for CMOS
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: ADTG and CMOS registers
« Reply #17 on: June 29, 2013, 01:23:40 AM »
EOS M and 650D might be easier to trace, we found working crop mode on that.

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #18 on: June 29, 2013, 02:15:11 AM »
yeah nanomad tried, but gdb_setup() failed (return value zero) due to the M having a different IV structure.
my recommendation was

MEM(0x0C) = 0xE59FF000;

before calling gdb_setup().

can you confirm that gdb_setup() works then?
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: ADTG and CMOS registers
« Reply #19 on: June 29, 2013, 05:34:10 PM »
GDB setup hangs my camera.. doing that assignment gives lvalue error in the module.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: ADTG and CMOS registers
« Reply #20 on: June 30, 2013, 09:43:50 AM »
You need to expand the macro by hand. But overwriting stuff in that memory area causes tons of assertions.
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #21 on: July 02, 2013, 10:08:08 AM »
we fixed it tonight.

just curious - you removed the volatile in MEM macro and it worked?
this is not how it is supposed to work :(
can you re-add it?

volatile just ensures that the compiler does *not* optimize the code.
the compiler will read the variable from RAM every time it is read and write back every time is is written.
without volatile, subsequent reads would get optimized and the variable is kept in registers.

btw, can you upload all those logs?

@all:
if you want to help, can you create a map of all registers and their values for every log we have?
i think it is possible to process them with shell scripts and then export it for google spreadsheet.
the last written value should be used as register value to be shown.

tried it for two 5D3 logs, but the register list will show the *first* register value only.
https://docs.google.com/spreadsheet/ccc?key=0AgQ2MOkAZTFHdHdQVFcyMVExZFdNM1A2NnJSYlFhSmc&usp=sharing
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: ADTG and CMOS registers
« Reply #22 on: July 02, 2013, 10:37:35 AM »
After going back, I think the bad boy is the function that updates CMOS regs in the module causing, in turn, all kind of assertions.

Here are the LOGs
https://dl.dropboxusercontent.com/u/15964163/ML/650D.101.ADTG-LOGs.zip

edit: Your google link is read-only
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

dlrpgmsvc

  • Senior
  • ****
  • Posts: 398
  • The 7D and 50D Robin Hood
Re: ADTG and CMOS registers
« Reply #23 on: July 02, 2013, 11:09:21 AM »
@all:
if you want to help, can you create a map of all registers and their values for every log we have?

Please, I need a "dummy-hints" here.
Obviously I don't need a Step-by-Step guide, but only some sparse hints&tips : What I have to do just to start ? Do I must go to g3gg0 repository, download the ADTG module and makefile, then compile it to my side ?
Also, How it works and what I have to do ? Do I must activate it, and how ? Simply by loading it from modules ml menu ? Do I have to activate also raw video module ? And then, do I must make some actions on my camera in order for the log to record something ? And what actions I must do on my camera ? You are talking about ADTG and CMOS: do they are two different logs ? Or do there is a separate module for CMOS ? And where these logs are saved ? ...

Excuse me for all these questions: I'm a programmer and I work with assembly Language also, and I'm sure when I will manage to be "inside" the workflow, I will be of help. Obviously I will write a "dummy-guide" also for this so Others can help as well !  ;-)
If you think it's impossible, you have lost beforehand

g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3061
Re: ADTG and CMOS registers
« Reply #24 on: July 02, 2013, 12:09:55 PM »
edit: Your google link is read-only

fixed
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!