SPI on F4

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
ag123
Posts: 770
Joined: Thu Jul 21, 2016 4:24 pm

Re: SPI on F4

Post by ag123 » Mon May 08, 2017 8:46 am

the improvement in write speeds is really dramatic going up to 4k, 8k :D

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 8:50 am

Yes, if you reserve 32k buffer for it...
But even with 8k buffer it gives a nice speed.

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 8:56 am

SdBench with F4 must give you ~4.5MB/sec rd/wr @42MHz SPI clock and SdFatEX with 512bytes large buffer and DMA on..
SdBench with F1 must give you ~3.5MB/sec rd/wr @36MHz SPI clock and SdFatEX with 512bytes large buffer and DMA on..
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 9:02 am

Pito, the Ex didn't bring any improvement.

I don't see any way how to increase 10 times the rd/wr speed...
Can you hint to any solution?
Last edited by stevestrong on Mon May 08, 2017 9:08 am, edited 2 times in total.

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 9:05 am

You must switch the SdFatEX on in SdFatConfig.h.
Again, the above results are real..
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 9:07 am

Can you please post your test sketch + used core + SdFat lib?

Oh, and send me a similar card you are using :)
Btw, which color is your Sammy card? red or yellow/orange?

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 9:23 am

SdBench from latest SdFat is the sketch.
The cards I have used are:
1. Samsung EVO 8GB, CL10 UHS-I (white/orange) - works 21, 36, 42MHz
2. Sandisk Ultra 16GB, CL10 (red/grey) - works 21, 36MHz
If you do not get such results (plus minus 0.2MB/sec) then it is something wrong with your setup/settings/SPI_DMA driver..
The same results I get with Daniel's core, and with libmaple.
With SdFatEX use 512bytes large buffer.
Last edited by Pito on Mon May 08, 2017 12:46 pm, edited 5 times in total.
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 9:24 am

That's why I'm asking you to post your setup, to be able to reproduce your results.
You can also send me BIN files for blue pill and/or maple mini and/or black F4 + indicate the used SPI and CS pins for each board in part.

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 9:45 am

Try - MapleMini, cs=PB12, SPI1, 36MHz, USB serial, bootloader20, SdFatEX, DMA, 512bytes large buffer

You have to get something like:

Code: Select all

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

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
3533.34,25083,136,143
3594.74,15522,136,141

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
3257.12,1548,155,156
3258.89,1359,155,156

Done
Type any character to start
Here is the F407, Black, SPI1, cs=PB6, Serial 115k2, Pa9/10, SPI @21MHz, Sandisk, SdFatEX, DMA, 512bytes large buffer.
SDBench_F4.rar
(18.25 KiB) Downloaded 16 times

Code: Select all

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

write speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
2384.21,8114,207,209
2430.57,8518,207,209
2429.39,8487,207,209

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
2446.03,1174,208,208
2447.22,1059,208,208
2447.22,1059,208,208

Done
Type any character to start
Last edited by Pito on Mon May 08, 2017 5:54 pm, edited 1 time in total.
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1748
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 11:33 am

What is the reason not to use F407 black SPI1 with 42MHz?

Post Reply