[STM32GENERIC] SDIO DMA

Discussions about the STM32generic core
danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: [STM32GENERIC] SDIO DMA

Post by danieleff » Sat Jun 03, 2017 7:32 am

Pito wrote: I do not know whether the slew rate is the only cause of the issue. When browsing sdio stuff with F4 you may see the most recommended setting is the MEDIUM. And that is the only setting which works with Samsung at 24-33MHz here.
The clocks above 33MHz do not work here either, so still it might be a different issue there as well..
May I ask how do you get more than 24Mhz? According to CubeMX F407 SDIO configuration, "...It is advised to keep the default ClockDiv value (0) to have a maximum SDIO_CK frequency of 24 MHz."

ag123
Posts: 811
Joined: Thu Jul 21, 2016 4:24 pm

Re: [STM32GENERIC] SDIO DMA

Post by ag123 » Sat Jun 03, 2017 8:22 am

the little secret here is f4 runs at 240mhz (vs 'official' 168mhz) just as capable as the f7, preferably add some vaporizing liquid nitrogen for stability :lol:
http://www.stm32duino.com/viewtopic.php ... 160#p26942

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SDIO DMA

Post by Pito » Sat Jun 03, 2017 9:46 am

danieleff wrote:
Pito wrote: I do not know whether the slew rate is the only cause of the issue. When browsing sdio stuff with F4 you may see the most recommended setting is the MEDIUM. And that is the only setting which works with Samsung at 24-33MHz here.
The clocks above 33MHz do not work here either, so still it might be a different issue there as well..
May I ask how do you get more than 24Mhz? According to CubeMX F407 SDIO configuration, "...It is advised to keep the default ClockDiv value (0) to have a maximum SDIO_CK frequency of 24 MHz."
You can get almost any SDIO clock, when playing with multipliers and dividers.
Do not use USB but Serial.
For example:
F407_USB_SDIO_FREQ.JPG
F407_USB_SDIO_FREQ.JPG (32.49 KiB) Viewed 329 times
For ag123 as he has got his dewar flask ready
F407_USB_SDIO_FREQ_2.JPG
F407_USB_SDIO_FREQ_2.JPG (38.73 KiB) Viewed 327 times
@Daniel: maybe you have to change the dividers in the basic setup with F407 to
/8, *336, /2, /7
as the 1MHz fed into the PLL does suit the datasheet better..
Last edited by Pito on Sat Jun 03, 2017 3:03 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SDIO DMA

Post by Pito » Sat Jun 03, 2017 10:42 am

This is with Samsung EVO 16GB CL10 and 240MHz_FCPU/34.3MHz_SDIO (all below with the Black F407ZET board):

Code: Select all

File size 5 MB
Buffer size 65536 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
10376.53,27872,5529,6249
10851.28,17714,5529,5971

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
14395.19,6292,4515,4557
14395.19,5229,4515,4543

Done
Type any character to start
This is Samsung and 240/40MHz:

Code: Select all

Type any character to start
FreeStack: 63267
State value (HAL_SD_STATE...): 1
Errorcode value (HAL_SD_ERROR...): 2
R1 value: 100100000000
HAL Return value (HAL_...): 0
C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32DE\libraries\SDIO\src\SDIO.cpp
199
readBlocks
Timeout on Read, over 2000ms
Invalid format, reformat SD.
This is a new Sandisk Ultra 16GB CL10, 240/40MHz:

Code: Select all

File size 5 MB
Buffer size 65536 bytes
Starting write test, please wait.

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
9823.94,39408,5267,6600
10642.60,16345,5266,6081

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
16883.85,4677,3864,3884
16941.28,4074,3865,3876

Done
Type any character to start
And finally the Sandisk at 240/48MHz SDIO:

Code: Select all

Type any character to start
FreeStack: 63267
State value (HAL_SD_STATE...): 1
Errorcode value (HAL_SD_ERROR...): 1
R1 value: 1101100000000
HAL Return value (HAL_...): 1
C:\Users\pito\MyCode\Arduino\hardware\Arduino_STM32\STM32DE\libraries\SDIO\src\SDIO.cpp
119
begin
Can't access SD card. Do not reformat.
SD errorCode: 0X64,0X0
My feeling is it should work at 50MHz SDIO when the Sdcard set to HighSpeed mode (CMD6), and maybe the "gpio loading cell" activated.. We work here with overclocked stuff so the stm experts will not help with that, sure :)
Pukao Hats Cleaning Services Ltd.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SDIO DMA

