SD info and benchmarks (was Re: EOS M3 porting) - page 3 - DryOS Development - CHDK Forum  

SD info and benchmarks (was Re: EOS M3 porting)

  • 62 Replies
  • 40813 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #20 on: 14 / April / 2017, 08:36:33 »
Advertisements
@reyalp
Thanks for sharing the results.

I have added logging for the low level SD card routines on the M10 where they are in RAM (to get debug messages for regular operation and errors). This is what I got (from camera start, omitting later card activity):
Code: [Select]
SetSSCG(12,0)s
HWInit(0)s
SWInit(0)s
SetUHSMod(0,1)s
RegPowCF(0)s
CardInit(0)s
GetCrdTyp(0)s
GetCmnReg(0)s
SdGetReg(0)s
GetRUS(0)s
GetSpd(0)s
GetTtlSect(0)s
CrdRd(0,0x5d757e00,0x6acf4c,0x0,-1)s
GetTtlSect(0)s
GetTtlSect(0)s
CrdRd(0,0x5d757e00,0x6acf4c,0x0,-1)s
GetTtlSect(0)s
IsIntWP(0)s
GetTtlSect(0)s
CrdRd(0,0x421bcb00,0x6ace4c,0x0,-1)s
GetTtlSect(0)s
GetAUS(0)s
GetTtlSect(0)s
CrdRd(0,0x421bcd00,0x6ace54,0x0,-1)s
The last 3 values in CrdRd rows may be wrong, but doesn't matter. CardInit seems to be the place where the card is set up.
I'd like to note that there aren't any error messages in the log, so the UHS card is handled silently as non-UHS.


*

Offline Ant

  • *****
  • 509
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #22 on: 20 / April / 2017, 17:56:41 »
The same log from EOS M3.

But it's interesting to view log made with reyalp's "1.8V Support" card.

*

Offline c_joerg

  • *****
  • 1251
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #23 on: 23 / April / 2017, 11:50:46 »
I made 20 serial images in RAW on my M3. All measurements with MF and exposure times <1 / 640s. Here is the distance of the first 4 images 0.3s. Then the distance settles to approx to 1,5s. The RAW pictures are about 33MB, so I come to an average writing speed of 20MB/s. Nearly the same as which gives me CHDK measurement.
The times I have from the timestamp of RAW data which has resolution of 1 / 100s.
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd


*

Offline Ant

  • *****
  • 509
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #24 on: 24 / April / 2017, 17:21:02 »
There is no commands to perform voltage switch:
Code: [Select]
00050: InitFileModules:0x010e7ecd: SetSSCG(12,0)s
00210: InitFileModules:0x010e5f6d: HWInit(0)s
00210: InitFileModules:0x010e5fb7: SWInit(0)s
00210: InitFileModules:0x010e7111: SetUHSMod(0,1)s
00210: InitFileModules:0x010e70e9: RegPowCF(0)s
00210: InitFileModules:0x010e6685: CardInit(0)s
00220: InitFileModules:0x010f038f: [CMD52]=0x80000c08
00230: InitFileModules:0x010ee2db: [CMD0]=0x00000000
00230: InitFileModules:0x010ee2db: [CMD0]=0x00000000
00230: InitFileModules:0x010ee903: [CMD8]=0x000001aa
00230: InitFileModules:0x010f020d: [CMD5]=0x00000000
00230: InitFileModules:0x010f0007: [CMD55]=0x00000000
00230: InitFileModules:0x010eff7f: [CMD41]=0x51100000
00230: InitFileModules:0x010f0007: [CMD55]=0x00000000
00230: InitFileModules:0x010eff7f: [CMD41]=0x51100000
00250: InitFileModules:0x010f0007: [CMD55]=0x00000000
00250: InitFileModules:0x010eff7f: [CMD41]=0x51100000
00250: InitFileModules:0x010ee391: [CMD2]=0x00000000
00250: InitFileModules:0x010ee3d5: [CMD3]=0x00000000
00250: InitFileModules:0x010ee9f1: [CMD9]=0xaaaa0000
00250: InitFileModules:0x010ee8bd: [CMD7]=0xaaaa0000
00250: InitFileModules:0x010f0007: [CMD55]=0xaaaa0000
00250: InitFileModules:0x010f01b1: [CMD51]=0x00000000
00250: InitFileModules:0x010f0007: [CMD55]=0xaaaa0000
00250: InitFileModules:0x010f0045: [CMD6]=0x00000002
00250: InitFileModules:0x010ee489: [CMD6]=0x00ffffff
00250: InitFileModules:0x010ee489: [CMD6]=0x00fffff1
00250: InitFileModules:0x010ee489: [CMD6]=0x80fffff1
00250: InitFileModules:0x010f0007: [CMD55]=0xaaaa0000
00250: InitFileModules:0x010f0145: [CMD42]=0x00000000
00250: InitFileModules:0x010f0007: [CMD55]=0xaaaa0000
00250: InitFileModules:0x010f00a9: [CMD13]=0x00000000
00260: InitFileModules:0x010eedf1: [CMD16]=0x00000200
00260: InitFileModules:0x010e642d: GetCrdTyp(0)s
00260: InitFileModules:0x010e6db5: GetCmnReg(0)s
00260: InitFileModules:0x010e70a7: SdGetReg(0)s
00260: InitFileModules:0x010e721b: GetRUS(0)s
00260: InitFileModules:0x010e78ab: GetSpd(0)s
00260: InitFileModules:0x010e6d45: GetTtlSect(0)s
00260: InitFileModules:0x010e6ae3: CrdRd(0,0x5d677dc0,0x5d677dc0,0x0,0)s
00260: InitFileModules:0x010ed777: [CMD18]=0x00000000
00260: InitFileModules:0x010eeb71: [CMD12]=0x00000000
00260: InitFileModules:0x010ee577: [CMD13]=0xaaaa0000
Maybe somebody found the function which is reading the response from the card?

