Unlock seamless synchronization and precise timing in your engineering projects with a powerful clock generator
A
A
Hardware Overview
How does it work?
Clock Gen 3 Click is based on the LTC6904 IC, 1kHz to 68MHz Serial Port Programmable Oscillator from Linear Technology. The LTC6904 is a low-power self-contained digital frequency source providing a precision frequency from 1KHz to 68MHz, set by the I2C interface operating up to 3.4 Mbps. This Click board™ features onboard I2C address jumpers, pull-up resistors, a power supply bypass capacitor, and a power LED. The maximum frequency error is 1.1% or 1.6% when operating with a flexible power supply voltage range from 2.7V to 5V, which makes it suitable for 3.3V and 5V MCUs. In most frequency ranges, the output of the Clock Gen 3 Click is generated as a division of the higher internal clock frequency. This helps to minimize jitter and subharmonics at the output of the device.
In the highest frequency ranges, the division ratio is reduced, which will result in a greater cycle-to-cycle jitter as well as spurs at the internal sampling frequency. Because the internal control loop runs at 1MHz to 2MHz without regard to the output frequency, output spurs separated from the set frequency by 1MHz to 2MHz may be observed. These spurs are characteristically more than 30dB below the level of the set frequency. The LTC6904 communicates with the MCU using the standard I2C 2-wire interface. The two bus lines, SDA and SCL, must be HIGH when the bus is not in use. If the I2C interface is not driven with a standard I2C compatible device, care must be taken to ensure that the SDA line is released during the ACK cycle to prevent bus contention.
The LTC6904 can respond to one of two 7-bit addresses. The first 6 bits (MSBs) have been factory programmed to 001011. The address pin, ADR (Pin 4), is programmed by the user and determines the LSB of the slave address, and it can be selected by an onboard SMD jumper labeled as ADD SEL, allowing selection of the slave address LSB. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output via Debug Mode
1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.
2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.
Software Support
Library Description
This library contains API for Clock Gen 3 Click driver.
Key functions:
void clockgen3_set_freq( float freq )
- Sets Frequencyvoid clockgen3_config( uint8_t cfg )
- Configuration
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief ClockGen3 Click example
*
* # Description
* This example demonstrates the use of Clock Gen 3 click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and configures the click board.
*
* ## Application Task
* Sets different frequencies every 3 seconds and displays the set frequency
* on the USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "clockgen3.h"
// ------------------------------------------------------------------ VARIABLES
static clockgen3_t clockgen3;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
clockgen3_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
clockgen3_cfg_setup( &cfg );
CLOCKGEN3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
clockgen3_init( &clockgen3, &cfg );
clockgen3_config( &clockgen3, CLOCKGEN3_CFG_ON_CLK_180 );
Delay_ms ( 500 );
}
void application_task ( void )
{
log_printf( &logger, ">> Set Freq = 12.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 12000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 8.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 8000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 5.500 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 5500.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 2.700 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 2700.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 800 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 800.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 200 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 200.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------- \r\n" );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief ClockGen3 Click example
*
* # Description
* This example demonstrates the use of Clock Gen 3 click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and configures the click board.
*
* ## Application Task
* Sets different frequencies every 3 seconds and displays the set frequency
* on the USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "clockgen3.h"
// ------------------------------------------------------------------ VARIABLES
static clockgen3_t clockgen3;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
clockgen3_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
clockgen3_cfg_setup( &cfg );
CLOCKGEN3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
clockgen3_init( &clockgen3, &cfg );
clockgen3_config( &clockgen3, CLOCKGEN3_CFG_ON_CLK_180 );
Delay_ms ( 500 );
}
void application_task ( void )
{
log_printf( &logger, ">> Set Freq = 12.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 12000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 8.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 8000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 5.500 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 5500.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 2.700 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 2700.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 800 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 800.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 200 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 200.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------- \r\n" );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief ClockGen3 Click example
*
* # Description
* This example demonstrates the use of Clock Gen 3 click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and configures the click board.
*
* ## Application Task
* Sets different frequencies every 3 seconds and displays the set frequency
* on the USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "clockgen3.h"
// ------------------------------------------------------------------ VARIABLES
static clockgen3_t clockgen3;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
clockgen3_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
clockgen3_cfg_setup( &cfg );
CLOCKGEN3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
clockgen3_init( &clockgen3, &cfg );
clockgen3_config( &clockgen3, CLOCKGEN3_CFG_ON_CLK_180 );
Delay_ms ( 500 );
}
void application_task ( void )
{
log_printf( &logger, ">> Set Freq = 12.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 12000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 8.000 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 8000.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 5.500 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 5500.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 2.700 MHz \r\n" );
clockgen3_set_freq( &clockgen3, 2700.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 800 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 800.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, ">> Set Freq = 200 KHz \r\n" );
clockgen3_set_freq( &clockgen3, 200.0 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, "---------------------------- \r\n" );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END