Смог разве что подключить PLL к часовому кварцу на 32кГц подключенному к RTCX выводам.
Пробовал уже и проц перепаивать, но все то же самое.
Пробовал конфигурировать PLL через Wizard но проц зависает не дойдя до main-а. Пробовал конфигурировать непосредственно в Си коде:
Код
//1.Disconnect the PLL with one feed sequence if PLL is already connected.
PLLCON &= ~0x02;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//2.Disable the PLL with one feed sequence.
PLLCON &= ~0x01;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//3.Change the CPU Clock Divider setting to speed up operation without the PLL, if
//desired.
/*...*/
//4.Write to the Clock Source Selection Control register to change the clock source.
CLKSRCSEL = 0x01; //Selects the main oscillator as the PLL clock source.
SCS &= ~0x00000010; //The frequency range of the main oscillator is 1MHz to 20MHz.
SCS |= 0x00000020; //The main oscillator is enabled
while (OSCSTAT) //Wait for it to settle
{ }
//5.Write to the PLLCFG and make it effective with one feed sequence. The PLLCFG can
//only be updated when the PLL is disabled.
PLLCFG = 0x00000006; //Set the PLL M and N constants
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//6.Enable the PLL with one feed sequence.
PLLCON |= 0x01;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//7.Change the CPU Clock Divider setting for the operation with the PLL. It's critical to do
//this before connecting the PLL.
CCLKCFG = 0x00000003;
//8.Wait for the PLL to achieve lock by monitoring the PLOCK bit in the PLLSTAT register
while (!(PLLSTAT & 0x04000000)) //Wait for it to settle
{ }
//9.Connect the PLL with one feed sequence.
PLLCON |= 0x02;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
PLLCON &= ~0x02;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//2.Disable the PLL with one feed sequence.
PLLCON &= ~0x01;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//3.Change the CPU Clock Divider setting to speed up operation without the PLL, if
//desired.
/*...*/
//4.Write to the Clock Source Selection Control register to change the clock source.
CLKSRCSEL = 0x01; //Selects the main oscillator as the PLL clock source.
SCS &= ~0x00000010; //The frequency range of the main oscillator is 1MHz to 20MHz.
SCS |= 0x00000020; //The main oscillator is enabled
while (OSCSTAT) //Wait for it to settle
{ }
//5.Write to the PLLCFG and make it effective with one feed sequence. The PLLCFG can
//only be updated when the PLL is disabled.
PLLCFG = 0x00000006; //Set the PLL M and N constants
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//6.Enable the PLL with one feed sequence.
PLLCON |= 0x01;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
//7.Change the CPU Clock Divider setting for the operation with the PLL. It's critical to do
//this before connecting the PLL.
CCLKCFG = 0x00000003;
//8.Wait for the PLL to achieve lock by monitoring the PLOCK bit in the PLLSTAT register
while (!(PLLSTAT & 0x04000000)) //Wait for it to settle
{ }
//9.Connect the PLL with one feed sequence.
PLLCON |= 0x02;
PLLFEED = 0xAA; //Write the feed sequence
PLLFEED = 0x55;
Старался все делать по шагам User Manual-а но проц виснет где-то в этом коде. То ли при подключении в качестве источника тактирования Main Oscilator-а, то ли при подключении PLL... Дело в том что в отладке я не могу отднозначно этого определить так как отладчик отваливается в разных местах.
Пробовал запускать данный код без подключенного отладчика, но процессор снова зависал да так что оживлялся только пересбросом питания, даже на внешний RESET не реагировал.
Пользуюсь отладчиком J-Link (JTAG Speed - Adaptive Clocking).
Подскажите где мне искать ошибку?
Либо возможно у кого-то есть точно рабочий код инициализации PLL для LPC23xx?