Using the RTC oscillator with RapidiTTy Builder for LPC-2378

I was recently contacted by a customer asking if he could use the RTC oscillator as a clock source for the PLL on the LPC-2378.

While investigating this issue I found out that if I chose to use the RTC oscillator on the LPC-2378, uploading and debugging through JTAG was a problem. The code compiles fine on the Builder but then I had to use the generated .hex file and a flash tool (like Flash Magic) to upload the code.

In order to use the RTC Oscillator as the PLL clock source, I had to make some slight modifications to the code provided in RapidiTTy Builder. This is illustrated below:

main.h

  1. // Oscillator / resonator frequency (in Hz)
  2. // e.g. use (32768UL) for the RTC oscillator on LPC-2378
  3. #define FOSC (32768UL)
  4.  
  5. // PLL multiplier value
  6. // Use 4395 as a multiplier (with 1 as a divider )
  7. // to get an FOSC of 288 MHz
  8. #define PLL_MULTIPLIER (4395UL)

system_init.c

Comment out the following lines of code:

  1. // Do not need the main oscillator
  2. // when using the RTC oscillator
  3. SCS |= 0x20;
  4. while( !(SCS & 0x40) );

Use the following clock source selection value:

  1. CLKSRCSEL = 0x02;

— Anjali.

Isn’t it possible to adapt

Isn’t it possible to adapt the OCD config file to upload code thorugh JTAG, replacing “12000” with “32768” in the following line?

  1. #flash configuration
  2. flash bank lpc2000 0x0 0x80000 0 0 0 lpc2000_v2 12000 calc_checksum

Edit

Sorry, that should be 327 or 328, not 32768 (12000 = 12MHz)

Close enough?

Presumably 327/8 is close enough to get it working — has anyone tested them? I have development boards with 14.7456 MHz crystals that are configured here as ‘14745’ and work fine…

Also, just for clarification — the configuration file is ‘lpc2xxx_armusbocd.cfg’ for the ARM-USB-OCD debug device or ‘lpc2xxx_pp.cfg’ for a JTAG Wiggler (best to change both). These are found under the ‘Scripts’ directory of a RapidiTTy generated project.

Peter J. Vidler
Senior Systems Developer, TTE Systems Ltd

Clarification

Yes, those files are the ones requiring changes.
I’m not entirely sure how to style my posts more clearly.

Thanks for the

Thanks for the suggestions.

Did change the clock frequency in ‘lpc2xxx_armusbocd.cfg’ to ‘328’. Did not work, though.

— Anjali.