Using External Xtal causes a hardware exception
Hi All,
I'm working with a STM32F303x8, when using the HSI as the clock I've found the timers drift too much between cold and hot running (which is fair), I'm seeing about a 0.3% drift which is an issue for this application.
I now have an 8MHz External crystal as the main clock and that appears to be working except I get a 'HardFault' after a few seconds of running. Switch back to the HSI and it's fine.
When the exception happens most of the time I am seeing the 'UNDEFINSTR' flag set (the processor has attempted to execute an undefined instruction) which makes no sense at all. If there was a bad instruction why would it happily execute off the Internal Clock and not hit this. So I'm not believing that as being the actual fault or my determination of that is wrong.
If I check the RCC status (SWS: System clock switch status) it says it is running off the HSE and HSERDY = 1.
The thing is when this exception happens the Timers are still generating an output signal, so the clock must still be functional. In fact I know it is the External Crystal still being used because my pulse outputs are dead accurate (unlike when running off the HSI).
Has anybody else run across anything like this before?
Thanks.
