When the processor boots, it is using the internal clock. After a while an external oscillator is turned on and the processor switches to using that. When the app is finished for the day, it switches back to the internal clock. When trying to switch the command "MCG->SC = 0x02;" When this is performed, the processor goes off into the weeds (starts executing in an invalid memory space (0x4004XXXX). I use the same code when booting up and when switching back to the internal clock.
Can the processor switch from the internal clock to the external clock and back? If so, how?
Thank you for any assistance,