STM32CubeF4 icon indicating copy to clipboard operation
STM32CubeF4 copied to clipboard

Nucleo F411RE SPI not working

Open xRadx opened this issue 4 years ago • 3 comments

Describe the set-up

  • Nucleo F411RE
  • STM32IDE 1.7.0, F4 package 1.26.0

Describe the bug SPI does not work for the board, but works on F446RE with the same CUBEMX SPI settings and same instructions/commands inside of main.c

How To Reproduce

  1. Indicate the global behavior of your application project: Sending some random data via SPI1 od SPI2 is not visible for another MCU.

SPI settings: Motorolla, 8 bits, MSB first, 2MB/s, polarity LOW, 1 edge, CRC disabled, NSS Software. PB1 set to output as CS

main.c: HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1); uint8_t tx[4], tx[0]=65; tx[1]=66; tx[2]=67; tx[3]=68; HAL_Delay(3000); while(1) { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 0); HAL_SPI_Transmit(&hspi2, &tx, 4, 10); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1); HAL_Delay(100); }

xRadx avatar Oct 07 '21 12:10 xRadx

Hi @xRadx,

Would you please share the IOC file in order to allow a better analysis of the problem.

With regards,

ASELSTM avatar Oct 20 '21 11:10 ASELSTM

SPI_Test.zip

ioc attached

xRadx avatar Nov 08 '21 07:11 xRadx

Any updates?

xRadx avatar Mar 24 '22 08:03 xRadx

Hi @xRadx,

First, please excuse this late answer.

Based on the IOC file you have share with us, we have generated the project using the latest version of the SMT32CubeMX and run it on an F411RE Nucleo board. We did not detected any issue with the SPI, it is working perfectly as expected.

Find below the data frame recorded on the MOSI line. We have made few update on the data to be transferred by setting the tx buffer to tx[] = "SPI2".

image

Please make sure you are correctly wiring the transmitter and receive boards. Otherwise, I recommend you to use the latest version of the STM32CubeMx v6.9.0.

As there is no issue, please allow me thus to close this thread.

With regards,

ASELSTM avatar Jul 11 '23 15:07 ASELSTM