I assume 16 MHz external should work, if the rest of the clock setup is ok (the clock setup page should tell you so). The F103 is different from F105, in that it doesn't have the USB OTG support. So there were some slight differences in the generated...
So I tried some more debugging. You have the external crystal set to 16 MHz. I didn't notice this and my board has a 8 MHz crystal. Once I changed this, it worked for me.
I don't have your mcu, so I've copied your code to an empty STM32F103 project. I've managed to reproduce the error, and tried comparing it with my successful code. I've not yet found any differences that could explain it, but I'll have a closer look ...
I'm no expert so this is a stab in the dark. You also do a lot in various interrupt handlers, like SYSTICK and GPIO EXTI. Erasing flash is a slow process, definitely not something that should be done in an interrupt handler.I'd start by commenting ou...