Добрый день!
Не поможет ли кто с кварцем XT1 в MSP430F5172?
Нужно завести на 25 МГц.
(В MSP430F5172 XT1 может работать на этой частоте, по DataSheet по крайней мере).
Вот код инициализации:
...
unsigned long i = 0; // Work variable.
//---------------------------------------------------------------------------
// Set of the pin select function.
// 0 - Port I/O, 1 - Function.
PJSEL = 0x30; // 4,5 - Quartz.
// Control disable of the Port Map.
PMAPKEYID = 0x2D52; // Set of the allowing acess to the Port map register.
PMAPKEYID = 0x0000; // Disable of the reconfiguration.
//
// Set of the Vcore voltage.
// The levels should be increased only step by step.
//
// 0 1,8 - 2,0 V Ft < 8 MHz
// 1 2,0 - 2,2 V 8 MHz < Ft < 12 MHz
// 2 2,2 - 2,4 V 12 MHz < Ft < 20 MHz
// 3 2,4 - 3,6 V 20 MHz < Ft < 25 MHz
SetVCoreUp (1); // Set of the level one
for (i = 0; i < 10000; i++); // Little delay.
SetVCoreUp (2); // Set of the level two
for (i = 0; i < 10000; i++); // Little delay.
SetVCoreUp (3); // Set of the level three
for (i = 0; i < 10000; i++); // Little delay.
// Set of the Clock parametrs.
// UCSCTL6 &= ~XT1OFF; // Switch on of the XT.
// UCSCTL6 &= ~XT1BYPASS; // Set of the external crystall.
// UCSCTL6 |= XTS; // Set of the hign frequency for XT1.
// UCSCTL6
// Btgining value 1100 0001 1100 1101 = 0xC1CD
// Bits 8-15. Control of the XT2 do not change. Bit 8 = 1 - XT2 unswitch.
// Bits 6,7 = 11. Maximum frequency for the XT1.
// Bit 5 = 1. High frequency work of the XT1.
// Bit 4 = 0. XT1 - resonator.
// Bit 2, 3 = 00. Unswitch of the internal capacitors.
// Bit 1 = 0. SMCLK switch on.
// Bit 0 = 0. XT1 switch on.
// The value is 1100 0001 1110 0000 = 0x C1E0
UCSCTL6 = 0xC1E0; // Set of the UCSCTL6 value.
// Check LFXT1 fault flag
i = 0; // Control of the XT1 failure. (1, if failure is occured)
while ((UCSCTL6 & XT1LFOFFG) && (i < 500000))
{
UCSCTL7 &= ~(XT1LFOFFG); // Clear LFXT1 fault flag
SFRIFG1 &= ~OFIFG; // Clear the global fault flag. In case the LFXT1 caused the global fault flag to get
// set this will clear the global error condition. If any error condition persists,
// global flag will get again.
i = i + 1;
}
if ((UCSCTL7 & XT1LFOFFG) == XT1LFOFFG)
{
Err_Init |= Err_XT1;
}
else
{
// UCSCTL4 |= SELA__XT1CLK; // Switch of the ACLK to XT1.
// UCSCTL4 |= SELS__XT1CLK | SELM__XT1CLK; // Switch of the SMCLK and MCLK clocks to XT1.
UCSCTL4 = 0; // Switch all of the clock to XT1.
}
...
Как видите, пробовал по-разному.
Отдельно кварц проверял и заменял.
Осциллоскопом видно, что заводится странно - не 25 МГц, а шумоподобно, на частоте около 500 КГц.
Пробовал на другой плате - то же самое.