AnsweredAssumed Answered

SPI - RXNE not updating in debugger mode

Question asked by ABIN JOHN THOMAS on Feb 27, 2016
Latest reply on Feb 28, 2016 by ABIN JOHN THOMAS
Hi,
I am pasting a piece of code I used for SPI communication in STM32F4 Discovery board.The code is working, I have no doubts.

I faced an issue while in debugger mode.
I added a break point at line number 13.
// while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
Here RXNE is not getting updated and system will not execute the remaining code. The code works as expected when not in debugger mode or if breakpoint is added after line 13.

Can someone please explain me the reason behind this behavior.
I am using A to B connector to connect my Discovery and I am using Keil 4.

Thanks
Abin
 
01.uint8_t SPI_read(uint8_t address)
02.{
03.  GPIO_ResetBits(GPIOE, GPIO_Pin_3);
04.  address = 0x80 | address;         // 0b10 - reading and clearing status
05.   
06.  while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET);
07.  SPI_I2S_SendData(SPI1, address);
08.  while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
09.  SPI_I2S_ReceiveData(SPI1);
10.  
11.  while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET);
12.  SPI_I2S_SendData(SPI1, 0x00);
13.  while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
14.  
15.  GPIO_SetBits(GPIOE, GPIO_Pin_3);
16.  
17.  return SPI_I2S_ReceiveData(SPI1);
18.}

 

Outcomes