Change the base clock of peripheral using LPC1837

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

Change the base clock of peripheral using LPC1837

641 Views
Anonymous
Deactivated User

Hello, 

I'm working on my first project using the LPC1837 board, and I would like to know if it's possible to change the base clock of a peripheral. For example, the base clock for the TIMER0 is the CLK_BASE_MX, would be possible to change it to CLK_BASE_LCD for example? What I want in the end is to change the clock rate of TIMER0 without messing the other clocks of the board.

Thanks for your help.

Kind regards, Luiz

Labels (1)
4 Replies

509 Views
soledad
NXP Employee
NXP Employee

Hi, 

The CGU generates multiple independent clocks for the core and the peripheral blocks of the LPC18xx. Each independent clock is called a base clock and itself is one of the inputs to the two Clock Control Units (CCUs) which control the branch clocks to the individual peripherals. The CGU selects the inputs to the clock generators from multiple clock sources, controls the clock generation, and routes the outputs of the clock generators through the clock source bus to the output stages. Each output stage provides an independent clock source and corresponds to one of the base clocks for the LPC18xx.

LCD and TIMER0 have the same base clock (BASE_M3_CLK) however they have different Branch clock (CLK_M3_LCD and CLK_M3_TIMER0). 

Regards 

Soledad

0 Kudos

509 Views
Anonymous
Deactivated User

Ok , I got it, but correct me if I'm wrong. In order to change the rate of the CLK_M3_TIMER0 clock (ex: reduce from 180MHz to 120MHz) I have to change the BASE_M3_CLK since it's the base clock for TIMER0. As far as I know, it's not possible to change the rate of CLK_M3_TIMER0, I have to change the base clock. However, if I reduce the rate of the BASE_M3_CLK, it will affect the rest of the peripherals (including the M3 processor) that uses the BASE_M3_CLK as base clock, and I would like to avoid that if possible.

Thanks for your help.

 

Kind regards, Luiz

 

0 Kudos

509 Views
soledad
NXP Employee
NXP Employee

Hi, 

You are right. 

You can use the Timer prescale counter registers

pastedImage_1.png


Have a great day,
Sol

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

509 Views
Anonymous
Deactivated User

Yeah I see, but what I'm trying to do is for example: take the CLKIN_IRC (12MHz) clock ,multiply it for some value (10 -> 120MHz) using the MAINPLL, and then use the output of the MAINPLL as the clock source for the CLK_M3_TIMER0. However, CLK_M3_TIMER0 is not a base clock, so I could not modify it using the Chip_Clock_SetBaseClock function.

Chip_Clock_SetupMainPLLMult(CLKIN_IRC, 10);
Chip_Clock_SetBaseClock(CLK_BASE_MX, CLKIN_MAINPLL, true, false); //CLK_M3_TIMER0 will cause an error

I can only modify the BASE_M3_CLK, but by doing this, all the peripherals that uses BASE_M3_CLK as base clock will be affected too. If possible I would like to affect only the TIMER0.

My objective in the end is to clock sync two LPC1837 boards, so if one is counting faster than the other, I can make it count slower by reducing the clock rate. I'll use the those values as timestamps for the incoming frames on the Ethernet port.

Thanks for your help.

Kind regards, Luiz