cancel
Showing results for 
Search instead for 
Did you mean: 

Hi all, I am using STM32Cube, with STM32F429zi board. I am trying to run the SPI Receive

ECrom.1
Associate III

I used the Cube's inits, and there seems to be no special code

But I do not get any SPI response. Always 0xff for the whole buffer

It seems the clock is not working.

Can anyone help ?

Thanks

Eli

4 REPLIES 4
S.Ma
Principal

Make sure the GPIO are clock enabled and alternate functions are SPI.

I guess you want master SPI mode. Use SW NSS.

Program the SPI to be master with few MHz output clock speed for bringup.

Do use the bidirectional mode (MOSI MISO SCK NSS) standard mode.

If all is programmed well, you can even stop the code while running in debug mode and play with SPI DR register to push data out manually for checking...

ECrom.1
Associate III

Hi and thanks for you reply.

I do not understand what you mean by " Make sure the GPIO are clock enabled and alternate functions are SPI."

I define 4 pins for the 4 SPI signals.

How do I enable clock in GPIOs?

And what is "and alternate functions are SPI."?

Thanks

Eli

The respective SPI pins have to be set properly in GPIO, for that, the clock for the respective GPIO has to be enabled in RCC.

Pins have to be set as AF in GPIOx_MODER, and then the appropriate AF (according to Alternate functions table in Datasheet) has to be set in GPIOx_AFR.

Then of course, SPI clock has to be enabled too in RCC, and SPI registers have to be set properly.

Cube might "have done" some of these steps for you. I don't use Cube.

Even if using Cube, it may still be a good idea to read out and check the relevant GPIO and SPI registers.

JW

ECrom.1
Associate III

Thanks

Will try

Eli