STM32F0 - IAP - USART not working after jump to main application
Hello there,
I'm trying to implement IAP using an STM32F030K6T6. I based my code on the example provided by ST, this tutorial (http://marcelojo.org/marcelojoeng/2015/09/bootloader-on-stm32f0.html) and also reading through threads in the forum with problems similar to mine. I was successful in getting most functions of my firmware working, but I'm still struggling trying to make the USART peripheral work.
In short, the "transfer complete" flag is not being set when I'm putting data in the pheripheral's register for transmission.
I don't use the USART to program the flash memory with the new code. I store the new code in the an external flash chip. Then, I use SPI to read the code from the external flash to program it inside the STM32. The SPI is working fine, both in the bootloader as well as in the main application.
Things I already investigated:
Interrupts: They are working correctly. I use timers that use interrupts and they're working correctly. The vector table seems to be remapped to the RAM without any issues.
USART configuration: I have a non-IAP version of the firmware that uses the same code to configure the USART peripheral and in this case the USART is working fine. Maybe I have to change something in the configuration, but I don't think that's the case since stop bits, baud rate and things like that don't change in the IAP-context.
The SYSCFG peripheral: I read in a thread that there's a mistake in the example IAP code from ST. Instead of enabling the syscfg, it is resetting it. I already changed that. Still, even if this was the problem, I don't know what the syscfg would have to do with the usart not working.
My main suspicion is that the USART clock is not being enabled even if I'm using the correct driver function that enables it.
I'm using the MDK-ARM Keil toolchain to code, compile and debug.
