SPI constantly sending Clock and OxFF over MOSI after enabling SPI in half duplex.
Hi,
I have been trying to communicate with an SPI peripheral (NOR Flash). I want to use SPI in half duplex mode. The problem is that as soon as enable the SPI peripheral I see SPI constantly sending OxFF over MOSI even though I have not written anything on the SPI DR register.
Pasting the screenshot of the Salea LA

Below is the simple SPI TX code
void SPI_SendData(uint8_t* Txdata, uint32_t len) {
if((spi_dev->SR & TXE_FLAG)) {
spi_dev->DR = *(uint8_t*)Txdata;
Txdata++;
len--;
}
if(!(spi_dev->CR1 & SPI_EN)) {
spi_dev->CR1 |= SPI_EN;
}
while(len > 0) {
// Wait for TXE FLAG
if((spi_dev->SR & TXE_FLAG)) {
spi_dev->DR = *(uint8_t*)Txdata;
Txdata++;
len--;
}
}
}Edited to apply source code formatting - please see How to insert source code for future reference.
