Author Topic: Canon 40D  (Read 333781 times)

Theta Sigma

  • New to the forum
  • *
  • Posts: 17
  • It's about time
Re: Canon 40D
« Reply #525 on: April 21, 2020, 09:35:34 PM »
But the future ? there are so many cameras that are interessing, I can't
say were I want to go after 40d, we will see, but im only interessed in cameras that is missing ML. For now it's the 40d
(and properly helping 1300D users abit).

You don't mean there's already a version of ML that works on the 80D, do you?

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #526 on: April 22, 2020, 03:15:47 AM »
You don't mean there's already a version of ML that works on the 80D, do you?
No. My point was that the next camera i buy next should not have a working ml, but there are alot og those.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

JackV88

  • New to the forum
  • *
  • Posts: 3
Re: Canon 40D
« Reply #527 on: May 01, 2020, 01:18:18 PM »
There is the possibility to show the procedure to download and install on the memory card with a tutorial on YouTube, for those like me who have not understood anything? (I'm Italian and I don't know English well  :-[

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 7487
Re: Canon 40D
« Reply #528 on: May 01, 2020, 04:56:27 PM »
Reply #485
Reply #513

JackV88

  • New to the forum
  • *
  • Posts: 3
Re: Canon 40D
« Reply #529 on: May 01, 2020, 05:45:56 PM »
I don't understand your answer.

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 7487
Re: Canon 40D
« Reply #530 on: May 01, 2020, 05:49:53 PM »
Youtube tutorial linked in reply #485
Download linked in reply #513

kidkoala83

  • New to the forum
  • *
  • Posts: 4
Re: Canon 40D
« Reply #531 on: May 04, 2020, 05:13:03 PM »
Im trying to run the 40d dump from my camera in qemu-eos but is not working, it goes in a loop, does it work for you guys? It seems to boot though..
Also manage to get the Magic Lantern boot screen with boot=1 option.
Is it maybe the wrong approach and is the heder magic lantern that I should try and run in qemu?
Do I need to compile magic lantern 40d in some special way for qemu? Or will the last heder build run in it and no need to compile myself?
How do I run the build?
I'm stuck at this point, I want to try and help, but i'd like to load the software in qemu before trying it on my camera.
Any help appreciated, thanks.
Also would like to say thanks and hurray to heder for pushing forward the 40d, been following this thread 10 years and tried to do it myself lol, just not skilled enough. Following your footsteps and learning along the way. :)

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #532 on: May 05, 2020, 11:32:03 AM »
Im trying to run the 40d dump from my camera in qemu-eos but is not working, it goes in a loop, does it work for you guys? It seems to boot though..
Also manage to get the Magic Lantern boot screen with boot=1 option.
Is it maybe the wrong approach and is the heder magic lantern that I should try and run in qemu?
Do I need to compile magic lantern 40d in some special way for qemu? Or will the last heder build run in it and no need to compile myself?
How do I run the build?
I'm stuck at this point, I want to try and help, but i'd like to load the software in qemu before trying it on my camera.
Any help appreciated, thanks.
Also would like to say thanks and hurray to heder for pushing forward the 40d, been following this thread 10 years and tried to do it myself lol, just not skilled enough. Following your footsteps and learning along the way. :)

Hi kidkoala83

I will do my very best to help you with qemu, but QEMU and 40D is a difficult combination, it might just be my "server" pc, but I know even a1ex says is it doesnt run that well. That does not mean it a dead end, no..  you just got to find the right balance. I can not tell you what the specific QEMU issues are, but my feeling are these issues are a combination cf timing and gfx timing which causes the simulator to stop. None have the time to fix this in QEMU, so a workaround is the best option. QEMU runs fine with only the ROM files (i.e. no magic lantern). I did however have a lot of issues with keyboard mapping, but I guess that my mini "server" that was odd (acer revo @atom dual core) with danish keyboard.

Getting magic lantern to run on my pc in QEMU required some additional steps, in order to get past the cf timing and gfx issues. These workarounds are not bullet proof, you will get a lot of situation here QEMU stops anyway, 2-4 crashes for each good run.

Graphic timing.
To get a good gfx timing, I have tryed to compile QEMU with all the different gfx layers which are compatible with QEMU. The very best was running QEMU using VNC connecting. Normally you'd use VNC to connect to a different server/pc, but you can also run QEMU on your pc/server display, displaying the QEMU windows on your screen. After you start QEMU (in VNC mode) there will be a small delay before the actual QEMU windows show up, this delay is the "workaround". You can also run QEMU with no gfx/window and it will run even better - but useless without a display. You will need to configure QEMU and recompile with --enable-vnc --enable-sdl  and .. remeber to install a vnc server on your pc. Alternatively try sdl.

