Change clk component parameters Realtime

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EsFr_4600111
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

Hi

Using cyble-0222014 module, I want to change the frequency of the CLK component during program execution.

I have a clk with a frequency of 1 kHz and when the Bluetooth is connected i want to change it to 510kHz.

Because I want to use the blue LED blink during paring, and when its connected i want to be able to fade the blue LED w PWM.

I have used all possible counter/timer on schematic, so i want to change the CLK instead, How?

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

EsFr,

You speak of your CLK component.  Depending on which clock component and the source frequency of it, the answer is yes.

If you're using the clock component of which I'm thinking, then you can use CLK_SetFractionalDividerRegister() to switch frequencies to downstream components on-the-fly.

/*******************************************************************************

* Function Name: CLK_SetFractionalDividerRegister

********************************************************************************

*

* Summary:

*  Modifies the clock divider and the fractional divider.

*

* Parameters:

*  clkDivider:  Divider register value (0-65535). This value is NOT the

*    divider; the clock hardware divides by clkDivider plus one. For example,

*    to divide the clock by 2, this parameter should be set to 1.

*  fracDivider:  Fractional Divider register value (0-31).

* Returns:

*  None

*

*******************************************************************************/

Can you share your TopDesign file with the forum?

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
1 Reply
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

EsFr,

You speak of your CLK component.  Depending on which clock component and the source frequency of it, the answer is yes.

If you're using the clock component of which I'm thinking, then you can use CLK_SetFractionalDividerRegister() to switch frequencies to downstream components on-the-fly.

/*******************************************************************************

* Function Name: CLK_SetFractionalDividerRegister

********************************************************************************

*

* Summary:

*  Modifies the clock divider and the fractional divider.

*

* Parameters:

*  clkDivider:  Divider register value (0-65535). This value is NOT the

*    divider; the clock hardware divides by clkDivider plus one. For example,

*    to divide the clock by 2, this parameter should be set to 1.

*  fracDivider:  Fractional Divider register value (0-31).

* Returns:

*  None

*

*******************************************************************************/

Can you share your TopDesign file with the forum?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes