ADTG and CMOS registers

Started by a1ex, June 25, 2013, 11:01:20 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

g3gg0

@dlrpgmsvc:
nanomad and i uploaded lgos that contain ADTG register values for specific video modes.
what we now need, is an analysis of those logs, which registers get programmed with which values.

so just to dig the logs, create a map of all registers that are written and show their values like i did in the link i wrote above.
what i have done in this google spreadsheet, is not good as it shows the *first* write only, but we have to mapt he *last* writes.
(reason: registers are first initialized with default values, then the real values=

thats nothing to do on camera, but a logfile analysis.
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

also interesting is this one:
http://upload.g3gg0.de/pub_files/bd36e0be89208738a38c66b20c9a5538/M_crop_noncrop.html

CARTRIDGE registers comparison between M crop and non-crop modes.

is it related to FPS as they differ?
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

Quote from: g3gg0 on July 02, 2013, 12:11:34 PM
@dlrpgmsvc:
what i have done in this google spreadsheet, is not good as it shows the *first* write only, but we have to mapt he *last* writes.
(reason: registers are first initialized with default values, then the real values=

Do you mean, for example, line 269 of your spreadsheet is the "first" write and line 271 is the "last write" of the same register id and register address, so first value written is 03 and last is 06 ?

Lets for instance take the first log of yours: I see as the first "02 00C7 1032" so i will search for another occurrence of "02 00C7 xxxx" and then again and again and I stop at the last finding, then this is the *last write* you need ? And so on for the Others values ? And if I find only one occurence ? Do I take it into consideration or I have to delete it ? (many thanks for your patience...)
If you think it's impossible, you have lost beforehand

g3gg0

i just implemented it right before you asked :)


#!/bin/bash

FILE="$1"

if [ -f "./${FILE}" ]; then
    cat ${FILE} | grep -e "02 [0-9A-F][0-9A-F][0-9A-F][0-9A-F] [0-9A-F][0-9A-F][0-9A-F][0-9A-F]" | cut -c 31- | sort | sed '1!G;h;$!d' | uniq -w 7 | sed '1!G;h;$!d;' | gawk --non-decimal-data 'function nrzi_decode(reg,value){ val = 0; if(and(value,0x8000)){val=or(val,0x8000);} for(i=0; i<31;i++){ bit=rshift(and(val,lshift(1,30-i+1)),1); val=or(val, xor(bit,and(value,lshift(1,30-i))));} printf "0x%04X;0x%04X;0x%04X\n", reg, val, value; } { nrzi_decode("0x"$1,"0x"$2); }' > ${FILE}_adtg_2.csv
    cat ${FILE} | grep -e "04 [0-9A-F][0-9A-F][0-9A-F][0-9A-F] [0-9A-F][0-9A-F][0-9A-F][0-9A-F]" | cut -c 31- | sort | sed '1!G;h;$!d' | uniq -w 7 | sed '1!G;h;$!d;' | gawk --non-decimal-data 'function nrzi_decode(reg,value){ val = 0; if(and(value,0x8000)){val=or(val,0x8000);} for(i=0; i<31;i++){ bit=rshift(and(val,lshift(1,30-i+1)),1); val=or(val, xor(bit,and(value,lshift(1,30-i))));} printf "0x%04X;0x%04X;0x%04X\n", reg, val, value; } { nrzi_decode("0x"$1,"0x"$2); }'  > ${FILE}_adtg_4.csv
    cat ${FILE} | grep -e "06 [0-9A-F][0-9A-F][0-9A-F][0-9A-F] [0-9A-F][0-9A-F][0-9A-F][0-9A-F]" | cut -c 31- | sort | sed '1!G;h;$!d' | uniq -w 7 | sed '1!G;h;$!d;' | gawk --non-decimal-data 'function nrzi_decode(reg,value){ val = 0; if(and(value,0x8000)){val=or(val,0x8000);} for(i=0; i<31;i++){ bit=rshift(and(val,lshift(1,30-i+1)),1); val=or(val, xor(bit,and(value,lshift(1,30-i))));} printf "0x%04X;0x%04X;0x%04X\n", reg, val, value; } { nrzi_decode("0x"$1,"0x"$2); }'  > ${FILE}_adtg_6.csv
    cat ${FILE} | grep -e "08 [0-9A-F][0-9A-F][0-9A-F][0-9A-F] [0-9A-F][0-9A-F][0-9A-F][0-9A-F]" | cut -c 31- | sort | sed '1!G;h;$!d' | uniq -w 7 | sed '1!G;h;$!d;' | gawk --non-decimal-data 'function nrzi_decode(reg,value){ val = 0; if(and(value,0x8000)){val=or(val,0x8000);} for(i=0; i<31;i++){ bit=rshift(and(val,lshift(1,30-i+1)),1); val=or(val, xor(bit,and(value,lshift(1,30-i))));} printf "0x%04X;0x%04X;0x%04X\n", reg, val, value; } { nrzi_decode("0x"$1,"0x"$2); }'  > ${FILE}_adtg_8.csv
else
    echo "Invalid file name"
    exit 0;
fi


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

Quote from: g3gg0 on July 03, 2013, 12:59:09 AM
i just implemented it right before you asked :)