Cf card issues.
The cf card issues are quite annoying. As you compile ML and run QEMU simulations the cf card loopback (cf.img) will slowly become messed up ("fsck" will find a lot of strange and non existing files) and when the card is too messed up, QEMU will not run ML at all. The only workartound I could find was to remove ALL files from the cf card and run fsck on the cf.img until all reported errors was gone, then I made clean cf.img into my master image. Everytime I compiled a new ML version I would delete the cf.img, and make a copy of the clean master cf.img and copy the files into that one. Lots of additional steps, but needed.

Scripts:
https://bitbucket.org/jmheder/magic-lantern/downloads/qemu-scripts.zip
I have put some of the script I have used on bitbucket -  my primary command is called "go_command.sh".

You will known that QEMU is running successfully when the console is emitting text constantly (due to inter communication between the digic 3 and mpu - I think). If the console stops then hit break+c and retry, do that until you get an success. I have had good days where QEMU + ML worked all the time, and bad days where I had 9 crashes before I got lucky.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #533 on: May 05, 2020, 02:41:03 PM »
double post  :o
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #534 on: May 05, 2020, 03:39:44 PM »
When everything is working in QEMU (magic lantern loaded) the text that should be written (spammed) into the console by QEMU is:

Code: [Select]
Lockdown read 2
FF819A28: MRC p15,3,Rd,cr15,cr2,0:  DcacheTag -> 0x0
FF819A34: MCR p15, ...          : CACHEMAINT x1 (omitted)
FF819A34: MCR p15,3,Rd,cr15,cr0,0: CacheDbgIdx <- 0xC0000780
Lockdown read 2
FF819A28: MRC p15,3,Rd,cr15,cr2,0:  DcacheTag -> 0x0
FF819A28: MCR p15, ...          : CACHEMAINT x1 (omitted)
FF819A28: MCR p15,3,Rd,cr15,cr0,0: CacheDbgIdx <- 0xC00007A0
Lockdown read 2
FF819A28: MRC p15,3,Rd,cr15,cr2,0:  DcacheTag -> 0x0
FF819A28: MCR p15, ...          : CACHEMAINT x1 (omitted)
FF819A28: MCR p15,3,Rd,cr15,cr0,0: CacheDbgIdx <- 0xC00007C0
Lockdown read 2
FF819A28: MRC p15,3,Rd,cr15,cr2,0:  DcacheTag -> 0x0
FF819A34: MCR p15, ...          : CACHEMAINT x1 (omitted)
FF819A34: MCR p15,3,Rd,cr15,cr0,0: CacheDbgIdx <- 0xC00007E0
Lockdown read 2
FF819A28: MRC p15,3,Rd,cr15,cr2,0:  DcacheTag -> 0x0

If you get the magic lantern to run (press delete button) but text is missing, PM me and tell me text in QEMU is missing, I have not worked with QEMU since januar.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

kidkoala83

  • New to the forum
  • *
  • Posts: 4
Re: Canon 40D
« Reply #535 on: May 06, 2020, 10:13:17 AM »
As it turns out the canon dump was working on qemu, my terminal screen was printing what you posted, I was just not pushing the right buttons, when i pushed menu (M key) and I saw the canon interface couldn't believe it.
Now I got to play a bit more with it and run/load the 40d magic.
When I press backspace key (delete button?)  nothing seems to happen, I've tried also D key for direct printing, how do I load the magic lantern?
Hopefully at some point I might be able to do some debugging and/or find some calls and stubs to help your effort.

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #536 on: May 06, 2020, 11:22:40 AM »
As it turns out the canon dump was working on qemu, my terminal screen was printing what you posted, I was just not pushing the right buttons, when i pushed menu (M key) and I saw the canon interface couldn't believe it.
Now I got to play a bit more with it and run/load the 40d magic.
When I press backspace key (delete button?)  nothing seems to happen, I've tried also D key for direct printing, how do I load the magic lantern?
Hopefully at some point I might be able to do some debugging and/or find some calls and stubs to help your effort.

Good to hear QEMU is running with the ROM files, when you just need to last steps. Regarding ML+QEMU, You need to check and verify the following:

1. Do ensure keys are correct, load only ROM files, boot = 0, and verify that
   pressing P key will give you an "No Image" text screen.
   pressing W will give you picture settings
   pressing I will give you the information overview
   
2. Did you mount the cf.img image as a loopback device and copy ML files onto that ? (use mtools to do that or look in my scripts)

3. Did you start QEMU with boot option = 1 (i.e. load magic lantern) ? I use my own command for starting qemu, here is my with SDL (alternativly look in my scripts).

