Canon 7D Mark II

Started by Pelican, November 02, 2014, 09:55:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I'll definitely need a lot of help because I have never do a lot of assembly and machine code like this before. Thanks for your help so far a1ex!


Can a1ex or anyone link a thread about log capturing on real hardware? As far as I go through the forum, most people are working on QEMU. I'm also confused about how to implement GUI menu like in M50, an example code will be nice as I have no idea what to do. Thanks!


Such logs were already captured on 80D, 5D4, DIGIC 7. The procedure for capturing basic logs was covered earlier in this very thread.

Quote from: a1ex on April 08, 2019, 10:42:32 AM
Yes, the PoC code in the digic6-dumper branch (i.e. what you get by compiling from platform/7D2.104) does just that - logging.

BTW, if you don't receive a reply within an hour (or day or whatever), that does not mean you need to open another thread with the same question ;)


sorry about that, I thought it would be more useful to post in General Development room. Please don't get annoy, i'm totally newbie here and trying to learn about ARM architecture. I have never done something like this before. I'm getting confused because the magic lantern repository is like 100x bigger than what i did in the past.


73: 28394.530 [CAPE] HivshdReadEDmacCompleteCBR
     74: 28425.826 [CAPE] Image Addr(CH=2)=0x6392700(0x46390064)
     75: 28425.839 [CAPE] TOPV=1, BTMV=3720, CRAW WIDTH=9884
     76: 28426.205 [CAPE] WB Integ Addr(CH=15)=0x2c3f904(0x42c3f904)
     77: 28426.220 [CAPE] OHYEAR MID Addr(CH=14)=0x2c41b04(0x42c41b04)
     78: 28426.286 [CAPE] FencDmac Addr(CH=18)=0x2c59c84(0x42c59c84)
     79: 28524.534 [CAPE] FencingWriteEDmacCompleteCBR
     80: 28524.547 [CAPE] WbDetectionPathCompleteCBR
     81: 28524.590 [CAPE] HivshdVReadEDmacCompleteCBR
     82: 28524.754 [CAPE] CCDWriteEDmacCompleteCBR
     83: 28525.042 [CAPE] DefmReadEDmacCompleteCBR
     84: 28525.057 [CAPE] Defm2ReadEDmacCompleteCBR
     85: 28525.071 [CAPE]  Image Addr(CH=2)=0x86a31e0(0x0)
     86: 28525.083 [CAPE]  FencDmac Addr(CH=18)=0x2cefc84
     87: 28525.094 [CAPE]  WB Integ Addr(CH=15)=0x2c41704
     88: 28525.105 [CAPE]  OHYEAR MID Addr(CH=14)=0x2c56704
     89: 28539.870 [COL] ./LensCorrect/GetLensCorrectionData.c 3185
     90: 28637.636 [SHTSS] SHT_SSDEVELOP_PATH_CORE_InitRawToYuv
     91: 28638.082 [SHTSS] SHT_SSDEVELOP_PATH_CORE_RegisterCompleteRawToYuvCBR
     92: 28638.093 [SHTSS] SHT_SSDEVELOP_PATH_CORE_SetRawToYuv
     93: 28638.158 [SHTSS] SHT_SSDEVELOP_PATH_CORE_StartRawToYuv
     94: 28638.197 [SHTSS] SHT_SSDEVELOP_PATH_CORE_SetAddressRawToYuv Addr[0x55938000]
     95: 28638.222 [SHTSS] SHT_SSDEVELOP_PATH_CORE_RegisterCompleteMem1ToRawCBR
     96: 28638.234 [SHTSS] SHT_SSDEVELOP_PATH_CORE_SetMem1ToRaw
     97: 28638.453 [SHTSS] SHT_SSDEVELOP_PATH_CORE_StartMem1ToRaw
     98: 28743.401 [SHTSS] Mem1ToRawCompleteCBR
     99: 28743.567 [SHTSS] SHT_SSDEVELOP_PATH_CORE_StopMem1ToRaw
    100: 28743.678 [SHTSS] SHT_SSDEVELOP_PATH_CORE_UnregisterCompleteMem1ToRawCBR
    101: 28774.155 [SHTSS] RawToYuvCompleteCBR 2
    102: 28789.272 [SHTSS] RawToYuvCompleteCBR 1
    103: 28789.625 [SHTSS] SHT_SSDEVELOP_PATH_CORE_StopRawToYuv
    104: 28791.204 [SHTD]SHT_DEVELOP_PATH_CORE_RegisterJpegCompleteCBR
    105: 28791.215 [SHTD]SHT_DEVELOP_PATH_CORE_SetJpegPath
    106: 28791.549 [SHTD]SHT_DEVELOP_PATH_CORE_StartJpegPath Addr[0x55938000]
    107: 28898.087 [SHTD]JpegPathDivCompleteCBR
    108: 28898.138 [SHTD]JpegPathCompleteCBR Size=0x3388ba Err=0x0
    109: 28898.395 [SHTD]SHT_DEVELOP_PATH_CORE_StopJpegPath
    110: 28898.605 [SHTD]SHT_DEVELOP_PATH_CORE_UnregisterJpegCompleteCBR
    111: 28902.045 [SHTD]SHT_DEVELOP_PATH_CORE_RegisterDcfCompleteCBR
    112: 28902.056 [SHTD]SHT_DEVELOP_PATH_CORE_SetDcfPath
    113: 28902.348 [SHTD]SHT_DEVELOP_PATH_CORE_StartDcfPath Addr[0x5a848000]
    114: 28904.221 [SHTD]DcfPathCompleteCBR Size=0x30ac Err=0x0
    115: 28904.294 [SHTD]SHT_DEVELOP_PATH_CORE_StopDcfPath
    116: 28904.363 [SHTD]SHT_DEVELOP_PATH_CORE_UnregisterDcfCompleteCBR
    117: 28905.273 [SHTD]SHT_DEVELOP_PATH_CORE_RegisterJpegCompleteCBR
    118: 28905.283 [SHTD]SHT_DEVELOP_PATH_CORE_SetJpegPath
    119: 28905.612 [SHTD]SHT_DEVELOP_PATH_CORE_StartJpegPath Addr[0x55938000]
    120: 29012.148 [SHTD]JpegPathDivCompleteCBR
    121: 29012.183 [SHTD]JpegPathCompleteCBR Size=0xa8697f Err=0x0
    122: 29012.278 [SHTD]SHT_DEVELOP_PATH_CORE_StopJpegPath
    123: 29012.387 [SHTD]SHT_DEVELOP_PATH_CORE_UnregisterJpegCompleteCBR
    124: 29013.090 [SHTD]SHT_DEVELOP_PATH_CORE_RegisterDcfCompleteCBR
    125: 29013.100 [SHTD]SHT_DEVELOP_PATH_CORE_SetDcfPath
    126: 29013.364 [SHTD]SHT_DEVELOP_PATH_CORE_StartDcfPath Addr[0x5a848000]
    127: 29015.238 [SHTD]DcfPathCompleteCBR Size=0x30ac Err=0x0
    128: 29015.301 [SHTD]SHT_DEVELOP_PATH_CORE_StopDcfPath
    129: 29015.372 [SHTD]SHT_DEVELOP_PATH_CORE_UnregisterDcfCompleteCBR
    130: 29376.446 [SHTAECA]CapSetSize(1536,37)
    131: 29376.463 [SHTAECA]CapSetAddr(CH=2)=0xeb74000(0x4eb74000)
    132: 29417.384 [SHTAECA]AeCapCCDComp:(0/1)
    133: 29417.989 [SHTAECA]CapSetSize(1536,729)
    134: 29418.005 [SHTAECA]CapSetAddr(CH=2)=0xeb82400(0x4eb82400)
    135: 29418.123 [SHTAECAL]SHTAE_AECALC_PATH_CORE_GetBVRoutine2
    136: 29418.139 [SHTAECAL]pAEIntegAddrs is NULL
    137: 29420.585 [SHTAECAL][AE] BV 458 BV_ave 446 ETTLBV 456 FG289
    138: 29424.380 [SHTAECAL]SHTAE_AECALC_PATH_CORE_CalculateWhiteSearch_AlphaValue
    139: 29435.450 [SHTAECA]AeCapCCDComp:(0/3)
    140: 29435.463 [SHTAECA]AeCapShadeComp:(1/3)
    141: 30344.914 [CAPE] HivshdReadEDmacCompleteCBR
    142: 30372.940 [CAPE] Image Addr(CH=2)=0x13622700(0x53620064)
    143: 30372.953 [CAPE] TOPV=1, BTMV=3720, CRAW WIDTH=9884
    144: 30373.315 [CAPE] WB Integ Addr(CH=15)=0x2c3f904(0x42c3f904)
    145: 30373.330 [CAPE] OHYEAR MID Addr(CH=14)=0x2c41b04(0x42c41b04)
    146: 30373.397 [CAPE] FencDmac Addr(CH=18)=0x2c59c84(0x42c59c84)
    147: 30471.660 [CAPE] FencingWriteEDmacCompleteCBR
    148: 30471.672 [CAPE] WbDetectionPathCompleteCBR
    149: 30471.717 [CAPE] HivshdVReadEDmacCompleteCBR
    150: 30471.882 [CAPE] CCDWriteEDmacCompleteCBR
    151: 30472.164 [CAPE] DefmReadEDmacCompleteCBR
    152: 30472.179 [CAPE] Defm2ReadEDmacCompleteCBR

