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
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping 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
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
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
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_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