Code: [Select]
qemu-2.5.0/arm-softmmu/qemu-system-arm -drive if=ide,format=raw,file=cf.img -chardev socket,server,nowait,path=qemu.monitor,id=monsock -mon chardev=monsock,mode=readline -sdl -name 40D -M 40D,firmware=boot=1
4. Analyse the output from QEMU console, with boot=1 you should find the follow text early on in the QEMU startup sequence (yes the text is red and hard to read on some monitors!)

CF LOAD OK.
Open file for read : AUTOEXEC.BIN
Now jump to AUTOEXEC.BIN!!


5. If everything is ok, you should press the delete button twice to get into the menus.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #537 on: May 08, 2020, 11:43:30 PM »
One step closer to a fully working mlv_lite. Finally got mlv_lite and edmac running, that was quite complex to figure out. Raw video transfering was done with edmac 4, and after that I "stole" edmac 4 for internal mlv_lite memory copy operations, but this failed because edmac 4 was not initialized completely on each frame transfer. So after mlv_lite used edmac 4 once, the next raw transfer failed. Edmac 3 is used to perform multiple transfers by canon which means it gets fully initialized on each transfer, so using that gave me a success (few frames, but it worked). Now I just need to figure out which edmac is the best to use, aka. which is used less and at the same time gets fully initialized on each use - there is no free write edmac so we need to steal one temporary. Dual buffering is also working now.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #538 on: May 17, 2020, 12:01:47 AM »
The mlv_lite it running now (x1), Stole and hijacked write edmac-5 (whitebalance) and then everything worked. I now have a raw mlv videos files created with the 40D, the build is absolutly bleeding egde. I still have a couple of problems left to solve.
  • Frame order is incorrect, now this is normal, but mlv_dump / MLVApp won't correct it, might be a timestamp issue.
  • Changing the CF timing should give me 20 mb/s - but the FIO write file system has a huge penalty when saving smaller files and the 20 mb/s is only reached when the buffer are minimum 8 mb, currently I only get like 13 mb/s save speed. Thus i suspect mlv_lite of using smaller buffers
  • I don't get the recording icon because the thread that would call and write this icon, does not call mlv_lite


Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

kidkoala83

  • New to the forum
  • *
  • Posts: 4
Re: Canon 40D
« Reply #539 on: May 30, 2020, 11:42:16 PM »
Ok. I finally got to emulate Magiclantern 40d on qemu-eos. If anyone is following that process you need to use mount.sh script within qemu-eos to mount cf.img (It's the virtual compact flash), so you can copy the ML files in it, otherwise you get permission issues, also but not least the key to launch ML menu in some computers is Supr instead of Del, just saying cause that bit got me stuck for a while.
When i have time i'll play a bit with the ML menu and see where to go from there, once more thanks to everyone that made it posible.

names_are_hard

  • Contributor
  • Senior
  • *****
  • Posts: 269
  • 200D idiot
Re: Canon 40D
« Reply #540 on: May 31, 2020, 12:30:51 AM »
Well done getting it working!

If you want to mount the card images directly in the future, you need to be root / use sudo, and the mount command is a bit weird.  It's like this for me on Linux:
mount -o loop,offset=50688 /home/user/code/magiclantern/qemu-eos/cf.img /mnt/

You can then modify however you want, unmount, and a normal user can run qemu and it will see the filesystem changes.

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #541 on: May 31, 2020, 01:03:12 PM »
Ok. I finally got to emulate Magiclantern 40d on qemu-eos. If anyone is following that process you need to use mount.sh script within qemu-eos to mount cf.img (It's the virtual compact flash), so you can copy the ML files in it, otherwise you get permission issues, also but not least the key to launch ML menu in some computers is Supr instead of Del, just saying cause that bit got me stuck for a while.
When i have time i'll play a bit with the ML menu and see where to go from there, once more thanks to everyone that made it posible.

Good work, thumbs up, the qemu and 40D hard to get running correctly, and there so much left to do on the 40D, just to mention a few (assuming you use my branch)

* many modules missing
* few stubs missing (1st memory job function not found)
* auto exposure value not detected
* half shutter not detected :(
* free malloc memory pointer missing (= I have hardcoded it to some static value atm)
* lots of properties not aligned
* and the big task ... digic 3 <=> digic 4 software abstraction layer (~ i.e. make the 40D act like a digic 4 camera)
* zebras in liveview missing
* global draw (zebras,histogram) not shown in photo mode (= crash)
* lots of other stuff I forgot
* ...

And remember to have fun, no stress  :D.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #542 on: June 22, 2020, 10:01:22 AM »
Updated open beta to 1.0.2

https://www.magiclantern.fm/forum/index.php?topic=1452.msg224594#msg224594

Getting raw video running will take 2-3 month more. I do have  RAW video running, but i have a serious bug and also screwed up photo mode.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #543 on: July 10, 2020, 11:38:47 AM »
Open beta updated to 1.0.3.

https://www.magiclantern.fm/forum/index.php?topic=1452.msg224594#msg224594

Added : halfshutter supported

I simply could not find the halfshutter memory location, and I'm wasting my time, so the simple solution
was to hijack and re-code GUI_E_Control and check of param1==31 (half shutter pressed) and
param1==32 (half shutter unpressed). End of story.

Added : astro module
 
xaint astro module was partly added. The start focus part of the module is enabled and working.
Polar alignment was disabled (drawing is bugged). Tested the star focus part (yesterday) with success.
Had some troubles verifying it because I was using a cheap yongnuo 50mm rather than my telescope, ininity
is'nt ininity on a lens, had to manually move focus back like ½ mm or so.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

names_are_hard

  • Contributor
  • Senior
  • *****
  • Posts: 269
  • 200D idiot
Re: Canon 40D
« Reply #544 on: July 11, 2020, 02:22:57 AM »
Hi Heder :)  Just letting you know you're not talking to yourself.  I really appreciate these documentation posts and think they're a valuable addition to the community.  I always turn them over in my mind and see if they might help me with 200D.

Theta Sigma

  • New to the forum
  • *
  • Posts: 17
  • It's about time
Re: Canon 40D
« Reply #545 on: July 11, 2020, 03:02:49 AM »
Hi Heder :)  Just letting you know you're not talking to yourself.  I really appreciate these documentation posts and think they're a valuable addition to the community.  I always turn them over in my mind and see if they might help me with 200D.

Likewise, although I don't have a 200D (Have an 80D though!)  ;D

Thanks Heder. :)