Still waiting for reayalp's log...

*

Offline reyalp

  • ******
  • 14121
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #25 on: 24 / April / 2017, 22:25:09 »
Still waiting for reayalp's log...
If some posts an example of how these logs are obtained, that would increase the odds of me finding time to do it ;)
Don't forget what the H stands for.

*

Offline Ant

  • *****
  • 509
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #26 on: 25 / April / 2017, 01:37:31 »
This functions are camera specific:
Code: [Select]
void __attribute__((naked,noinline)) sd_debug_printf_0() {
asm volatile(
"push    {r0-r3}\n"
"push.w  {r4-r9,lr}\n"
"push    {r1-r7}\n"
// "sub     sp, sp, #0x44\n"

"mov r7, lr\n"
"ldr     r2, =0x845C\n" // Current time
"ldr     r2, [r2]\n"

"ldr r6, =0x003A0010\n" // Pointer in my debug buffer
"ldr r0, [r6]\n"

"ldr r1, =sstri\n"
"mov r5, r0\n"
"bl sprintf\n"

"add r5, r0, r5\n"


"ldr     r2, =0x803C\n" //Current task name
"ldr     r2, [r2]\n"
"ldr     r2, [r2, #0x24]\n"

"mov r3, r7\n"
"ldr r1, =sstri2\n"
"mov r0, r5\n"
"bl sprintf\n"

"add r0, r0, r5\n"
"str r0, [r6]\n"

"pop    {r1-r7}\n"
"bl sprintf\n"

"ldr r6, =0x003A0010\n"
"ldr r5, [r6]\n"
"add r0, r0, r5\n"
"str r0, [r6]\n"


"pop.w  {r4-r9,lr}\n"
"pop    {r0-r3}\n"
"bx lr\n"

// "ldr pc,=0x010f3fb5\n"

"sstri:\n"
".asciz \"\n%05d: \"\n"
".ltorg\n"

"sstri2:\n"
".asciz \"%s:0x%08x: \"\n"
".ltorg\n"
);
}

void __attribute__((naked,noinline)) sd_debug_cmd() {
asm volatile(

// "mov     r5, r0\n"
// "lsls    r0, r1, #0x1a\n"
// "lsrs    r1, r2, #0x18\n"
// "lsrs    r0, r0, #0x12\n"
// "ldr.w pc,=0x010f1a65\n"

"push    {r0-r3}\n"
"push.w  {r4-r9,lr}\n"

"mov r8, r1\n"
"mov r9, r2\n"
"mov r7, lr\n"
"ldr     r2, =0x845C\n" // Current time
"ldr     r2, [r2]\n"

"ldr r6, =0x003A0010\n"
"ldr r0, [r6]\n"
"str r1, [r6, #0x18]\n"

"ldr r1, =csstri\n"
"mov r5, r0\n"
"bl sprintf\n"

"add r5, r0, r5\n"


"ldr     r2, =0x803C\n" //Current task name
"ldr     r2, [r2]\n"
"ldr     r2, [r2, #0x24]\n"

"mov r3, r7\n"
"ldr r1, =csstri2\n"
"mov r0, r5\n"
"bl sprintf\n"

"add r5, r0, r5\n"

"mov r2, r8\n" //Current CMD
"mov r3, r9\n" //Current CMD argument
"ldr r1, =csstri3\n"
"mov r0, r5\n"
"bl sprintf\n"


"add r0, r0, r5\n"
"str r0, [r6]\n"


"pop.w  {r4-r9,lr}\n"
"pop    {r0-r3}\n"
// "bx lr\n"


"mov     r5, r0\n" // Original code
"lsls    r0, r1, #0x1a\n"
"lsrs    r1, r2, #0x18\n"
"lsrs    r0, r0, #0x12\n"
"ldr pc,=0x010f1a65\n"

"csstri:\n"
".asciz \"\n%05d: \"\n"
".ltorg\n"

"csstri2:\n"
".asciz \"%s:0x%08x: \"\n"
".ltorg\n"

"csstri3:\n"
".asciz \"[CMD%d]=0x%08x\"\n"
".ltorg\n"
);
}

