SPI on F4

Limited support for STM32F4 Discovery, Nucleo and custom F4 boards
User avatar
Pito
Posts: 1497
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: SPI on F4

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

Try with 21, and when ok you will get 42 :)
FYI - the min Latency is the time you need to transfer 512bytes to the Sdcard. From above results:
136us/512/8 = 33.2ns -> 30MHz
207us/512/8 = 50.5ns -> 19.8MHz
Pukao Hats Cleaning Services Ltd.

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

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 4:07 pm

Pito, I flashed the F4 bench bin to my black F407VE board with STLink utility from 0x80000000, but have no reaction on the serial 1 interface (PA9/10).

I also observed that the F1 bench BIN is 38kB large, while the F4 BIN is 28kB large (smaller than the F1 bin). Is this really how it should be?

EDIT
Flashing the MM over DFU:

Code: Select all

>maple_upload.bat COM3 2 1EAF:0003 sdbench_f1.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...

Searching for DFU device [1EAF:0003]...
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=761
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
error resetting after download: usb_reset: could not reset device, win error: The system cannot find the file specified.
Done!

Resetting USB to switch back to runtime mode
causes following output on USB serial interface:

Code: Select all

FreeStack: 536891308
???

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

Re: SPI on F4

Post by victor_pv » Mon May 08, 2017 4:55 pm

stevestrong wrote: I also observed that the F1 bench BIN is 38kB large, while the F4 BIN is 28kB large (smaller than the F1 bin). Is this really how it should be?
That's interesting, when I get home I'll also check what's the difference when I compile the bench sketch for F1 and F4.
There could be some math libraries being pulled to F1 for floats, while not needed for the F4 since it uses the FPU.
But we have so far found the HALMX F1 core has quite a few differences to the others, since like STM has updated the others much more, so could account for some difference.

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 4:56 pm

The F4 bin I see here is 28kB. The Serial1 is set, and I can see the ouptut as above on PA9/PA10, 115k2 8N1..
I recompiled it again with
File: SDBench.bin
CRC-32: eb38f0d4
MD4: 4d43be8aa4f0f8ad05d059f6e981fad2
MD5: 5aec1c4acfb959f8c81e480981836786
SHA-1: e7b93691e776f2df4012b1713380df174948b589
SDBench.rar
(18.25 KiB) Downloaded 8 times
F1: sorry the Freestack does not work with Daniel's repo, I will remove that.
Pukao Hats Cleaning Services Ltd.

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

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 5:00 pm

Hm, same failure with the new bin, too:
nothing on serial 1...

Sh...t, it was a loose wire, sorry.

Which one is the CS pin? PB6?

Code: Select all

FreeStack: 128032
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X20,0XFF
Last edited by stevestrong on Mon May 08, 2017 5:13 pm, edited 3 times in total.

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

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 5:09 pm

On PB6 i get a pulse train (clock signal) with ~330kHz...

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 5:16 pm

PB6 is the card's CS. The SPI is PB3,4,5.
Pukao Hats Cleaning Services Ltd.

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

Re: SPI on F4

Post by stevestrong » Mon May 08, 2017 5:19 pm

PB3,4,5 is the alternative SPI1 pin group.
On PB6, as said, i get the clock signal..

Where is PB4 on the black board?

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 5:22 pm

You are asking me? I do not have your Black VE board, my board is ZET.
Pukao Hats Cleaning Services Ltd.

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

Re: SPI on F4

Post by Pito » Mon May 08, 2017 5:50 pm

This for F1 (here 103ZET) SPI on PA5,6,7 and Cs=PC4, 36MHz, serial 115k2 on PA9,10, maplebootloader20. The previous version was build with libmaple, this is with Daniel's core. It does not wait on char, it runs in a loop.
SDBench_F1.rar
(17.86 KiB) Downloaded 7 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
3467.18,8125,139,141
3561.03,8112,139,141
3561.03,8100,139,141

Starting read test, please wait.

read speed and latency
speed,max,min,avg
KB/Sec,usec,usec,usec
3162.35,916,159,160
3162.35,904,159,160
3164.35,905,159,160

Done
Type any character to start
Pukao Hats Cleaning Services Ltd.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest