UHS-I / SD cards investigation

Started by nikfreak, July 30, 2014, 05:46:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

a1ex

Ran a brute force (random) search for the above registers, and...

SDR104 @ 160MHz 8)


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

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

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


a1ex

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

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

Quote from: a1ex on April 03, 2018, 03:36:38 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

Crossing fingers for stability. Thanks for taking time to achieve this @a1ex. You're awesome.  ;D
[size=8pt]70D.112 & 100D.101[/size]

dfort

Quote from: Levas on April 03, 2018, 03:21:26 PM
Wanted to take a look at the source code, but can't find it ?

Quote from: a1ex on April 03, 2018, 03:36:38 PM
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.

dfort

Stubs for EOSM:

    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


Levas

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

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

Quote from: a1ex on April 03, 2018, 03:36:38 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







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

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
[size=8pt]70D.112 & 100D.101[/size]

OlRivrRat

Amazing Stuff > Any chance that this will work on SL1?
ORR~DeanB  ~~  80D-ML  &  SL1+ML  &  5D2+ML  &  5DC+ML  &  70D+ML(AliveAgain)

Levas

Quote from: nikfreak 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

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

Quote from: a1ex on April 03, 2018, 12:55:26 PM
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

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

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

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

EDIT: wrong link posted.

That's correct one:
hint, hint...
[size=8pt]70D.112 & 100D.101[/size]

dfort

Quote from: OlRivrRat on April 03, 2018, 06:54:27 PM
Any chance that this will work on SL1?

100D stubs - not tested
    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:
    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;
    }

theBilalFakhouri

Holy sh!* , Epic!
I was right when I chose Canon over Nikon, thanks god for that  :)

Quote from: Tony Weller on April 03, 2018, 07:26:33 PM700D
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  :'(

Tony Weller

@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

@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