This code work correctly.
-But I've notice a issue if I use this code:
status = HAL_SPI_Transmit (hspi, &opcode, 1, HAL_MAX_DELAY);
status |= HAL_SPI_Receive (hspi, &response, 1, HAL_MAX_DELAY);
opcode = PROGRAM_ERASE_BUFF1_OPCODE;
status |= HAL_SPI_Transmit(hspi, &opcode, 1, HAL_MAX_DELAY);
status |= HAL_SPI_Transmit_IT(hspi, data, size);
I want NSS to go low, send 1 byte, receive 1 byte, NSS to go high, go low again, send 1 bytes, receive x bytes in non-blocking mode (I add a "__HAL_SPI_DISABLE(hspi)" in the RxCallback).
But the behavior is unexpected: NSS don't go high after first Receive/Transmit, and stay low until the end of x bytes reception.
If I put a breakpoint between the two transaction, the behavior of NSS is as expected.
So the SPI module have a issue with the hardware control of NSS pin if we enable/disable it to fast.
Am I correct?