cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F401 SPI problem

gillbike
Associate II
Posted on July 30, 2015 at 06:45

I work the SPI1 normally,

but cannot work on other 2,3,4....

i think F401 have SPI2,3,4 right?

i via dma and setting follow my setting in SPI1

i try SPI4, DMA channel 5 stream 3,4 for tx rx. but no output.

the stdperiph lib seems to be V1.0.0. do i need another lib for that?

#discovery #stm32f4 #spi #error
7 REPLIES 7
tm3341
Associate II
Posted on July 30, 2015 at 09:06

STD periph for F4xx series is 1.5.1 out at least now. In V1.0.0 is not supported SPI > 3.

And, do you have GPIO configured OK for your SPI? And clock enabled for SPI?

I'm sure you have problem with SPI initialization. First make sure SPI works, then go to DMA!

gillbike
Associate II
Posted on July 30, 2015 at 09:32

THX,

I set as SPI1 is OK, so the IO and Clock config is ok i think

V1.0.0 not support SPI >3, but i use SPI2 still not work, Let me try again,

So i have to change the lib to V1.5.1 for SPI 4?

Where could i get the lib?

Posted on July 30, 2015 at 15:40

Presumably you have the firmware release for the F401 Discovery board

More generally the F4 series has it's Standard Peripheral Library bundled with the DSP library code. Here's that, Red Download button at the bottom of the page.

http://www.st.com/web/en/catalog/tools/PF257901

F401 is a seriously feature reduced F4, not sure what peripheral count it has with respect to SPI, you'd have to double check the Data Sheet

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 30, 2015 at 15:42

Make sure you enable the SPI clock on the correct APB bus, and the DMA Channel/Stream associations are correct at all points they are used, or status tested/cleared.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
gillbike
Associate II
Posted on July 31, 2015 at 05:36

Thx,  

I have some silly questions,

1. do i need to delete the original disco stdperiph lib>?

2. how to add the new lib in to my original project?

   i follow the readme.txt but i realize that the lib have the main itself, is it a project already.?

p.s. I am using Eclipse. luna

Posted on July 31, 2015 at 15:27

Can't really help you with Eclipse, with Keil you could just expand the archive in it's own directory and then copy the existing project into the Project directory, allowing all the relative paths to the library files, and include files to remain consistent.

It's not clear if you need the newer libraries or not, I posted the link in response to you wanting to know where they are on the web site.

You'd need to confirm the SPI you're attempting to use is present on the part, which you could do via the Data Manual, or by reviewing the startup_stm32f4xxyyzz.s and looking at  the vector table to see if there is an IRQHandler for SPIx

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 31, 2015 at 18:43

i try SPI4, DMA channel 5 stream 3,4 for tx rx. but no output.

The Reference Manual RM0090 (Rev 9 to hand) clearly indicates that the SPI4_RX/TX are ONLY supported on STM32F42xxx and STM32F43xxx parts. See Note (1) DMA2 Request Mapping.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..