Here's my code to set up the FRO. A few notes:
- The FRO can only be set to one of a few speeds, see the user manual for more info
- The system clock is automatically 1/2 of the FRO rate
- The code below sets it to the max speed for the LPC802
[code]
// set up system clock (the hard way)
asm volatile( // the void set_fro_frequency(uint32_t iFreq); API is missing so do this by hand
" ldr R1, ROM_Tbl \n" // get address of pointer to ROM Driver Table
" ldr R1, [R1] \n" // get pointer to ROM Driver Table
" add R1, #0x0C \n" // step down to the entry for the FRO table
" ldr R1, [R1] \n" // get address of FRO table
" add R1, #8 \n" // step down to third entry in table
" ldr R1, [R1] \n" // get address of set_fro_frequency routine
" ldr R0, FRO_Freq \n" // put frequency in R0
" blx R1 \n" // call API
" b Exit \n" // done
" .align 4 \n" // fix alignment
"FRO_Freq: .word 30000 \n" // frequency in kHz
"ROM_Tbl: .word 0x0F001FF8 \n" // address of ROM Driver Table
"Exit: \n" // end of code segment
);
SystemCoreClock = 15000000; // System clock is 1/2 of FRO
[/code]