I am trying to configure 8MHz Clock of CLKOUT ( Port/Pin : P1_19)
This clock will be used output for external Peri device
Develop Environment.
- Testing Board : LPC-LINK2
- MCU : LPC4370
- Develop Tools : LPCXpresso (free) and LPCOpen (demo code)
Question
1. How can i set up (configure) CLKOUT Clock out of LPC4370 ?
- what is right setup flow ?,
- where is technical doc or sample code to configure CLKOUT of 8MHz clock?
If you have any example code to configure External Clock, Please Let me know
The following figure is for LPC4370 CGU and You can see CLKOUT in red color
已解决! 转到解答。
Hello LEE Young Jae,
Here I will tell you the step to configure the CLKOUT in P1_19.
1. Select the clock source for CLKOUT in CGU BASE_OUT_CLK, take an example, if you select the crystal oscillator.
Chip_Clock_SetBaseClock(CLK_BASE_OUT, CLKIN_CRYSTAL, true, false);
2. Configure the P1_19 function as CLKOUT in register SFSP[1][19].
From the user manual, you can get that the CLKOUT is the FUNC4.
So, you can use this code to configure it:
Chip_SCU_PinMuxSet(0x1, 19, (SCU_PINIO_FAST | SCU_MODE_FUNC4));
3. About the 8Mhz, a simple way, you can change your external crystal to 8MHZ, then CLKOUT select the 8Mhz, you can get the 8Mhz in CLKOUT pin(P1_19) directly.
4. About the P1_19 test point position, please refer to this picture:
5. About the code, I modify it in the lpcopen systick
Because the external crystal is 12Mhz, then I can get 12Mhz in the P1_19.
You can test it on your side.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello LEE Young Jae,
Here I will tell you the step to configure the CLKOUT in P1_19.
1. Select the clock source for CLKOUT in CGU BASE_OUT_CLK, take an example, if you select the crystal oscillator.
Chip_Clock_SetBaseClock(CLK_BASE_OUT, CLKIN_CRYSTAL, true, false);
2. Configure the P1_19 function as CLKOUT in register SFSP[1][19].
From the user manual, you can get that the CLKOUT is the FUNC4.
So, you can use this code to configure it:
Chip_SCU_PinMuxSet(0x1, 19, (SCU_PINIO_FAST | SCU_MODE_FUNC4));
3. About the 8Mhz, a simple way, you can change your external crystal to 8MHZ, then CLKOUT select the 8Mhz, you can get the 8Mhz in CLKOUT pin(P1_19) directly.
4. About the P1_19 test point position, please refer to this picture:
5. About the code, I modify it in the lpcopen systick
Because the external crystal is 12Mhz, then I can get 12Mhz in the P1_19.
You can test it on your side.
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------