|
NetBurner 3.5.7
PDF Version |
Example Path: examples/PlatformSpecific/SOMRT1061/ClockModule
Location: examples/PlatformSpecific/SOMRT1061/ClockModule
Supported Platforms
The Clock Control Module (CCM) generates and controls clocks to the various modules in the design and manages low power modes. This example enables, sets, and displays the available clock sources for the SOMRT1061 platform.
The CCM uses available clock sources to generate clock roots and includes separate dividers to control generation of core and bus root clocks (AXI, AHB, IPG).
| Feature | Description |
|---|---|
| Clock Configuration | Sets external oscillator and RTC crystal |
| Clock Speed Display | Reports all major clock frequencies |
| Clock Root Enumeration | Lists all peripheral clock root frequencies |
| Visual Feedback | LED blink at 2Hz to indicate operation |
AMBA (Arm Advanced Microcontroller Bus Architecture) is an open-standard, on-chip interconnect specification for the connection and management of functional blocks in system-on-a-chip (SoC) designs. AMBA was introduced by Arm in 1996. The first AMBA buses were:
The IPG clock drives the AHB to IP Bridge (AIPSTZ); the IPBus drives chip-specific peripherals
The AIPS bridge serves as a protocol translator between the AHB system bus and the IPbus. The AHB to IP bridge is the interface between the AHB and on-chip IPS peripherals, which are sub-blocks containing readable/writable control and status registers.
The AHB master reads and writes these registers through the AIPSTZ. The bridge generates:
The bridge captures read data from the IPS interface and drives it on the AHB.
Each bridge that connects to the IPS (or peripherals) is referred to as AIPS. The chip has several separate AIPS modules, and peripherals are grouped and assigned under each AIPS block.
The AHB clock drives the high-performance system bus used for high-speed communication between the CPU and high-bandwidth peripherals.
The example consists of three main functions:
Reports all major clock frequencies and clock root frequencies:
| Clock Type | Description |
|---|---|
| Ext OSC | External oscillator frequency (24 MHz) |
| CPU | CPU core clock frequency |
| AHB | AHB bus clock frequency |
| IPG | IPG bus clock and peripheral clock |
| PER | Peripheral clock frequency |
| SEMC | SDRAM controller clock frequency |
Clock roots enumerated:
Toggles LED0 (PIN_78_GPIO4_IO30) at 2Hz to provide visual feedback that the application is running.
Main entry point that:
The 24 MHz external oscillator is multiplied by 88 to generate the 528 MHz system clock.
| LED | Pin | GPIO |
|---|---|---|
| LED0 | PIN_78_GPIO4_IO30 | Used for blink |
| LED1 | PIN_21_GPIO4_IO06 | Not used in example |
| LED2 | PIN_75_GPIO3_IO19 | Not used in example |
| LED3 | PIN_74_GPIO3_IO20 | Not used in example |
Connect a serial terminal to the development board:
Upon startup, the serial console will display:
LED0 will blink at 2Hz (500ms on, 500ms off).
The example uses the following functions from fsl_clock.h:
| Function | Description |
|---|---|
| CLOCK_SetXtalFreq() | Set external crystal oscillator frequency |
| CLOCK_SetRtcXtalFreq() | Set RTC crystal oscillator frequency |
| CLOCK_GetOscFreq() | Get external oscillator frequency |
| CLOCK_GetCpuClkFreq() | Get CPU clock frequency |
| CLOCK_GetAhbFreq() | Get AHB bus frequency |
| CLOCK_GetIpgFreq() | Get IPG bus frequency |
| CLOCK_GetPeriphClkFreq() | Get peripheral clock frequency |
| CLOCK_GetPerClkFreq() | Get PER clock frequency |
| CLOCK_GetSemcFreq() | Get SEMC (SDRAM controller) frequency |
| CLOCK_GetClockRootFreq() | Get specific clock root frequency |
\nburn\arch\cortex-m7\cpu\MIMXRT10xx\includeFor applications using FlexPWM, the IPG clock is the source:
#define PWM_SRC_CLK_FREQ CLOCK_GetFreq(kCLOCK_IpgClk)
To modify clock speeds or add additional clock monitoring:
| Issue | Solution |
|---|---|
| LED not blinking | Check LED0 connection on PIN_78_GPIO4_IO30 |
| No serial output | Verify serial terminal settings (115200 8N1) |
| Assert message | Review serial output for specific error |
| Incorrect frequencies | Ensure crystal oscillators are correct values |