SPI3 Chip Select (NSS) not working
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, theHAL_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.NSS = SPI_NSS_HARD_OUTPUT;
hspi3.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hspi3.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi3.Init.TIMode = SPI_TIMODE_DISABLE;
hspi3.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hspi3.Init.CRCPolynomial = 10;�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
I don't know how to resolve this issue.
Thanks in advance!
#interrupt #spi-write-and-read #flash-memory #stm32f103