Author Topic: UHS-I / SD cards investigation  (Read 77193 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12323
  • Emergencies only
Re: UHS-I / SD cards investigation
« Reply #50 on: April 03, 2018, 12:55:26 PM »
Ran a brute force (random) search for the above registers, and...

SDR104 @ 160MHz 8)

Code: [Select]
static uint32_t uhs_regs[]     = { 0xC0400600, 0xC0400604,/*C0400608, C040060C*/0xC0400610, 0xC0400614, 0xC0400618, 0xC0400624, 0xC0400628, 0xC040061C, 0xC0400620 };   /* register addresses */
static uint32_t sdr50_700D[]   = {        0x3,        0x3,                             0x4, 0x1D000301,        0x0,      0x201,      0x201,      0x100,        0x4 };   /* SDR50 values from 700D (96MHz) */
static uint32_t sdr_80MHz[]    = {        0x3,        0x3,                             0x5, 0x1D000401,        0x0,      0x201,      0x201,      0x100,        0x5 };   /* underclocked values: 80MHz = 96*(4+1)/(5+1) */
static uint32_t sdr_120MHz[]   = {        0x3,        0x3,                             0x3, 0x1D000201,        0x0,      0x201,      0x201,      0x100,        0x3 };   /* overclocked values: 120MHz = 96*(4+1)/(3+1) */
static uint32_t sdr_132MHz[]   = {        0x2,        0x2,                             0x2, 0x1D000201,        0x0,      0x100,      0x100,      0x100,        0x2 };   /* overclocked values: 132MHz?! (found by brute-forcing) */
static uint32_t sdr_160MHz[]   = {        0x2,        0x3,                             0x1, 0x1D000001,        0x0,      0x100,      0x100,      0x100,        0x1 };   /* overclocked values: 160MHz = 96*(4+1)/(2?+1) (found by brute-forcing) */

Before and after (5D3 1.1.3):


I'd expect even higher speeds with faster SD cards.

Caveat: SDR104 requires tuning the sampling point (not implemented, not performed by Canon firmware, but doable). That might be required to avoid random errors, speed drops, or higher frequency - if the controller supports it. From 0xC0400610/20, the frequencies are 80, 96, 120, 160 and 240 - the latter is probably too high. Frequency appears tweakable from other registers - if any of you can figure out how to explain the 132MHz preset, that might be helpful for getting other intermediate values.


Download: sd_uhs.mo (same link), to be loaded on top of crop_rec_4k branch (link removed; one SD card died during the experiment).
Source: module_hginfo_dump.sh sd_uhs.mo (sd_uhs branch, based on crop_rec_4k)

Supported models: 5D3 1.1.3/1.2.3, 700D 1.1.5, 6D 1.1.6 (edit: 650D 1.0.4, 100D 1.0.1, 70D 1.1.2, EOS M 2.0.2).
Card must be at least 2GB (not checked).
Porting to other DIGIC 5 models should be as easy as finding the stubs.

Brute-forcing: press shutter halfway during the initial tests, until it starts running some more. Press shutter halfway again to stop (infinite loop).
No guarantees of success, no guarantees of safety, no guarantees of data integrity. You have been warned.

Please post logs and benchmarks.

Tony Weller

  • New to the forum
  • *
  • Posts: 33
Re: UHS-I / SD cards investigation
« Reply #51 on: April 03, 2018, 01:51:24 PM »
Too dumb to work out how to take a screen shot but here is a photo of 700D 1.1.5 ..Sandisk Extreme pro V30 card usually gives 37MBs Write  8)






700D 1.1.5, EOSM 202, 4k_crop_rec 160MHz UHS-1 overclock

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #52 on: April 03, 2018, 01:53:16 PM »
Sandisk extreme class 10 UHS-I - claiming 45mb/s read speed - on 6d
Before hack - Read 44Mb/s Write 41Mb/s
After hack - Read 61Mb/s Write 46Mb/s

Looks like SDR50 @120 Mhz and SDR104 @ 132Mhz are the sweet spot for this SD card




EDIT:
Canon's default on 6d is SDR104@96Mhz

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #53 on: April 03, 2018, 03:21:26 PM »
Source: module_hginfo_dump.sh sd_uhs.mo
Wanted to take a look at the source code, but can't find it ?

