How do you configure the clocks in the PSoC® 4000 device?
Clock sources in PSoC 4000 are of two types: high frequency and low frequency. High-frequency clock sources include the internal main oscillator (IMO) and external clock (EXTCLK), and their derived clocks – system clock (SYSCLK) and high-frequency clock (HFCLK). Low-frequency clock sources include internal low-speed oscillator (ILO) and its derived clock – low-frequency clock (LFCLK). The clocks are configured in the cydwr file of the PSoC Creator™ project. Open the [ProjectName].cydwr file from the Workspace and click the Clocks tab.
To edit the high-frequency clock, select any high-frequency clock source and click the Edit Clock button. The Configure System Clocks Window shown in Figure 1 will open.
Figure 1. Configure System Clocks Window – High Frequency Clocks
The High Frequency Clocks tab allows you to
- Enable or disable the IMO and EXTCLK.
- Select the clock source for the HFCLK as IMO or EXTCLK.
- Configure the IMO, HFCLK, and SYSCLK frequency.
- Set the divider for the HFCLK to ‘1’, ‘2’, ‘4’, or ‘8’.
- Set the divider for the SYSCLK to ‘1’, ‘2’, ‘4’, or ‘8’.
To edit the low-frequency clock, click the Low Frequency Clocks tab in the Configure System Clocks window. See Figure 2 for reference.
Figure 2. Configure System Clocks Window - Low Frequency Clocks
This tab allows you to
- Enable or disable the ILO and watchdog timer (WDT) block.
- Configure the mode of the WDT block as general-purpose free-running timer or as watchdog timer.
- Set the period of the WDT block.
- Select between auto-generated interrupt service routine and custom (user) routine.
For more information on low-frequency clock and WDT configuration, refer to the LFCLK Component datasheet from the System Reference Guide (accessed from the Help menu of PSoC Creator).