Programming with external crytal osc set

Started by Nguyen Nguyen, March 14, 2005, 04:56:00 PM

Previous topic - Next topic

Nguyen Nguyen

Hello,

I was able to program my LPC921 before with the set up set to internal RC oscillator.  I tried to change the USR config byte to use my crytal oscillator, and things started going bad.  I could not program it any more.

My crytal frequency is 32.768 Khz.

Is there anyway that I can get out of this hole?

Thanks,

Nguyen

Andy Ayre

I think that the crystal frequency you are using is probably too low to use to autobaud at any baud rate. Replace the crystal with the fastest one for the range you selected in UCFG1 and choose a low baud rate such as 1200 or 600. You should then be able to reprogram UCFG1.

Embedded Systems Academy, Inc.
support at esacademy dot com

Tilo Wei

Great, I have actual the same Problem.
Im using a crystal with 32,768 kHz too.

The fastest possible value for the crystal  in this configuration is 100kHz.
Hope this will work!

Jan Waclawek

Actually, the problem might be not the _low_ crystal, but its particular frequency, which cannot be divided down to the common baudrates (1200, 600).  The 32768Hz divides down (fosc/2/16/N) to 1024 or 512 bauds, which gives an unacceptable error of 14% or so.

Nevertheless, the standard PC UART (16C450-compatible) can be set to baudrates 115200/M (M is 16-bit), so baudrates close to 1024 or 512 can be obtained with negligible error.  (I guess that FlashMagic  does not use these nonstandard rates, as it uses the Windows API calls for full compatibility - not all serial ports on PC are 16C450-compatible). You have to use a terminal program which enables to set custom baudrates (e.g. http://bray.velenje.cx/avr/terminal/) and some means to enter the ISP mode, and then type the ISP commands (intelhex lines) "manually".

You can also try to run the controller at a clock which would divide into the standard baudrates. While crystals/resonators for 38400Hz or 76800Hz are not common, you can probably use an external oscillator (or a frequency/function generator) attached to XTAL1; and I would bet that you can use a wider frequency input to XTAL1 than 100kHz.


It would be nice to hear from either one of you, how you actually solved your problem.

Jan Waclawek

Tilo Wei

Dear Andre,

thanks for your hint!

I used a frequency generator with 100khz and set the baud rate to 600 baud, which allowed me to reprogramm the LPC....

Tilo Wei

After some testing:

You should set the frequency of your generator always to n* your selected Baud Rate.

Even your LPC is configured to use a low frequecy
crystal, set your frequency generator to 1,92 MHZ and select a Baudrate of 9200 Baud. Most Times this will work!
Take attention your frequency generator is exactly the required frequency!!

Nguyen Nguyen

Thanks a lot everyone.  I will try your recommendations.

Nguyen

Nguyen Nguyen

I removed the crystal and fed pin 6 XTAL in with 144KHz from a function generator, but it did not cut it.  I also tried 1.92MHz with 9600 baudrate, but there was no success.

Thanks,

Nguyen

Joachim Woelk

Another method to reprogram a "dead" processor is to use ICP (In-Circuit Programming). Please read AN10258_2.pdf. I just come from "awaking" a 89LPC935 which, by using ICP, Flash Magic was able to contact again. Indeed the config byte had been set by an unknown reason to "Watchdog oscillator".

So at least with a LPC935 in ICP mode it is not required to have the oscillator running at a higher frequency.