Would expect to find it here, what am I doing wrong  ???
https://bitbucket.org/hudson/magic-lantern/src/bb163f78aa6a76d97af777f729d12e32640d5dc8/modules/module_hginfo_dump.sh?at=crop_rec_4k&fileviewer=file-view-default

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12323
  • Emergencies only
Re: UHS-I / SD cards investigation
« Reply #54 on: April 03, 2018, 03:36:38 PM »
Run that command in the terminal.

BTW, how fast is this card in the card reader? The last test might indicate the need for sampling point tuning.

@Tony: Debug -> Screenshot. Also run the card benchmarks from bench.mo (after closing the console).

Sapporo

  • Freshman
  • **
  • Posts: 83
Re: UHS-I / SD cards investigation
« Reply #55 on: April 03, 2018, 03:42:53 PM »
Canon 6D and 64GB Sandisk Extreme Pro UHS-I 95MB/s

2018/04/03 15:37:47
===================
Before the hack: r:44MB/s w:42MB/s  W:42MB/s R:44MB/s  : )  [best 42MB/s]
SDR50 @ 96MHz  : r:44MB/s w:40MB/s  W:42MB/s R:44MB/s  meh [best 42MB/s]
SDR50 @ 96MHz  : r:44MB/s w:43MB/s  W:41MB/s R:44MB/s  : )  [best 43MB/s]
SDR50 @ 80MHz  : r:37MB/s w:35MB/s  W:36MB/s R:37MB/s  meh [best 43MB/s]
SDR50 @ 80MHz  : r:37MB/s w:36MB/s  W:35MB/s R:37MB/s  meh [best 43MB/s]
SDR50 @ 120MHz : r:54MB/s w:53MB/s  W:53MB/s R:55MB/s  : )  [best 53MB/s]
SDR50 @ 120MHz : r:54MB/s w:51MB/s  W:51MB/s R:54MB/s  meh [best 53MB/s]
SDR104 @ 96MHz : r:44MB/s w:40MB/s  W:43MB/s R:44MB/s  meh [best 53MB/s]
SDR104 @ 96MHz : r:44MB/s w:43MB/s  W:41MB/s R:44MB/s  meh [best 53MB/s]
SDR104 @ 80MHz : r:37MB/s w:35MB/s  W:36MB/s R:37MB/s  meh [best 53MB/s]
SDR104 @ 80MHz : r:37MB/s w:36MB/s  W:35MB/s R:37MB/s  meh [best 53MB/s]
SDR104 @ 120MHz: r:54MB/s w:51MB/s  W:52MB/s R:55MB/s  meh [best 53MB/s]
SDR104 @ 120MHz: r:54MB/s w:53MB/s  W:51MB/s R:54MB/s  meh [best 53MB/s]
SDR104 @ 132MHz: r:60MB/s w:58MB/s  W:59MB/s R:60MB/s  : )  [best 58MB/s]
SDR104 @ 132MHz: r:60MB/s w:54MB/s  W:57MB/s R:60MB/s  meh [best 58MB/s]
SDR104 @ 160MHz: r:72MB/s w:69MB/s  W:69MB/s R:72MB/s  : )  [best 69MB/s]
SDR104 @ 160MHz: r:72MB/s w:69MB/s  W:68MB/s R:72MB/s  : )  [best 69MB/s]

Done.
Please run THOROUGH tests before using!!!

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #56 on: April 03, 2018, 03:51:53 PM »
BTW, how fast is this card in the card reader? The last test might indicate the need for sampling point tuning.

In the SD card slot of my computer the card write speeds varies between 44-52Mb/s



nikfreak

  • Developer
  • Hero Member
  • *****
  • Posts: 1139
Re: UHS-I / SD cards investigation
« Reply #57 on: April 03, 2018, 04:42:12 PM »
Crossing fingers for stability. Thanks for taking time to achieve this @a1ex. You're awesome.  ;D
70D.112 & 100D.101

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3740
Re: UHS-I / SD cards investigation
« Reply #58 on: April 03, 2018, 04:43:52 PM »
Wanted to take a look at the source code, but can't find it ?

Run that command in the terminal.

I took a few more steps.

