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
EasyAVR v7 is the seventh generation of AVR development boards specially designed for the needs of rapid development of embedded applications. It supports a wide range of 16-bit AVR microcontrollers from Microchip and has a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB. The development board is well organized and designed so that the end-user has all the necessary elements in one place, such as switches, buttons, indicators, connectors, and others. With four different connectors for each port, EasyAVR v7 allows you to connect accessory boards, sensors, and custom electronics more
efficiently than ever. Each part of the EasyAVR v7 development board contains the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-12V AC or 9-15V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B)
connector. Communication options such as USB-UART and RS-232 are also included, alongside the well-established mikroBUS™ standard, three display options (7-segment, graphical, and character-based LCD), and several different DIP sockets which cover a wide range of 16-bit AVR MCUs. EasyAVR v7 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
2048
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
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
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