Post by Pito » Sat Jun 03, 2017 3:48 pm

Sandisk Ultra 16GB CL10, 240/34.3MHz, 1.513GB large file (CRC32 = 06172c89):

Code: Select all

Use a freshly formatted SD for best performance..
*************************************************
Opening the read file..
Opening the write file..
Reading and Writing..
*************************************************
Done in 493254 msecs
*************************************************
Running CRC calculations...
File in CRC:  6172C89
File out CRC: 6172C89
*************************************************
Done in 715025 msecs
Sandisk Ultra 16GB CL10, 240/40MHz, 1.513GB large file (CRC32 = 06172c89):

Code: Select all

Use a freshly formatted SD for best performance..
*************************************************
Opening the read file..
Opening the write file..
Reading and Writing..
*************************************************
Done in 455700 msecs
*************************************************
Running CRC calculations...
File in CRC:  6172C89
File out CRC: 6172C89
*************************************************
Done in 664786 msecs
:ugeek:
Note: Results highly experimental! Do not expect it will work reliably at these settings yet, usually you will get above errors..
Last edited by Pito on Sat Jun 03, 2017 4:26 pm, edited 4 times in total.
Pukao Hats Cleaning Services Ltd.

zmemw16
Posts: 1494
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: [STM32GENERIC] SDIO DMA

Post by zmemw16 » Sat Jun 03, 2017 4:21 pm

any chance of printing the split times separately for the read and write operations?

another - for us plodders with 8MHz and/or 25MHz boards, any chance of a bullet proof slower/much slower set of files ?
some of us don't have the go faster stripes, just your basic blue cz ministm32 f103vet/zet, black 407vet/zet/zgt :roll:
srp

victor_pv
Posts: 1750
Joined: Mon Apr 27, 2015 12:12 pm

Re: [STM32GENERIC] SDIO DMA

Post by victor_pv » Sat Jun 03, 2017 5:19 pm

Pito wrote:My feeling is it should work at 50MHz SDIO when the Sdcard set to HighSpeed mode (CMD6), and maybe the "gpio loading cell" activated.. We work here with overclocked stuff so the stm experts will not help with that, sure :)
Did you add the CMD6 code? I started writing it but didn't finish, I believe I left at sending the command but still needs to read the response data back.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SDIO DMA

Post by Pito » Sat Jun 03, 2017 5:34 pm

For experimental purposes the High speed mode with CL10 card is set as follows (in slow clock mode):
1. issue the CMD6 with the argument 0x80000001

Code: Select all

SDMMC_CmdSwitchFunction(SDIO, 0x80000001);
2. read dummy 64 bytes off the card
3. issue 1 dummy read
4. now the card is in HS mode.
If you may tell me how it should be done with HAL I will try..
Last edited by Pito on Sun Jun 04, 2017 9:15 am, edited 2 times in total.
Pukao Hats Cleaning Services Ltd.

ag123
Posts: 811
Joined: Thu Jul 21, 2016 4:24 pm

Re: [STM32GENERIC] SDIO DMA

Post by ag123 » Sat Jun 03, 2017 9:17 pm

Wow, 16 MB per secs & it copies 1.5GB in below 8 & 1/3 minutes, fast ethernet definitely cannot catch up u'd need USB 2.0 *high speed* to transceive with the host :lol:

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: [STM32GENERIC] SDIO DMA

Post by Pito » Tue Jun 13, 2017 6:51 am

Not sure where to place this but let me start here:
I spent last night messing with following issue - Black F407ZET with 512kB External Sram, Heap in the External Sram, SdCard via SDIO, SdFat, basic frequencies.

The "mbmp" allocated in the Heap via malloc(), allocation went fine.

This does not work, it hangs inside the write:

Code: Select all

if (myFile.write(mbmp.data, mbmp.size) != mbmp.size) {
    Serial.println(F("### Error writing the file.."));
    return 1;
  }
This write works:

Code: Select all

for (uint32_t i=0; i<mbmp.size; i++) {
    myFile.write(mbmp.data[i]);
  }
It worked in past with F103ZET and with the Heap in its External 512kB Sram, SdCard via SPI, SdFat.
Pukao Hats Cleaning Services Ltd.

Post Reply