Step 1 - put a copy of the sd_uhs.mo file you downloaded into the magic-lantern/modules directory
Step 2 - navigate your terminal to that directory: "cd ~/magic-lantern/modules"
Step 3 - this runs under crop_rec_4k so switch to that branch: "hg up -C crop_rec_4k" (the "-C" deletes any uncommitted changes)
Step 3 (optional) - you might want to make a new branch e.g.: "hg branch sd_uhs"
Step 4 - run that command, like this: "./module_hginfo_dump.sh sd_uhs.mo > sd_uhs.patch"
Step 5 - now import that patch you just created: "hg import sd_uhs.patch"
Step 6 - clean up files you no longer need: "rm sd_uhs.mo sd_uhs.patch"

Now you've got the source code for the module in your repository ready to compile.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3740
Re: UHS-I / SD cards investigation
« Reply #59 on: April 03, 2018, 05:19:17 PM »
Stubs for EOSM:

Code: [Select]
    if (is_camera("EOSM", "2.0.2"))
    {
        sd_setup_mode       = 0xFF338D40;
        sd_setup_mode_in    = 0xFF338DC8;
        sd_setup_mode_reg   = 1;
        sd_set_function     = 0xFF63EF60;
        SD_ReConfiguration  = (void *) 0xFF641314;
    }

Using a SanDisk Extreme Pro 32GB (the no shutter-bug card)

before


after

5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #60 on: April 03, 2018, 05:24:11 PM »
Thanks Dfort, got the source (sd_uhs.c) on my computer now  :D

And why does everyone here has a quicker card than I have  :P
Waiting for stability reports and then go after a new SD card  ;D

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #61 on: April 03, 2018, 05:46:18 PM »
Modified the module so it skips the 160Mhz, which is better for the card I'm using (Sandisk extreme 64GB 45Mb/s)
Before:


After: (Sorry for the messy screen  :P)

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #62 on: April 03, 2018, 06:25:15 PM »
BTW, how fast is this card in the card reader? The last test might indicate the need for sampling point tuning.
Googling about sampling point tuning.

Has to be done only one time and is card specific right?
@Alex, do you think this could help or could it be that the card is at max at 45Mb/s write speed.
The benchmarks of the others show no need for sampling point tuning   ???

Tony Weller

  • New to the forum
  • *
  • Posts: 33
Re: UHS-I / SD cards investigation
« Reply #63 on: April 03, 2018, 06:27:11 PM »






700D Sandisk V30, wooooooooo does this mean I will be able to do 3k on a 700D ?  :D
700D 1.1.5, EOSM 202, 4k_crop_rec 160MHz UHS-1 overclock

nikfreak

  • Developer
  • Hero Member
  • *****
  • Posts: 1139
Re: UHS-I / SD cards investigation
« Reply #64 on: April 03, 2018, 06:53:50 PM »
Levas if the card is labelled 45Mb/s you alread reached max performance. You will need to get a faster one for e.g. Sandisk Extreme Pro
70D.112 & 100D.101

OlRivrRat

  • Hero Member
  • *****
  • Posts: 524
Re: UHS-I / SD cards investigation
« Reply #65 on: April 03, 2018, 06:54:27 PM »
Amazing Stuff > Any chance that this will work on SL1?
ORR~DeanB  ~~  80D-ML  &  SL1+ML  &  5D2+ML  &  5DC+ML  &  70D+ML(AliveAgain)

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #66 on: April 03, 2018, 07:02:53 PM »
Levas if the card is labelled 45Mb/s you alread reached max performance. You will need to get a faster one for e.g. Sandisk Extreme Pro

The labeled speed on my card is read speed, not write speed as far as I know.
But in this case I also think my card is maxed out at 45Mb/s write speed.

If this stuff is stable enough to record raw video with, I'll be happy looking for a new SD card  :D

From 0xC0400610/20, the frequencies are 80, 96, 120, 160 and 240 - the latter is probably too high.

Anyone already had the balls to try out 240 Mhz  :P

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12323
  • Emergencies only
Re: UHS-I / SD cards investigation
« Reply #67 on: April 03, 2018, 07:10:06 PM »
Press shutter halfway during these tests (until it starts running some more), then let it run overnight on the power adapter, then press shutter halfway again to stop. It will try random changes to these registers, starting from the fastest configuration found. That's an extremely crude version of a genetic algorithm, but it's how I've found the presets above 120MHz (as manual tweaking did not exactly work out of the box).

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1482
  • 6d - Nightly build user
