AnsweredAssumed Answered

SPI3 Chip Select (NSS) not working

Question asked by Fede Rico on Nov 14, 2017
Latest reply on Nov 14, 2017 by Fede Rico

Hello there,


with my STM32F103, I'm working with the M25P40 SPI flash memory.


With cube32Mx I configured the SPI3 with Chip Select (NSS) hardware and I perform Read/Write/WriteRead operation with Interrupt.


My problem regards the NSS, in particular the NSS signal stay low after the read operation end and the:

  • HAL_SPI_RxCpltCallback
  • HAL_SPI_TxRxCpltCallback

are never invoked.


Looking the signal with Saleae Logic Analazer, I saw that NSS signal stay low.



Instead, the HAL_SPI_TxCpltCallback is invoked.


This is the SPI3 initialization code generated by CubeMx:

  hspi3.Instance = SPI3;
  hspi3.Init.Mode = SPI_MODE_MASTER;
  hspi3.Init.Direction = SPI_DIRECTION_2LINES;
  hspi3.Init.DataSize = SPI_DATASIZE_8BIT;
  hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;
  hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;
  hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
  hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
  hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
  hspi3.Init.CRCPolynomial = 10;



I don't know how to resolve this issue.


Thanks in advance!