heder

  • Contributor
  • Member
  • *****
  • Posts: 122
  • No time for caution
Re: Canon 40D
« Reply #546 on: July 11, 2020, 06:01:16 PM »
Thanks, to the both og you. I know im not alone and the these beta versions are bring downloaded, so some ppl are using it.
Embedded SW engineer. Current Cameras: Canon 20d, 40d, 350d

Dezmond2

  • New to the forum
  • *
  • Posts: 7
Re: Canon 40D
« Reply #547 on: July 22, 2020, 02:20:31 AM »
expo override temporarily disabled

mrb

  • New to the forum
  • *
  • Posts: 2
Re: Canon 40D
« Reply #548 on: July 22, 2020, 04:22:24 AM »
Hi all, and thanks for the great work. I am just wonder as of this writing where do things stand as far as Video recording on the 40D?

I bought a SD to CF card adapter:

https://www.walmart.com/ip/Red-Slot-Micro-SD-SDHC-SDXC-TF-to-CF-Adapter-Hight-Quality-Micro-SD-to-Extreme-Compact-Flash-Type-I-Card-Converter/404173230?wmlspartner=wlpa&selectedSellerId=18988&&adid=22222222227355251893&wl0=&wl1=g&wl2=c&wl3=441001397692&wl4=pla-915930924658&wl5=9002493&wl6=&wl7=&wl8=&wl9=pla&wl10=125210027&wl11=online&wl12=404173230&veh=sem

and have been using a 16 gb sd card in it:

https://www.amazon.com/Kingston-16GB-microSDHC-Adapter-SDCS2/dp/B07YGZHSJS

This seems to be working well for photos; so I am wondering what the theoretical limits of this kind of arrangement could be for Video capture and when the functionality in any form will be available?

Thank you

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 7487
Re: Canon 40D
« Reply #549 on: July 22, 2020, 08:14:56 AM »
I am just wonder as of this writing where do things stand as far as Video recording on the 40D?
See heder's reply #542

I bought a SD to CF card adapter:

Which are - generally speaking - crap.
Most likely performance is far from modern standards. Should not be a concern with 40D which is - according to heder's experiments - limited to around 20 MByte/s bandwidth.
A more serious problem exists supporting boot from card. Some adapters are not able to act like bootable CF-cards, rendering them pretty useless for Magic Lantern.
You may want to test this with an ML-supported cam hosting CF slot (7D, 5D2, 5D3).

and have been using a 16 gb sd card in it:
https://www.amazon.com/Kingston-16GB-microSDHC-Adapter-SDCS2/dp/B07YGZHSJS

According to Kingston this card should do 45 MByte/s in write mode.

This seems to be working well for photos; so I am wondering what the theoretical limits of this kind of arrangement could be for Video capture and when the functionality in any form will be available?

Take a decent cardreader with CF slot ( www.cameramemoryspeed.com -> Reviews -> Card readers) and do some benchmark runs with tools like CrystalDiskMark (Windows) or Blackmagic Disk Speed Test (macOS).

20 MByte/s translates to around 720p25 for raw/MLV using lossless compression.