Re: UHS-I / SD cards investigation
« Reply #68 on: April 03, 2018, 07:14:45 PM »
So that's needed to find the 208Mhz for SDR104.
About 100Mb/s should be what we're aiming for, right   :D

Don't have a SD card to test it out, I'll let this over to the people with fast SD cards

EDIT:
Or does it keep/save a log file and can I help with this too ?

Tony Weller

  • New to the forum
  • *
  • Posts: 33
Re: UHS-I / SD cards investigation
« Reply #69 on: April 03, 2018, 07:26:33 PM »
700D
2520x1072
2:35
12 bit lossless
Continuous recording  !!! @58MB/s

Pretty impressive
700D 1.1.5, EOSM 202, 4k_crop_rec 160MHz UHS-1 overclock

nikfreak

  • Developer
  • Hero Member
  • *****
  • Posts: 1139
Re: UHS-I / SD cards investigation
« Reply #70 on: April 03, 2018, 07:43:09 PM »
EDIT: wrong link posted.

That's correct one:
hint, hint...
70D.112 & 100D.101

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3740
Re: UHS-I / SD cards investigation
« Reply #71 on: April 03, 2018, 08:05:46 PM »
Any chance that this will work on SL1?

100D stubs - not tested
Code: [Select]
    if (is_camera("100D", "1.0.1"))
    {
        sd_setup_mode       = 0xFF3355B0;
        sd_setup_mode_in    = 0xFF335648;
        sd_setup_mode_reg   = 1;
        sd_set_function     = 0xFF6530A4;
        SD_ReConfiguration  = (void *) 0xFF655458;
    }

[EDIT] And the rest of the supported Digic 5 cameras -- not tested:
Code: [Select]
    if (is_camera("650D", "1.0.4"))
    {
        sd_setup_mode       = 0xFF334C4C;
        sd_setup_mode_in    = 0xFF334CD4;
        sd_setup_mode_reg   = 1;
        sd_set_function     = 0xFF73FD20;
        SD_ReConfiguration  = (void *) 0xFF7420D4;
    }

    if (is_camera("70D", "1.1.2"))
    {
        sd_setup_mode       = 0xFF33E078;
        sd_setup_mode_in    = 0xFF33E100;
        sd_setup_mode_reg   = 1;
        sd_set_function     = 0xFF7CE4B8;
        SD_ReConfiguration  = (void *) 0xFF7D086C;
    }
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

theBilalFakhouri

  • Contributor
  • Senior
  • *****
  • Posts: 356
Re: UHS-I / SD cards investigation
« Reply #72 on: April 03, 2018, 08:37:14 PM »
Holy sh!* , Epic!
I was right when I chose Canon over Nikon, thanks god for that  :)

700D
2520x1072
2:35
12 bit lossless
Continuous recording  !!! @58MB/s
@Tony Weller

Amazing!
Can you test it with 720p @ 60fps with crop_rec 3x3?
The default write speed in mv720 is lower than mv1080 so let's see what will happen, I hope the camera was with me  :'(
700D 1.1.5 | no more ISOless LV err 8

Tony Weller

  • New to the forum
  • *
  • Posts: 33
Re: UHS-I / SD cards investigation
« Reply #73 on: April 03, 2018, 09:12:01 PM »
@theBilalFakhouri

41.2 MB/s and 47MB/s x5 crop mode record indicator green throughout

Hope that helps, it's not a mode I use but think I did it right 1280x720 @60fps
700D 1.1.5, EOSM 202, 4k_crop_rec 160MHz UHS-1 overclock

theBilalFakhouri

  • Contributor
  • Senior
  • *****
  • Posts: 356
Re: UHS-I / SD cards investigation
« Reply #74 on: April 03, 2018, 09:36:15 PM »
@Tony Weller
Thanks, but I meant set 720p from canon menu and enable crop_rec after loading it, this will gives you 1736x696 @ 60fps Raw video in ML menu, and test it continuous or not  :D
700D 1.1.5 | no more ISOless LV err 8