Got this while recording the video


Update: Seems like 4 log commands reveals 6 file, 4 is almost empty and 2 are fill with goodies

After playing around, I noticed that video seems to not output any log (the log above is for still photo) and the log start to have something when you fill the buffer during continuous shot. This make me believe that I'm currently thinking that the log seems to be from the secondary processor.


It should save a file named DEBUGMSG.LOG (and maybe also ROM and RAM dumps, if you uncomment them in minimal-d678.c). Double-checked the dump_file stub - it only saves on the B:/ drive. That's the SD card on most models.


It only dump the first one second, which is useless. File size seems to be limited to 2048KB, which only contain interrupts and boot sequence.


Actually it *skips* the first second, and logs the next 1.5 seconds. Still, it's quite useful.

What's interesting, and different from the original 7D - the main CPU core receives MPU messages directly. That's good for us!

You can play with logging options, for example, skip the interrupts. That will cover some more seconds of the startup process, in these 2048KB, but of course it will be less detailed.

Next - enable CONFIG_MARK_UNUSED_MEMORY_AT_STARTUP, find possibly unused memory areas and enable early logging. That should cover the entire startup process. I believe the 7D2 has only 512MB visible from the main CPU; maybe there's some more accessible by some other means?


OK, I will do that after the long holiday here in Thailand. I think it's 512MB for each CPU because it has similar buffer size to 80D (why they would put half memory on higher end camera) and taking sequence of continuous shot reveals half of JPEG processing log compared to number of images, that means other half is processed by another CPU?