I wonder why you didn't it by yourself...

*

Offline reyalp

  • ******
  • 14121
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #27 on: 25 / April / 2017, 03:15:16 »
I wonder why you didn't it by yourself...
Because I'm lazy, and these things are usually easier with an example.
Don't forget what the H stands for.


*

Offline Ant

  • *****
  • 509
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #28 on: 25 / April / 2017, 17:04:46 »
Overriding S18A bit I've managed to increase my benchmark results:
Code: [Select]
CHDK 1.5.0 r4794
Build date: Apr 25 2017 18:22:00
Camera    : m3 101a
Mode      : 0x204

CPU             :     100 MIPS   
Screen write    :   38068 Kb/s   110 FPS
Viewport read   :    2682 Kb/s     2 FPS
Memory write    :  148945 C,  102400 UC Kb/s
Memory read     :   63627 C,   10691 UC Kb/s
Text drawing    :  18866, 13922 c/s 24, 18 FPS
Card write (RAW):   41575 Kb/s     
Card write (MEM):   42372 Kb/s     
Card write (64k):   12603 Kb/s     
Card read  (64k):   26859 Kb/s   


MEDIA_TYPE_SD:1.8V Support
HighCapacity Support

--------------CID Information--------------
Manufacturer ID       = 0x03
OEM/Application ID    = 0x5344
Product name          = 'SL32G'
Product revision      = '8.0'
Product Serial Number = 0x35A4****
Manufacturing date    = '2015/06'
--------------CSD Information--------------
CSD_STRUCTURE = 1
TAAC = 14
NSAC = 0
max. data transfer rate = 50
CCC:card common classes=1461
READ_BL_PARTIAL=0
read block misalignment = 0,  write block misalignment = 0
DSR implement=0
C_SIZE = 58952
TotalSectors = 60367872
TotalSectors(from CSD) = 0x3992400
ERASE_BLK_EN = 1
ERASE_SCT_SIZE=127, SectorSize = 128
BlockLength = 512
EraseSize = 128
WP_GRP_SIZE = 0
WP_GRP_ENABLE = 0
R2W_FACTOR=2
WRITE_BL_LEN=9
WRITE_BL_PARTIAL=0
copy flag(OTP)=1
Permanent Write Protection=0
Temporary Write Protection=0
File Format Group=0  File Format=0:Hard disk-like file system with partition table
CRC=74
--------------SCR Register--------------
SCR_STRUCTURE = 00h
SD_SPEC_VERS = 02h
DATA_START_AFTER_ERASE = 00h
SD_SECURITY = 03h
SD_BUS_WIDTH = 05h
SD_SPEC3 = 1h
CMD_SUPPORT = 1h
--------------SD Status--------------
DAT_BUS_WIDTH = 2
SECURED_MODE  = 0
SD_CARD_TYPE  = 0x0000
SIZE_OF_PROTECTED_AREA = 0x05000000
SPEED_CLASS   = 0x04 ==> CLASS(10)
PERFORMANCE_MOVE  = 0x00
AU_SIZE       = 0x9
UNIT_OF_ERASE_AU  = 0x000F
ERASE_TIMEOUT = 1
ERASE_OFFSET  = 0x1
EraseSize = 0x2000
UHS_SpeedGrade = 0h (Less than 10MB/sec)
UHS_AuSize = Dh (24MB)
 80 00 00 00 05 00 00 00 04 00 90 00 0F 05 0D 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Wonder why UHS card didn't set this bit in ACMD41 response.
Maybe it already was in 1.8v mode while loading DISKBOOT.BIN ?
« Last Edit: 25 / April / 2017, 17:13:25 by Ant »

*

Offline srsa_4c

  • ******
  • 4451
Re: SD info and benchmarks (was Re: EOS M3 porting)
« Reply #29 on: 26 / April / 2017, 13:36:39 »
Overriding S18A bit I've managed to increase my benchmark results:
Good work. Can you share some details about how you did it?
Quote
Wonder why UHS card didn't set this bit in ACMD41 response.
Maybe it already was in 1.8v mode while loading DISKBOOT.BIN ?
The function call in Startup task that we always remove (the diskboot one) also initializes the card, but probably not in its full performance mode (just so it can access the card and load diskboot.bin, if any). Too bad that we can't log how that works the first time (it would require modified firmware).

Your finding likely means that it's actually CHDK that slows down the card.
Forcing UHS mode is not likely a good solution (not all cards are UHS), we need to find something else. Either resetting the card, or keeping it powered off for some time.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal