Question
STM32F103 hangs when erasing page and receiving USART data
Posted on March 11, 2015 at 10:19
I am currently working on a STM32F103, and I want to program the flash. However, it appear that programming the flash with an USART device receiving bytes in the same time make it hangs:
FLASH_BASE->CR |= FLASH_CR_PER; while (FLASH_BASE->SR & FLASH_SR_BSY); FLASH_BASE->AR = pageAddr; FLASH_BASE->CR |= FLASH_CR_STRT; // Hangs forever when receiving // data on USART2 in the same time while (FLASH_BASE->SR & FLASH_SR_BSY); FLASH_BASE->CR &= ~FLASH_CR_PER;
Disabling the RE flag on USART2 before and re-enabling it after avoids the problem, but it prevent me from receiving data during the operation, which would be possible since the receive interrupt is in the RAM.
Actually, looks like it is not related to the interrupt itself, because it still hangs without the receive interrupt.
Any idea?
Thanks #flash