Use CLK2 for diagnosis

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

Use CLK2 for diagnosis

Jump to solution
224 Views
pranavkolte
Contributor I

Hello

I am using LPC1823 controller for my project. I want to validate the system frequency is set correctly or not, for that reason  I need to set the CLK2 as CLKOUT so that the frequency is visible on osciloscope. Can you guide me with go can I set CLK2 as CLKOUT so that I can see the system frequency on it.

0 Kudos
1 Solution
140 Views
HangZhang
NXP Employee
NXP Employee

Hi

@pranavkolte 

1. Abort "how to configure the CLK2 pin"

HangZhang_0-1717411352039.pngHangZhang_1-1717411360971.png

You can config clock2 pin through Chip_SCU_ClockPinMux function.

2. About "set the clock frequency to 1MHz"

HangZhang_2-1717411491277.png

You can config clock through blow functions

Chip_Clock_SetDivider();

Chip_Clock_SetBaseClock();

Chip_Clock_EnableBaseClock();

Or you can download and refer to LPC 18XX examples.

LPCOpen Software for LPC18XX | NXP Semiconductors

Hope this will help you.

BR

Hang

View solution in original post

4 Replies
205 Views
HangZhang
NXP Employee
NXP Employee

Hi @pranavkolte 

You need to configure the Clock Output (CLKOUT) feature correctly. Below are the steps you can follow to achieve this:
1. **Configure the Clock Output Pin:**
Ensure that the CLKOUT function is configured on the appropriate pin (typically this is a specific pin that can be multiplexed to CLKOUT). .
2. **Set the CLKOUT Configuration Register:**
Use the appropriate registers to set the clock source for CLKOUT. 
Step-by-Step Guide
1. **Enable the Clock Output Pin:**
Configure the pin function using the IOCON register. 
2. **Configure the CLKOUT Source:**
Select the clock source and divider for the CLKOUT. This involves writing to the CLKOUTCFG register. The CLKOUTCFG register controls the clock source and the divider for the CLKOUT pin.

3. **Enable the Clock Output Function:**
Ensure that the clock output function is enabled. 

Hope this will help you.

BR

Hang

0 Kudos
201 Views
pranavkolte
Contributor I

Hello @HangZhang 

Thank you for the guidance, I tried it and able to see the frequency now. Can please let me know about how can I set the clock frequency to 1MHz and how to configure the CLK2 to see 1 MHz or send me any example code to do so.

0 Kudos
141 Views
HangZhang
NXP Employee
NXP Employee

Hi

@pranavkolte 

1. Abort "how to configure the CLK2 pin"

HangZhang_0-1717411352039.pngHangZhang_1-1717411360971.png

You can config clock2 pin through Chip_SCU_ClockPinMux function.

2. About "set the clock frequency to 1MHz"

HangZhang_2-1717411491277.png

You can config clock through blow functions

Chip_Clock_SetDivider();

Chip_Clock_SetBaseClock();

Chip_Clock_EnableBaseClock();

Or you can download and refer to LPC 18XX examples.

LPCOpen Software for LPC18XX | NXP Semiconductors

Hope this will help you.

BR

Hang

108 Views
pranavkolte
Contributor I

Hello @HangZhang 

Can you please help or guide me with how can I use tinyusb with my project but I do not want to use the board files . I just want the device should be displayed in device manager, till now what ever I have done it shows this in device manager.

DeviceDescriptorRequestFailed.png.

It will be helpful if you can share a code or project of that.

0 Kudos