Hi Mariano,
Two points need to check and take care:
1. Your debug code.
Please use the official LPC1769 code, you can download the code from this link:
LPCOpen Software for LPC17XX|NXP
When you want to enable the external crystal, you should use this code:
if (!Chip_Clock_IsCrystalEnabled())
Chip_Clock_EnableCrystal();
while(!Chip_Clock_IsCrystalEnabled()) {}
STATIC INLINE bool Chip_Clock_IsCrystalEnabled(void)
{
return (LPC_SYSCTL->SCS & SYSCTL_OSCSTAT) != 0;
}
STATIC INLINE void Chip_Clock_EnableCrystal(void)
{
LPC_SYSCTL->SCS |= SYSCTL_OSCEC;
}
STATIC INLINE bool Chip_Clock_IsCrystalEnabled(void)
{
return (LPC_SYSCTL->SCS & SYSCTL_OSCSTAT) != 0;
}
When LPC_SYSCTL_SCS[OSCSTAT] =0, then you need to enable the LPC_SYSCTL_SCS[OSCEN], and wait the OSCSTAT bit to be set.
Your code is wrong, because after the reset, the MCU will run from the internal IRC, and the OSCEN is 0, if use your code, you won't enable the OSC, of coursed the oscillator won't be ready.
2. After you use the official lpcopen code, and your oscillator is still can be ready, then you need to check your hardware, especially the external crystal circuit, whether the load capacitor is match with your crystal, you can refer to the LPCXpresso lpc1769 board.
You can refer to my attached schematic.
After download the code, you also can use the oscilloscope to check the crystal, whether it is oscillating.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------