I am trying to get the UART bootloader on the LPC1549 to work.
Reinvoking the ISP from user code works fine, but then the problems start:
If I put the call to reinvoke_isp directly into the main() (after all the peripherals have been initialized), autobaud works correctly and the chip answers "SYNCHRONIZED".
In this case the BRG-Register of the USART0 peripheral has a value of 0x4D after the autobaud.
But when I call reinvoke_isp later by sending a command via UART to the user code, the autobaud-routine fails and sets the BRG register to 0xAC54 which results in a veeeery slow baudrate (approx. 1.5 seconds per char).
The only difference between the two cases is that the MCU has to parse the incoming command. Everything else has been successfully initialized in both cases.
I tried resetting the USART0 peripheral before reinvoking ISP, but that didn't change anything.
The stackpointer is reset to the top of the stack-32bytes (for IAP) and the upper 32bytes of RAM are excluded from usage by the usercode. (The datasheet mentions that the ROM code uses these bytes.)
I also compared all SYSCON register values in the working and non-working case. There were no differences.
What am I missing? Do I have to initialize/reset anything else to make the autobaud routine work correctly?
Looking forward to your answers