stm32 - STM32F205 SPI RXNE flag is not set -


I am using STM32F205 SPI1 in master mode and during the transaction the RXNE flag is never set here. SPI initialization Is a part of:

  SPI1-> CR1 = SPI_CR1_MSTR | SPI_CR1_SSI | SPI_CR1_SSM | SPI_CR1_SPE; SPI1- & gt; CR2 = 0;  

Then I am trying to get a single byte transmission:

  while (! (SPI1-> SR & amp; SPI_FLAG_TXE)) {} previous tx SPI1-> gt; DR = 0 xab; // While transmitting some bytes (! (SPI1-> SR & SPI_flag_RXNE)) wait for // byte UIT 8_T result = SPI1-> Dr; This code is waiting for the RXN flag. I tried to wait for the busy flag  BSY = 0  instead of  RXNE = 1  and the SPI began to work It seems that RXNE is never set up . 

Suggestion only:

  SPI1 - & gt; CR1 = SPI_CR1_MSTR | SPI_CR1_SSI | SPI_CR1_SSM | SPI_CR1_SPE; SPI1- & gt; CR2 = 0;  

You are naming the SPI before writing in the CR2 register. Enable SPI only after typing upside down or CR2.


Comments

Popular posts from this blog

Active Directory Authenticated Proxy Server with Squid or CNTLM -

java - @PluginTarget(Node.class) not registering as neo4j plugin -

java - Can't add JTree to JPanel of a JInternalFrame -