AnsweredAssumed Answered

STM32F4 discovery SPI issue

Question asked by osama.ahmed on Oct 9, 2016
Latest reply on Oct 9, 2016 by Clive One
        - I am using STM32F4 discovery board to send data via SPI. i have got it working but there is a small issue. the SS pin goes high before the the mcu finishes sending data.
i am using SPI1, and used PB0 as SS.
there is my code for sending one byte:

 GPIOB->ODR &= ~(1 << PIN0); // SS is LOW
  SPI1->DR = data;
  while(! (SPI1->SR & (1 << TXE))); // wait until TX buffer is empty
  GPIOB->ODR |= (1 << PIN0); // SS is HIGH

and here is the data :


and here is the data after adding some delay before SS goes back HIGH:


Any one please know what could cause this to happen?
is it because of the TXE buffer flag goes back high before the data transmission complete?("This is what i saw in the debugger ") and why? it is supposed to go high when there is no data in the buffer.