LPC1769 Main oscillator doesn't ready or stable

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1769 Main oscillator doesn't ready or stable

Jump to solution
1,411 Views
marianovedovato
Contributor III

Hi everyone!
I'm reviewing a sitck (of embedded artist) that has troubles with the main oscillator.

I can see in debug mode that always any program will be stuck in the follow part of the initialization:

#define SCS_Value                0x00000020

SCS = SCS_Value;
 
    if (SCS_Value & (1 << 5))               /* If Main Oscillator is enabled      */
        while ((SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready    */  ---> STUCK

I have probed to change the crystal (12MHz) connected to the 22 and 23 pins but I still haven't luck.

The owner of the stick told me that him only it used with one test program, he don't remember to did any strange configuration.

Is there possible to recover the MCU to a kind special way of factory configuration? Or maybe the only solution is to change the MCU for other new part?

Thanks in advance!

BR

Mariano

Labels (1)
1 Solution
884 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Mariano,

    Thanks for your comments.

    Now, it is really caused by the hardware.

   If you still have question, please let me know.

   If your question is solved, please help to mark the correct answer to close this question.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

3 Replies
884 Views
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

884 Views
marianovedovato
Contributor III

Hi Kerry, thank you so much for you reply.

I did make the two points that you suggested, my comments:

1.

The code that I'm often using for probes, works smoothly in others Sticks (this case is revision C). Maybe the initialization is not correct at all, but believe me, works (the MCU runs to 100MHz).

Anyway I downloaded the official that you said, and I probed the Blinky led. However the result is the same:

/**
 * @brief    Checks if the external Crystal oscillator is enabled
 * @return    true if enabled, false otherwise
 */
STATIC INLINE bool Chip_Clock_IsCrystalEnabled(void)
{
    return (LPC_SYSCTL->SCS & SYSCTL_OSCSTAT) != 0;        --> Stuck here
}

Of course, in other stick works fine (like my code!! :smileyhappy:)

2.

There wasn't oscillation in the 22 and 23 pins, so I changed the crystal. No luck

But in this moment I cannot measure the capacitors, so I changed both (now crystal and capacitors are discrete components) for 33 pF values(yes, you are thinking that is not the correct value just suggest the user manual, load capacitance 10 pF --> uses 18pF and load capacitance 20pF uses 39pF) but now the led is blinking!

By last, I will restore all components but changing boths capacitors for new ones, I think that was the problem.

Thank you so much again for everything Kerry!

BR

Mariano

0 Kudos
885 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Mariano,

    Thanks for your comments.

    Now, it is really caused by the hardware.

   If you still have question, please let me know.

   If your question is solved, please help to mark the correct answer to close this question.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------