Intermediate
30 min

Unleash the power of signal conversion with DAC53202 and TM4C123GH6PZ

Digital pulse, analog soul

DAC 14 Click with Fusion for Tiva v8

Published Aug 21, 2023

Click board™

DAC 14 Click

Dev. board

Fusion for Tiva v8

Compiler

NECTO Studio

MCU

TM4C123GH6PZ

Whether in scientific instrumentation, telecommunications, or audio equipment, our DAC solution empowers users to generate precise analog outputs from digital inputs, serving as a universal translator between digital and analog domains

A

A

Hardware Overview

How does it work?

DAC 14 Click is based on the DAC53202, a 10-bit dual-channel buffered digital-to-analog converter from Texas Instruments. The DAC channels are independently configurable as voltage or current output, achieved through the population of resistors R6 and R7. By default, these resistors are populated, and the Click board™ works in voltage-output mode providing output voltage in a range from 0V to 5V; they need to be removed to use current-output mode. Both the voltage- and current-output modes support multiple programmable output ranges. In addition to the internal voltage reference of 1.21V, the DAC53202 can also have an external reference using mikroBUS™ power rails as a reference voltage. The DAC53202 supports Hi-Z Power-Down mode putting its output in Hi-Z state during Power-OFF conditions, maintaining low leakage current at the

output channels with up to 1.25V of forced voltage. Besides, it also supports an independent comparator mode for each channel. The comparator mode allows programmable hysteresis, latching comparator, window comparator, and fault-dump to the nonvolatile memory (NVM). These features enable the DAC53202 to surpass a conventional DAC's limitations, resulting in processor-less operation. These features make the DAC53202 an excellent choice for voltage margining and scaling applications, DC set-point for biasing and calibration, and waveform generation (predefined sine, cosine, triangular, and sawtooth). DAC 14 Click allows using I2C and SPI interfaces with a maximum frequency of 1MHz for I2C and 50MHz for SPI communication. The selection can be made by positioning SMD jumpers marked as

COMM SEL to an appropriate position. Note that all the jumpers must be on the same side, or the Click board™ may become unresponsive. It also allows the choice of the four least significant bits of its I2C address by positioning the SMD jumper ADDR SEL to an appropriate position providing the user with a selection of four addresses. The DAC53202 also possesses an additional general-purpose GP pin, routed to the INT pin of the mikroBUS™ socket, configured as multiple interrupt functions. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, 3.3V and 5V capable MCUs can use the communication properly. Also, this 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.

DAC 14 Click hardware overview image

Features overview

Development board

Fusion for TIVA v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different 32-bit ARM® Cortex®-M based MCUs from Texas Instruments, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over a WiFi network. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for TIVA v8 provides a fluid and immersive working experience, allowing access

anywhere and under any circumstances at any time. Each part of the Fusion for TIVA v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for TIVA v8 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.

Fusion for Tiva v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

256

Silicon Vendor

Texas Instruments

Pin count

100

RAM (Bytes)

32768

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
SPI Chip Select
PF7
CS
SPI Clock
PK0
SCK
SPI Data OUT
PK2
MISO
SPI Data IN
PK3
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
General Purpose I/O
PH4
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PA6
SCL
I2C Data
PA7
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

DAC 14 Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for Tiva v8 as your development board.

Fusion for PIC v8 front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
v8 SiBRAIN 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 Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for DAC 14 Click driver.

Key functions:

  • dac14_set_dac_data - This function sets the raw DAC data for the selected DAC channel

  • dac14_start_function_gen - This function starts the function generator for the selected DAC channel

  • dac14_config_function_gen - This function configures the function generator for the selected DAC channel

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 main.c
 * @brief DAC 14 Click example
 *
 * # Description
 * This example demonstrates the use of DAC 14 click board by changing the voltage level
 * on the OUT0 as well as the waveform signals from a function generator on the OUT1.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * Changes the voltage level on the OUT0 as well as the waveform signals from a function
 * generator on the OUT1 every 3 seconds. The state of both outputs will be displayed
 * on the USB UART.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "dac14.h"

static dac14_t dac14;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    dac14_cfg_t dac14_cfg;  /**< Click config object. */

    /** 
     * 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.
    dac14_cfg_setup( &dac14_cfg );
    DAC14_MAP_MIKROBUS( dac14_cfg, MIKROBUS_1 );
    err_t init_flag = dac14_init( &dac14, &dac14_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( DAC14_ERROR == dac14_default_cfg ( &dac14 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    static uint16_t dac = 0;
    static uint8_t waveform = DAC14_WAVEFORM_TRIANGULAR;
    if ( DAC14_OK == dac14_set_dac_data ( &dac14, DAC14_SEL_DAC_0, dac ) )
    {
        log_printf( &logger, "\r\n OUT0: %u -> %.2f V\r\n", 
                    dac, ( float ) dac * DAC14_VDD_3V3 / DAC14_DAC_DATA_MAX );
        dac += 100;
        if ( dac > DAC14_DAC_DATA_MAX )
        {
            dac = DAC14_DAC_DATA_MIN;
        }
    }
    err_t error_flag = dac14_stop_function_gen ( &dac14, DAC14_SEL_DAC_1 );
    error_flag |= dac14_config_function_gen ( &dac14, DAC14_SEL_DAC_1, waveform,
                                              DAC14_CODE_STEP_32_LSB, DAC14_SLEW_RATE_4_US );
    error_flag |= dac14_start_function_gen ( &dac14, DAC14_SEL_DAC_1 );
    if ( DAC14_OK == error_flag )
    {
        log_printf( &logger, " OUT1: " );
        switch ( waveform )
        {
            case DAC14_WAVEFORM_TRIANGULAR:
            {
                log_printf( &logger, "triangular wave at about 4kHz\r\n" );
                waveform = DAC14_WAVEFORM_SAWTOOTH;
                break;
            }
            case DAC14_WAVEFORM_SAWTOOTH:
            {
                log_printf( &logger, "sawtooth wave at about 7.8kHz\r\n" );
                waveform = DAC14_WAVEFORM_INV_SAWTOOTH;
                break;
            }
            case DAC14_WAVEFORM_INV_SAWTOOTH:
            {
                log_printf( &logger, "inverse sawtooth wave at about 7.8kHz\r\n" );
                waveform = DAC14_WAVEFORM_SINE;
                break;
            }
            case DAC14_WAVEFORM_SINE:
            {
                log_printf( &logger, "sine wave at about 10.7kHz\r\n" );
                waveform = DAC14_WAVEFORM_DISABLE;
                break;
            }
            case DAC14_WAVEFORM_DISABLE:
            {
                log_printf( &logger, "function generator disabled\r\n" );
                waveform = DAC14_WAVEFORM_TRIANGULAR;
                break;
            }
            default:
            {
                log_printf( &logger, "unknown state\r\n" );
                break;
            }
        }
    }
    Delay_ms ( 3000 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

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

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.