L476 locking up, hard to reconnect the debugger afterwards
I'm working on an project with an L476 using SWD. Main project is basically up and running, but I'm having problems with the bootloader.
The bootloader needs to be small as possible, so am avoiding the bloaty HAL and have set up the PLL. Seems OK in that the debug UART is kicking out exactly the right baud rate, but if I just run in a loop sending out 0x55 the unit locks up and loses the debugger connection.
The only way I can reconnect is by powering the unit up and hitting go on the debugger at exactly the right time. It can take scores of goes before I can reconnect. It keeps telling me that there is no part found.
So, some questions:
- Should the debugger not hold the STM in reset and allow me to reconnect easily?
- What could be causing this lockup? The RCC registers I *think* are OK, they look the same as in the main app other than I am only setting up on PLL as all I want is a couple of UARTs and to be able to self program flash.
- I have setup the flash wait states to the max number, so I think that is fine too, is there anything there I might have forgotten?
Many thanks.