fmeas#
Overview#
This example shows how to use SDK drivers to use the Frequency Measure feature of SYSCON module. It shows how to measure a target frequency using a (faster) reference frequency. The example uses the internal main clock as the reference frequency to measure the frequencies of the RTC, watchdog oscillator, and internal RC oscillator.
Supported Boards#
EVK-MIMXRT595
Hardware requirements
Micro USB cable
EVK-MIMXRT595 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J40) on the board
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: External clock (clk_in) (main system clock reference), reference frequency = 198000000 Hz
Computed frequency value = 23999410 Hz
Expected frequency value = 24000000 Hz
Capture source: LPOSC clock (main system clock reference), reference frequency = 198000000 Hz
Computed frequency value = 813468 Hz
Expected frequency value = 1000000 Hz
Capture source: FRO192M clock (main system clock reference), reference frequency = 198000000 Hz
Computed frequency value = 152082435 Hz
Expected frequency value = 192000000 Hz
EVK-MIMXRT685
Hardware requirements
Micro USB cable
EVK-MIMXRT685 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J5) on the board
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: External clock (clk_in) (main system clock reference), reference frequency = 250105263 Hz
Computed frequency value = 23999301 Hz
Expected frequency value = 24000000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 250105263 Hz
Computed frequency value = 5001265 Hz
Expected frequency value = 5002105 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 48000000 Hz
Computed frequency value = 52240185 Hz
Expected frequency value = 48000000 Hz
FRDM-RW612
Hardware requirements
Micro USB cable
FRDM-RW612 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the MCU-Link USB port (J10) on the board
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: External clock (clk_in) (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 39999160 Hz
Expected frequency value = 40000000 Hz
Capture source: SFRO clock (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 15999069 Hz
Expected frequency value = 16000000 Hz
Capture source: FFRO clock (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 48301200 Hz
Expected frequency value = 48301886 Hz
LPCXpresso51U68
Hardware requirements
Mini/micro USB cable
LPCXpresso51U68 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J6) on the board
Open a serial terminal with the following settings (See Appendix A in Getting started guide for description how to determine serial port number):
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: Watchdog oscillator (main clock reference), reference frequency = 48000000 Hz
Computed frequency value = 603515 Hz
Expected frequency value = 500000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 48000000 Hz
Computed frequency value = 32226 Hz
Expected frequency value = 32768 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 48000000 Hz
Computed frequency value = 11997070 Hz
Expected frequency value = 12000000 Hz
LPCXpresso54628
Hardware requirements
Micro USB cable
LPCLPCXpresso54628 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the host PC and the LPC-Link USB port (J8) on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: Watchdog oscillator (main clock reference), reference frequency = 220000000 Hz
Computed frequency value = 577392 Hz
Expected frequency value = 500000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 220000000 Hz
Computed frequency value = 26855 Hz
Expected frequency value = 32768 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 220000000 Hz
Computed frequency value = 11990966 Hz
Expected frequency value = 12000000 Hz
LPCXpresso54S018
Hardware requirements
Micro USB cable
LPCLPCXpresso54S018 board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the host PC and the LPC-Link USB port (J8) on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
This demo is an external flash plain load demo, ROM will copy image in external flash to SRAMX to run:
Build the demo to generate a bin file. Note: If need to generate bin file using MCUXpresso IDE, below steps need to be followed: Set in example Properties->C/C++ Build->Settings->Build steps->Post-build steps->Edit enbable arm-none-eabi-objcopy -v -O binary “&{BuildArtifactFileName}” “&{BuildArtifactFileBaseName}.bin”
This plainload example linked the vector table to 0x00000000, but program to external flash 0x10000000.
Program the bin file to external on board flash via SEGGER J-FLASH Lite(V6.22 or higher):
a. Open SEGGER J-FLASH Lite, select device LPC54S018.
b. Click the ‘Erase Chip’ to erase the extrenal flash.(if can not success, press SW4 button and reset the board, and try to erase again)
c. Select the bin data file, set the ‘.bin/Erase Start’ address to 0x10000000, then click ‘Program Device’ Note: Please use above way to program the binary file built by armgcc tool chain to external flash. For IAR, KEIL, MCUXpresso IDE, you can use the IDE tool to program the external flash.
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: Watchdog oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 582275 Hz
Expected frequency value = 500000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 21972 Hz
Expected frequency value = 32768 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 11997070 Hz
Expected frequency value = 12000000 Hz
LPCXpresso54S018M
Hardware requirements
Micro USB cable
LPCLPCXpresso54S018M board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the host PC and the LPC-Link USB port (J8) on the target board.
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
This demo is an external flash plain load demo, ROM will copy image in external flash to SRAMX to run:
Build the demo to generate a bin file. Note: If need to generate bin file using MCUXpresso IDE, below steps need to be followed: Set in example Properties->C/C++ Build->Settings->Build steps->Post-build steps->Edit enbable arm-none-eabi-objcopy -v -O binary “&{BuildArtifactFileName}” “&{BuildArtifactFileBaseName}.bin”
This plainload example linked the vector table to 0x00000000, but program to external flash 0x10000000.
Program the bin file to external on board flash via SEGGER J-FLASH Lite(V6.22 or higher):
a. Open SEGGER J-FLASH Lite, select device LPC54S018M.
b. Click the ‘Erase Chip’ to erase the extrenal flash.(if can not success, press SW4 button and reset the board, and try to erase again)
c. Select the bin data file, set the ‘.bin/Erase Start’ address to 0x10000000, then click ‘Program Device’ Note: Please use above way to program the binary file built by armgcc tool chain to external flash. For IAR, KEIL, MCUXpresso IDE, you can use the IDE tool to program the external flash.
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: Watchdog oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 582275 Hz
Expected frequency value = 500000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 21972 Hz
Expected frequency value = 32768 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 180000000 Hz
Computed frequency value = 11997070 Hz
Expected frequency value = 12000000 Hz
MIMXRT685-AUD-EVK
Hardware requirements
Micro USB cable
MIMXRT685-AUD-EVK board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J5) on the board
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: External clock (clk_in) (main system clock reference), reference frequency = 250105263 Hz
Computed frequency value = 23999301 Hz
Expected frequency value = 24000000 Hz
Capture source: RTC32K oscillator (main clock reference), reference frequency = 250105263 Hz
Computed frequency value = 5001265 Hz
Expected frequency value = 5002105 Hz
Capture source: FRO oscillator (main clock reference), reference frequency = 48000000 Hz
Computed frequency value = 52240185 Hz
Expected frequency value = 48000000 Hz
RD-RW612-BGA
Hardware requirements
Micro USB cable
RD-RW612-BGA board
Personal Computer
Board settings
No special settings are required.
Prepare the Demo
Connect a micro USB cable between the PC host and the MCU-Link USB port (J7) on the board
Open a serial terminal with the following settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Launch the debugger in your IDE to begin running the demo.
Running the demo
The log below shows example output of the frequency measure demo in the terminal window:
Capture source: External clock (clk_in) (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 39999160 Hz
Expected frequency value = 40000000 Hz
Capture source: SFRO clock (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 15999069 Hz
Expected frequency value = 16000000 Hz
Capture source: FFRO clock (main system clock reference), reference frequency = 260000000 Hz
Computed frequency value = 48301200 Hz
Expected frequency value = 48301886 Hz