30 min

Create accurate square-wave pulses with LTC6904 and ATmega328P for limitless possibilities

Timing perfected

Clock Gen 3 Click with Arduino UNO Rev3

Published Feb 14, 2024

Click board™

Clock Gen 3 Click


Arduino UNO Rev3


NECTO Studio



Unlock seamless synchronization and precise timing in your engineering projects with a powerful clock generator



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.

Clock Gen 3 Click top side image
Clock Gen 3 Click lateral side image
Clock Gen 3 Click bottom side image

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.

Arduino UNO Rev3 double side image

Microcontroller Overview

MCU Card / MCU




MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


You complete me!


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.

Click Shield for Arduino UNO accessories 1 image

Used MCU Pins

mikroBUS™ mapper

Output Enable
Power Supply
I2C Clock
I2C Data
Power Supply

Take a closer look


Clock Gen 3 Click Schematic schematic

Step by step

Project assembly

Click Shield for Arduino UNO front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Arduino UNO Rev3 as your development board.

Click Shield for Arduino UNO front image hardware assembly
Arduino UNO Rev3 front image hardware assembly
Charger 27 Click front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Arduino UNO Rev3 Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Arduino UNO MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for Clock Gen 3 Click driver.

Key functions:

  • void clockgen3_set_freq( float freq ) - Sets Frequency
  • void clockgen3_config( uint8_t cfg ) - Configuration

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

 * \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_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( 3000 );
    log_printf( &logger, ">> Set Freq = 8.000 MHz \r\n" );
    clockgen3_set_freq( &clockgen3, 8000.0 );
    Delay_ms( 3000 );
    log_printf( &logger, ">> Set Freq = 5.500 MHz \r\n" );
    clockgen3_set_freq( &clockgen3, 5500.0 );
    Delay_ms( 3000 );
    log_printf( &logger, ">> Set Freq = 2.700 MHz \r\n" );
    clockgen3_set_freq( &clockgen3, 2700.0 );
    Delay_ms( 3000 );
    log_printf( &logger, ">> Set Freq = 800 KHz \r\n" );
    clockgen3_set_freq( &clockgen3, 800.0 );
    Delay_ms( 3000 );
    log_printf( &logger, ">> Set Freq = 200 KHz \r\n" );
    clockgen3_set_freq( &clockgen3, 200.0 );
    Delay_ms( 3000 );
    log_printf( &logger, "---------------------------- \r\n" );

void main ( void )
    application_init( );

    for ( ; ; )
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support