Great ! So no more help needed parsing log files, right ?
So my first question apply again: what I can to do with my camera in order to extract the logs (module compiling? actions to do on camera... etc.), and where I can post them ?  ;)  I can create a folder inside your spreadsheet with the name of my camera and populate it as you have done, right ?  ;)

I can guess: activate your log module - set shutter time, aperture, iso, canon movie resolution and fps - start recording in normal canon movie mode for some seconds - stop recording        (so i should have the log files into the SD card, right ? where ?)
If you think it's impossible, you have lost beforehand

vroem

Quote from: g3gg0 on June 27, 2013, 10:14:44 AM
using these modules, can someone trace crop mode ADTG configuration on 60D or 600D?
I'm not experienced in building ML myself. I have a 60D. I tried to compile a new autoexec.bin and the adtg_log and trace modules, but when loading them I get this:

1%


vroem

[edit]ok I modified Makefile.user
magiclantern/Makefile.user

ARM_ABI=none-eabi
ARM_PATH=~/arm-toolchain
GCC_VERSION=4.7.3
CONFIG_MODULES   = y
CONFIG_TCC   = y
CONFIG_PICOC   = n
PYTHON      = python2.6
CONFIG_TINYPY    = Y
CONFIG_GDB      = Y
CONFIG_GDBSTUB  = Y

cd platform/60D.111/
make clean && make

cd ../../modules/trace/
make clean && make

cd ../../modules/adtg_log/
make clean && make

copy
autoexec.bin -> /

60D_111.sym, adtg_log.mo, trace.mo -> /ml/modules/


1%

You don't need tinypy. Check the sym file and see if those symbols are in there.

vroem

They are not
[edit:] Got it to work by adding gdb.o to src/Makefile.src
btw I'm using g3gg0's bitbucket

g3gg0

can you check if the gdb code is compiled?
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!

vroem

Heh yes, see my edit above. Now how do I use this?

g3gg0

press set on ADTG menu entry in movie menu and switch to movie mode.
then power off the camera.
you now have a log file on your card.
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!

vroem

