Search code examples
c++embeddedstm32keil

Infinite loop during debugging


I am working with a STM32 eval2 board and trying to debug it. It used to work fine, and I haven´t changed anything, but for the last week or so I am always getting stuck in this loop while I am in debugger mode, but when I am not, the program runs fine.

while(!__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXOVERR | SDIO_FLAG_DCRCFAIL | SDIO_FLAG_DTIMEOUT | SDIO_FLAG_DBCKEND | SDIO_FLAG_STBITERR))
{
if(__HAL_SD_SDIO_GET_FLAG(hsd, SDIO_FLAG_RXDAVL))
{
  *(tempscr + index) = SDIO_ReadFIFO(hsd->Instance);
  index++;
}
}

I even tried running the sample project code provided for the board by ST, did not change anything about it, and I am stuck in the same while loop in their code as well.

Does anybody know what I am doing wrong here? It doesn´t make sense because nothing changed.

The errors that are defined by the variables in the while loop are (respectively):

Received FIFO overrun error

Data block sent/received (CRC check failed)

Data timeout

Data block sent/received (CRC check passed)

Start bit not detected on all data signals in wide bus mode

and it looks like in this while loop it is getting stuck in the if statement for a "Data available in receive FIFO" flag, if that makes sense. I cannot step over that if statement.

I am using keil v5 and programming in c++

Well, I have been struggling with this for a week and almost right after I posted this I figured it out.

I had the SD card in, and for some reason taking it out fixed it. So I will leave this in case anyone else ever has this stupid problem.


Solution

  • Well, I have been struggling with this for a week and almost right after I posted this I figured it out.

    I had the SD card in, and for some reason taking it out fixed it. So I will leave this in case somebody else has this stupid problem.