DelfiSpace / DelfiPQcore

0 stars 1 forks source link

Clock selection #6

Closed StefanoSperetta closed 4 years ago

StefanoSperetta commented 4 years ago

Currently, the clock source in InitMCU is:

// Starting HFXT in non-bypass mode without a timeout. Before we start // we have to change VCORE to 1 to support the 48MHz frequency MAP_CS_setExternalClockSourceFrequency(0, FCLOCK); MAP_PCM_setCoreVoltageLevel(PCM_VCORE1); MAP_FlashCtl_setWaitState(FLASH_BANK0, 2); MAP_FlashCtl_setWaitState(FLASH_BANK1, 2); MAP_CS_startHFXT(false);

The clock source is selected before selecting the bank voltage. This might cause issues when switching the source. Core voltage should be selected first.

Fallback options are not there as well.

Implement fallback to DCO in case XTAL is broken.

StefanoSperetta commented 4 years ago

First try at it done (https://github.com/DelfiSpace/DelfiPQcore/tree/ClockFallBack). It needs to be tested on a board with a broken crystal...

Clock turn-on sequence is correct, based on TI examples.

StefanoSperetta commented 4 years ago

Merged in f25fb8b5a469077f7f15e8cecf03ecbd26af688e Tested on a board with broken crystal and working fine