Here you go. All the lines end in VSYNC. I suppose that's not what you need...  :'(

/* 00:00:03.276125  */ -------- VSYNC --------
/* 00:00:03.321890  */ -------- VSYNC --------
/* 00:00:03.367163  */ -------- VSYNC --------
...

vroem

Also getting ERR70s with
CRASH00.LOG
ASSERT: FALSE
at Memory\Memory.c:188, task adtg_log_task
lv:0 mode:10


Magic Lantern version : v2.3.NEXT.2013Jul03.60D111
Mercurial changeset   : 482b1734e293+ (unified) tip
Built on 2013-07-03 16:59:20 by magiclantern@magiclantern-VirtualBox.
Free Memory  : 470K + 1037K

dlrpgmsvc

It would be of help for all if someone can explain better, with an example for instance, how to find what registers do what. For example by explaining how you have found the right registers and values to implement the dual iso feature.
This will enable all of us with a minimum programming abilities to help digging out this ADTG discovery.
If you think it's impossible, you have lost beforehand

1%

I made the address write to the log so now its relatively easy.

dlrpgmsvc

Quote from: 1% on July 18, 2013, 03:22:36 PM
I made the address write to the log so now its relatively easy.

Do we must consider using the G3GG0 debug module here : https://bitbucket.org/g3gg0/magic-lantern/src/6de0d9e9a4d4db70b61149f9c212ba02a7dfd18a/modules/adtg_log?at=unified
or do we must consider using the official one at : https://bitbucket.org/hudson/magic-lantern/src/tip/modules/adtg_log/

What is better ? And where are your latest modifications you are talking about ? Many thanks !
If you think it's impossible, you have lost beforehand

Greg


dlrpgmsvc

Quote from: Greg on July 19, 2013, 03:10:38 PM
Maybe here - https://bitbucket.org/OtherOnePercent/tragic-lantern-6d/commits/all

Please, be patient with me: by using this version I have some compiling errors.
I'm using ubuntu virtual machine in Windows, I already successful compile the full magic lantern, but when I launch "make" inside the adtg_log module above, I get this error :

[ CC    ] adtg_log.o
/bin/sh:  1:  /home/magiclantern/arm-toolchain/bin/arm-none-eabi-gcc4.7.3: not found
make: *** [adtg_log.o] Error 127

I made "make clean" before "make". I copied "makefile.user" inside the adtg module dir and also inside "modules" dir, but the error is still the same.

How can I do ? many thanks !

[EDIT] : Nevermind, solved ! The file which module makefilings refers to is  "/home/magiclantern/arm-toolchain/bin/arm-none-eabi-gcc4.7.3" while the existent file is "/home/magiclantern/arm-toolchain/bin/arm-none-eabi-gcc-4.7.3". The reason of this is unknown ! So, a CopyPasta + Renaming did the trick. Strange but true.  ;D
If you think it's impossible, you have lost beforehand

dlrpgmsvc

Used this version : https://bitbucket.org/OtherOnePercent/tragic-lantern-6d/commits/all
The ML base is the last official Hudson one.
Followed same steps as user "vroem".
I'm on a 550D, ubuntu virtual machine on Windows.
All compilations are ok, but when 550D is fired up, then red solid light and all is blocked. I must slip out the battery to turn off the light.

I need a big assistance, many thanks !   :'(
If you think it's impossible, you have lost beforehand

Stedda

5D Mark III -- 7D   SOLD -- EOS M 22mm 18-55mm STM -- Fuji X-T1 18-55 F2.8-F4 & 35 F1.4
Canon Glass   100L F2.8 IS -- 70-200L F4 -- 135L F2 -- 85 F1.8 -- 17-40L --  40 F2.8 -- 35 F2 IS  Sigma Glass  120-300 F2.8 OS -- 50 F1.4 -- 85 F1.4  Tamron Glass   24-70 2.8 VC   600EX-RT X3

dlrpgmsvc

If you think it's impossible, you have lost beforehand

dlrpgmsvc

Ok ! I went to solve the 550D lock-up problem, now the problem is this :

Modules load, but there is no ADTG menu entry in movie menu to press "set" on, and the textual  modules loading log remains over the liveview even if i turn off global draw, and "show console" option in modules menu is off! I tried to change modes with main dial to photo then return to video mode. But no log written into the sd card. How can I use this log module ?  :o

Used this log module version : https://bitbucket.org/OtherOnePercent/tragic-lantern-6d/commits/all
The ML base is the last official Hudson one.
Followed same steps as user "vroem".
I'm on a 550D, ubuntu virtual machine on Windows.
All compilations are ok
I load manually the modules after entering ML menu the first time


The module loading log on screen is the following :

Scanning modules...
Scanning modules...
Load modules...
   [ i ] load: ADTG_LOG.MO
   [ i ] load: TRACE.MO
Linking..
Register modules...
Load configs...
Init modules...
   [ i ] Init: 'adtg_log'
_

It seems it blocks itself into initializing 'adtg_log' module (and this is the reason the log text remains on), what do you think ?
If you think it's impossible, you have lost beforehand

dlrpgmsvc

I think problem is inside the following function : "static unsigned int adtg_log_init()" where it blocks itself.

It calls "gdb_setup()" function and then sets a sequence of 4 watchpoints.
It could be the gdb_setup function or the watchpoints settings.

I traced it's inside "gdb_setup()" that all blocks.

I tried to eliminate all the declarations "short" by leaving them plain, because this hanged 550D on "boot_hack,c", but this didn't produced benefical effects, and the freezing still occour.

New clues indicates that the block happens BEFORE entering the function "static unsigned int adtg_log_init()".
This is odd: what is called BEFORE module initialization function ?  :o
I commented out completely all the init routine and placed inside her a well "NotifyBox", but it doesn't shows up at Runtime !
Do I'm choosing the wrong trace down method or do the problem is really before init routine ?

Now I tried the log module that come with Hudson unified: same exact problem. Even by getting rid of "short" declarations !

Now tried to eliminate the adtg_log module from the sd card : the trace module load flawlessy and then says OK near his name !
This is without any doubt a adtg_log module problem!

I'm currently investigating on this...

Side problem : I can see every camera model has different registers addresses, so... do 550D also have his own ? And how to discover them ?  :o
If you think it's impossible, you have lost beforehand