Use CLK2 for diagnosis

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Use CLK2 for diagnosis

跳至解决方案
651 次查看
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 项奖励
回复
1 解答
567 次查看
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

在原帖中查看解决方案

4 回复数
632 次查看
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 项奖励
回复
628 次查看
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 项奖励
回复
568 次查看
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

535 次查看
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 项奖励
回复