- Order number: MIKROE-3309
- Manufacturer product ID: MIKROE-3309
How Does It Work?
The main component of the Waveform click is the AD9833, a low-power, programmable waveform generator, produced by Analog Devices. This company is well-established in the market of high-quality Digital Signal Processing (DSP) solutions. The AD9833 IC is based on the Direct Digital Synthesis (DDS), producing a waveform with the programmable frequency and selectable wave shape at its output. The AD9833, along with the AD5227, a digital potentiometer IC from the same company is controlled over the SPI interface, allowing both the frequency and the amplitude to be changed very quickly, without additional latency.
DDS is a method of producing an analog waveform, by exploiting the fact that the phase of the signal is changed linearly. For simple periodic functions such as the sine function, the phase changes linearly between 0 and 2π. This allows to build the Numerically Controlled Oscillator (NCO) block, which outputs a numerical value that linearly changes over time, in the range between 0 and 228 – 1 (since the AD9833 IC has a 28-bit phase accumulator). The continuously changing output of the NCO block is used as the index for the Lookup Table (LUT) which contains amplitudes of the output waveform. The faster the NCO output changes, the higher the frequency of the output signal, which is a basis for DDS. The main advantage over some other types of synthesis (PLL for example), is its simplistic approach. The frequency can be changed in very small steps (depending on the clock generator), while the maximum frequency can easily reach GHz.
Besides the NCO and the LUT, the AD9833 contains other blocks, necessary to produce the waveform at the output. It also features a 10-bit DAC, which allows the digital value to be translated into an analog voltage at the output. Since the ADC is only 10 bits wide, there is no need for the LUT to have too many elements. The resolution of the ADC is the bottleneck, so just a slightly higher resolution is required for the LUT data. This further reduces the complexity and costs. The AD9833 can completely avoid using the LUT, producing a square wave (by using only the MSB of the DAC), with the frequency that can be further multiplied by 2, and triangle wave (by redirecting the NCO directly to DAC instead using it for sweeping through the LUT). The operating modes of the AD9833 can be set up by using the config register over the SPI interface. For more detailed information about the AD9833 IC, please refer to the datasheet of the AD9833. However, the mikroSDK compatible library contains functions that simplify working with the AD9833 IC.
The output of the AD9833 is routed to the AD5227 digital potentiometer, which is used to set the amplitude of the output signal. This potentiometer is used to scale down the amplitude in the range between 0V and 3.3V. It is controlled over the SPI interface. The potentiometer is used since the AD9833 IC does not provide means to regulate the amplitude of the signal at the output.
Waveform click uses the clock generator of 25MHz, which allows changing the frequency in steps of 0.1Hz. High speed of the clock allows very high frequencies to be produced, so this Click board™ can generate a very clean sine wave with the frequency up to 5MHz, and square wave with the frequency up to 12MHz. The integrated clock generator offers a STAND-BY pin, which is used to enable or disable the clock. If there is a HIGH logic state on this pin, the clock generator will produce 25MHz clock signal. This pin is pulled to VCC by a pull-up resistor, so by default the 25MHz clock generator is enabled.
The output signal of the Click board™ is buffered by a low-noise op-amp, which provides a constant impedance and limited protection to the whole circuit. It is available over the SMA connector, allowing the shielded coaxial cable to be used.
Specifaction
Type | Measurements |
Applications | It can be used in various applications, including test equipment, frequency sweep/clock generators, line loss or attenuation testers, waveform generators, in fluid flow measuring applications, and other similar applications that require pulse, triangle, or sinusoidal waveform for their operation. |
On-board modules | AD9833, a low-power, programmable waveform generator; AD5227, a 64-position digital potentiometer; ADA4891, a high speed, rail-to-rail operational amplifier; all ICs from Analog Devices. |
Key Features | Simple yet powerful waveform generator based on DSS, low power consumption, 0 to 12MHz(5MHz sine) in steps of 0.1 Hz, 28-bit accumulator resolution, integrated sinewave ROM LUT, high-quality SMA connector for the signal protection, etc. |
Interface | SPI |
Input Voltage | 3.3V |
Click board size | M (42.9 x 25.4 mm) |
Pinout Diagram
This table shows how the pinout on Waveform Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard Settings And Indicatores
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED indicator |
CN1 | OUTPUT | - | Output signal connector |
Software Support
We provide a library for the Waveform Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library contains generic functions for controlling the waveform and frequency
output of the click board.
Key functions:
void waveform_sineOutput(uint32_t f)
- Function for setting the sine wave output.void waveform_triangleOutput(uint32_t f)
- Function for setting the triangle wave output.void waveform_squareOutput(uint32_t f)
- Function for setting the square wave output.
Examples description
The application is composed of the three sections :
- System Initialization - Initialize the GPIO and communication structures.
- Application Initialization - Initialization driver init, default configuration and sets first volume.
- Application Initialization - Initialize the communication interface and configure the click board.
- Application Task - Predefined characters are inputed from the serial port. Depending on the character sent the signal frequency, waveform or amplitude will be changed.
void applicationTask() { char rxDat; uint32_t freqTmp; if(UART_Rdy_Ptr()) { rxDat = UART_Rd_Ptr(); mikrobus_logWrite(&rxDat,_LOG_BYTE); } if(rxDat>0) { switch(rxDat) { case waveform_cmd[0]: { waveform_digipotInc(); rxDat = 0; break; } case waveform_cmd[1]: { waveform_digipotDec(); rxDat = 0; break; } case waveform_cmd[2]: { freq += 1; freqTmp = freq << 14; waveform_sineOutput(freqTmp); rxDat = 0; break; } case waveform_cmd[3]: { freq -= 1; freqTmp = freq << 14; waveform_sineOutput(freqTmp); rxDat = 0; break; } case waveform_cmd[4]: { freq += 1; freqTmp = freq << 14; waveform_triangleOutput(freqTmp); rxDat = 0; break; } case waveform_cmd[5]: { freq -= 1; freqTmp = freq << 14; waveform_triangleOutput(freqTmp); rxDat = 0; break; } case waveform_cmd[6]: { freq += 1; freqTmp = freq << 14; waveform_squareOutput(freqTmp); rxDat = 0; break; } case waveform_cmd[7]: { freq -= 1; freqTmp = freq << 14; waveform_squareOutput(freqTmp); rxDat = 0; break; } default : { break; } } } rxDat = 0; }
Additional Functions :
uint32_t waveform_aproxFreqcalculation(float freqency)
- This function is used to calculate the aproximate value that will be written to the frequency set register.
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
SPI
UART
Conversions
C_Sring
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.
MikroSDK
This click board is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.