waveform4  2.0.0.0
Main Page

Waveform 4 click

Waveform 4 Click is a compact add-on board that represents a high-performance signal generator. This board features the AD9106, a quad-channel, 12-bit, 180MSPS waveform generator, integrating on-chip static random access memory (SRAM) and direct digital synthesis (DDS) for complex waveform generation from Analog Devices. The DDS is up to a 180 MHz master clock sinewave generator with a 24-bit tuning word allowing 10.8 Hz/LSB frequency resolution.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Sep 2021.
  • Type : SPI type

Software Support

We provide a library for the Waveform4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Waveform4 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Waveform 4 click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which resets the registers and sets the sine wave output with default gain and default frequency for all channels. After that it displays the list of supported commands on the USB UART.

void application_init ( void )
{
log_cfg_t log_cfg;
waveform4_cfg_t waveform4_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
waveform4_cfg_setup( &waveform4_cfg );
WAVEFORM4_MAP_MIKROBUS( waveform4_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == waveform4_init( &waveform4, &waveform4_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( WAVEFORM4_ERROR == waveform4_default_cfg ( &waveform4 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Depending on the command character received from USB UART it changes the signal frequency, gain or wave of the selected channel.

void application_task ( void )
{
uint8_t command = 0;
if ( log_read ( &logger, &command, 1 ) > 0 )
{
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Waveform4

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


freq
uint32_t freq
Definition: main.c:34
gain
float gain
Definition: main.c:35
waveform4_init
err_t waveform4_init(waveform4_t *ctx, waveform4_cfg_t *cfg)
Waveform 4 initialization function.
waveform4_cfg_t
Waveform 4 Click configuration object.
Definition: waveform4.h:294
waveform4_t
Waveform 4 Click context object.
Definition: waveform4.h:277
application_task
void application_task(void)
Definition: main.c:96
waveform4_set_frequency
err_t waveform4_set_frequency(waveform4_t *ctx, uint32_t freq)
Waveform 4 set frequency function.
waveform4_parse_command
err_t waveform4_parse_command(uint8_t command)
Waveform 4 parse command function.
Definition: main.c:143
waveform4_set_gain
err_t waveform4_set_gain(waveform4_t *ctx, uint8_t channel, float gain)
Waveform 4 set gain function.
waveform4_default_cfg
err_t waveform4_default_cfg(waveform4_t *ctx)
Waveform 4 default configuration function.
channel
uint8_t channel
Definition: main.c:36
wave
uint8_t wave
Definition: main.c:37
waveform4_cfg_setup
void waveform4_cfg_setup(waveform4_cfg_t *cfg)
Waveform 4 configuration object setup function.
waveform4_set_wave_output
err_t waveform4_set_wave_output(waveform4_t *ctx, uint8_t channel, uint8_t wave)
Waveform 4 set wave output function.
application_init
void application_init(void)
Definition: main.c:59
waveform4_display_commands
void waveform4_display_commands(void)
Waveform 4 display commands function.
Definition: main.c:122
WAVEFORM4_MAP_MIKROBUS
#define WAVEFORM4_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: waveform4.h:261
WAVEFORM4_ERROR
@ WAVEFORM4_ERROR
Definition: waveform4.h:319