1.723282     Startup:fe18ba5b:2f:05: ### MovieRecorder:ddec1c:11:fe18940f:1
1.723487  MovieRecor:fe189443:2f:02: RecEvent 0[0->1]
1.723519  MovieRecor:fe189485:2f:02: RlyEvent 0[0->1]
1.723568     PropMgr:fe18ada1:2f:03: mvrResultCBR : 0xddf50c
1.723637     PropMgr:fe18af29:2f:03: mvrChangeAckCBR : PROP_USBDEVICE_CONNECT(-1)
1.723674     PropMgr:fe18b543:2f:05: mvrChangeAckCBR : Video - Mode=0,Type=0,Rate=5994,GOP=30,St=3
1.723732     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : Sound Manual(C=2,R=48000,B=16)
1.723758     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : AE_MODE(3)
1.723775     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : ISO(104)
1.723806     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : BodyID = 0x08,0xda3a7746
1.723877     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : RecCount = 0x7a5
1.723913     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : ModelID = 0x80000289
1.724021     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : MOVIE_REC_VOLUME(L:54 R:54)
1.724072     PropMgr:fe18b4dd:2f:03: mvrChangeAckCBR : WindCut On
1.724111     PropMgr:fe18b543:2f:03: TimeCode Mode:1
1.724153     PropMgr:fe18b543:2f:03: TimeCode DropFrame Mode:0
1.724184     PropMgr:fe18b543:2f:03: PROP_FILE_PREFIX:8J8A
1.724221     PropMgr:fe18b543:2f:03: PROP_USER_FILE_PREFIX:KSTH,
1.724255     PropMgr:fe18b543:2f:03: PROP_USER_FILE_PREFIX:KS_,
1.724291     PropMgr:fe18b543:2f:03: PROP_SELECTED_FILE_PREFIX:KSTH,1
1.724322     PropMgr:fe18b543:2f:03: PROP_CARD1_CLUSTER_SIZE:32768
1.724353     PropMgr:fe18b543:2f:03: PROP_CARD2_CLUSTER_SIZE:32768
1.724384     PropMgr:fe18b543:2f:03: PROP_CARD3_CLUSTER_SIZE:0
1.724441     PropMgr:fe18b4dd:2f:03: mvrChangeAckCBR : Attenuator Off
1.724475     PropMgr:fe18b543:2f:03: mvrChangeAckCBR : TimeLapse = 0x0
1.724648     PropMgr:fe18ad83:2f:01: mvrStateResultCBR : 0xddf778

Turned interrupt off. Got something interesting about the video, can we change parameter to improve video quality?

Full Log



I did some test regarding the buffering of 7D Mark II. I went out to shoot the timelapse and noticed that if I set resolution to mRAW (4104 x 2736) with 6fps burst rate, then I can shoot until my 32gb 90MB/s SD card filled. I noticed that in the mRAW file, there is L-Fine JPEG attached (full sensor resolution) and total file size for each mRAW frame was 16.3MB at ISO 100 and seems like the card is the bottleneck. If we managed to port magic lantern onto this camera, can we turn off JPEG preview, reduced bit depth to 10 bit, recording to CF and hope for 4K 24fps video? or the sensor readout rate will be the next bottleneck? Just wanna know from your experience and what to expect.

Walter Schulz

Generatlly speaking i have the feeling most devs expect to cross a bridge when they come to it.
I remember a1ex writing about his experiences with m/sRAW and almost bricking his cam permanently, though.


Interesting, can you link to it? so that maybe I can learn more about porting.

Walter Schulz

Quote from: KenSoftTH on April 12, 2019, 07:23:23 PM
Interesting, can you link to it?

Home Help Search -> Advanced search, sraw, user a1ex ...


That was about m/sRAW on unsupported models (Rebel cameras). This option was made available in a fork of ML, and it resulted in corrupted images (i.e. data lost). Users were also unable to switch back to plain RAW without clearing Canon settings.

This is why I'm reluctant to play with certain settings - because I had trouble with them (and in some case I had to find out how to restore a soft-bricked camera). These things didn't result in permanent camera damage, but still, it wasn't funny to clean up the mess done by others.

However, the question was about maximum frame rate; in this case, the sensor readout speed is going to be the first bottleneck. If you can't capture the frames fast enough, it doesn't make sense to worry about compression, card writing speed and other stuff like that. So, let's find out the frame rate for full resolution capture.

From 0xFE32B0F6 VSizeSetting, I can tell it's reading out 3720 lines in 83 ms, so the theoretical limit would be about 12 fps at full resolution. Raw resolution registers seem to be:

0xD0006800: 0x0001000f  ; (x0, y0)
0xD0006804: 0x0e8802d1  ; (x1, y1)

Lower half is X divided by number of channels, higher half is Y (on most models it's not divided by anything). Effective resolution (from wikipedia) is 5472 × 3648. From the above values, readout size must be 5648 x 3719, using 8 channels (i.e. 8 columns read out in parallel). TODO: cross-check with a full CR2 size (dcraw -i -v).

FPS timer A (from register 0xD0006008) appears to be 0x305, i.e. 774 units (as the hardware register is programmed with N-1). One line is read out in 22.3 microseconds. That means, main FPS clock must be... 774 / 22.3 = 34.7 MHz ?!

Timer B is close to 3720, likely 0xE8B = 3724 units (from VSizeSetting). Cross-checking: 34.7 MHz / 3724 / 774 = 12.04 FPS.

That means, in theory, maximum resolution at 24p might be about 5472x1700 (or something close). Or, maybe 4096x2200 with 1.33x crop. That doesn't guarantee we can actually figure out how to achieve these; they are just theoretical figures.

Still, the clock value is quite unusual, so... let's check the actual timer values used by the camera. For the above numbers, I've only grepped the ROM for known registers and looked for values that seemed to make sense.

To confirm my theory, try to capture a diagnostic log while capturing a still image. It should contain 0xD0006008, 0xD0006014, 0xD0006800 and 0xD0006804 (among others). Something along these lines:

msleep(5000); // wait for camera to start
call("Release"); // take a picture (happens in background)
msleep(2000); // wait for the picture to be captured

Also try to capture the values of the above registers while *entering* LiveView, at known frame rates (24, 25, 30 and so on). That is, start logging just before entering LiveView, and stop it 2-3 seconds after entering.


is the clock of 34.7 MHz high? and how is it compared to 5D Mark III and 80D?


Hey a1ex,
sorry for the delay, here's the value.

0xD0006008 0x3050305
0xD0006014 0xffff
0xD0006800 0x6000a
0xD0006804 0x640006a

full log


Entering Live View and only Address 6014 was found, which is inconclusive

Recording at 720p59.94 gives

5.403438         Evf:000134a7:91:01: [REG] Total:2
5.403454         Evf:0001448f:91:01: [0](0xd0006014),(0x2f9)
5.403471         Evf:0001448f:91:01: [1](0xd0006024),(0x2f9)
5.403488         Evf:0001448f:91:01: [2](0xd0006000),(0x1)

UPDATE: Full 720p59.94 Log


Used live view RAM dump method from 80D thread


matrix movie explained


@a1ex, please guide me what to do next


Great job!
7D MKII is a nice camera for shotting Raw video.


Bump. Can someone help me out?


Didn't see that. Thank you for letting me know.


Watching patiently....
"eventually" we will have a build....
Vancouver, B.C. (retired)