Intermediate
30 min

Convert digital data streams into analog signals with DAC8554 and STM32F446RE

Where data shapes analog potential

DAC 8 Click with Nucleo 64 with STM32F446RE MCU

Published Oct 08, 2024

Click board™

DAC 8 Click

Dev Board

Nucleo 64 with STM32F446RE MCU

Compiler

NECTO Studio

MCU

STM32F446RE

Experience the synergy of precision and transformation with our DAC solution

A

A

Hardware Overview

How does it work?

DAC 8 Click is based on the DAC8554, a 16-bit QUAD channel, ultra-low glitch, voltage-output digital to analog converter from Texas Instruments. It offers good linearity, exceptionally low glitch, and high precision output amplifier, allowing rail-to-rail output swing over a wide supply voltage range. This component additionally has a Power-On reset function, which ensures that DAC outputs power-up at zero-scale and remains there until a proper write operation occurs. Also, it provides a power-down feature that reduces the current consumption to 175nA per channel. An external voltage reference is made user-programmable to achieve a fully flexible range of the DAC8554. For this purpose, the Click board™ uses another DAC, DAC60501, a 12-bit DAC from Texas Instruments, whose output is brought to the

VREF pin of the DAC8554. That way, the reference voltage of the DAC8554 can be set at any value between 0V and 5V, providing high precision and low power consumption as well. That makes the DAC 8 Click a fully customizable solution, well suited for applications where the maximum precision from the output 16-bit DAC is needed. DAC60501 uses the I2C serial interface to communicate with the MCU and operates at a clock rate of up to 100kHz. The DAC 6 Click communicates with MCU using the 3-Wire SPI serial interface compatible with standard SPI, QSPI™, and MICROWIRE™ and operates at clock rates up to 50 MHz. Additional functionality, such as software simultaneous update capability, is implemented and routed at the PWM pin of the mikroBUS™, which allows when new data enter

the device, all DAC outputs can be updated simultaneously and synchronously with the clock. It also possesses enable function routed at the CS pin of the mikroBUS™ that is used to connect the SPI interface to the serial port. This Click Board™ is designed to be operated with both 3.3V and 5V logic levels. The onboard SMD jumper labeled VCC SEL allows voltage selection for interfacing with 3.3V and 5V MCUs. More information about the DAC8554’s functionality, electrical specifications, and typical performance can be found in the attached datasheet. However, the Click board™ comes equipped with a library that contains easy-to-use functions and a usage example that can be used as a reference for the development.

DAC 8 Click top side image
DAC 8 Click bottom side image

Features overview

Development board

Nucleo-64 with STM32F446RE MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin

headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is

provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.

Nucleo 64 with STM32F446RE MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

512

Silicon Vendor

STMicroelectronics

Pin count

64

RAM (Bytes)

131072

You complete me!

Accessories

Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.

Click Shield for Nucleo-64 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
SPI Enable
PC12
RST
SPI Chip Select
PB12
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Software Update
PC8
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB8
SCL
I2C Data
PB9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

DAC 8 Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-64 accessories 1 image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 64 with STM32F446RE MCU as your development board.

Click Shield for Nucleo-64 accessories 1 image hardware assembly
Nucleo 64 with STM32F401RE MCU front image hardware assembly
LTE IoT 5 Click front image hardware assembly
Prog-cut hardware assembly
LTE IoT 5 Click complete accessories setup image hardware assembly
Nucleo-64 with STM32XXX MCU Access MB 1 Mini B Conn - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Clicker 4 for STM32F4 HA MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware 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.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for DAC 8 Click driver.

Key functions:

  • dac8_device_config - This function set configuration of the DAC8554

  • dac8_load_dac - This function simultaneously update DAC with the contents of the corresponding data buffers

  • dac8_set_vref - This function set voltage reference

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 Dac8 Click example
 * 
 * # Description
 * This click carries 12-bit buffered Digital-to-Analog Converter. It converts digital value to 
 * the corresponding voltage level using external voltage reference. 
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization driver enables - I2C.
 * Configure DAC60501: executes call software reset, disable sync and internal reference and 
 * disable Power-down mode, the set reference voltage is internally divided by a factor of 2,
 * amplifier for corresponding DAC has a gain of 2.
 * Initialization driver enables - SPI, enable DAC8554, also write log.
 * 
 * ## Application Task  
 * This is an example that demonstrates the use of the DAC 8 Click board.
 * DAC 8 board changeing output values:
 * Channel A ~ 2500 mV, Channel B ~ 1250 mV,
 * Channel C ~  625 mV, Channel D ~  312 mV.
 * All data logs write on USB uart changes every 5 sec.
 * 
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "dac8.h"

// ------------------------------------------------------------------ VARIABLES

static dac8_t dac8;
static log_t logger;

dac8_cfg_data_t cfg_dac;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    dac8_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.

    dac8_cfg_setup( &cfg );
    DAC8_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    
    dac8_init( &dac8, &cfg, DAC8_MASTER_I2C );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  I2C driver init.   \r\n" );
    Delay_ms( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "      DAC60501       \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "     Soft reset      \r\n" );
    dac8_soft_reset( &dac8 );
    Delay_ms( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  Disable sync. mode \r\n" );
    dac8_enable_sync( &dac8, DAC8_SYNC_DISABLE );
    Delay_ms( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "    Set config.:     \r\n" );
    log_printf( &logger, " Enable:             \r\n" );
    log_printf( &logger, " Internal reference  \r\n" );
    log_printf( &logger, " Disable:            \r\n" );
    log_printf( &logger, " Power-down mode     \r\n" );
    dac8_set_config( &dac8, DAC8_CONFIG_REF_PWDWN_ENABLE, DAC8_CONFIG_DAC_PWDWN_DISABLE );
    Delay_ms( 100 );
    
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  Vref divided by 2  \r\n" );
    log_printf( &logger, "  Set DAC gain of 2  \r\n" );
    dac8_set_gain( &dac8, DAC8_GAIN_REF_DIV_2, DAC8_GAIN_BUFF_GAIN_1 );
    Delay_ms( 100 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, " Set Vref ~ 2500 mV  \r\n" );
    dac8_set_vref( &dac8, 2500 );
    Delay_ms( 1000 );

    dac8_init( &dac8, &cfg, DAC8_MASTER_SPI );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "  SPI driver init.   \r\n" );
    Delay_ms( 1000 );
    
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "       DAC8554       \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "    Enable DAC8554   \r\n" );
    dac8_device_enable( &dac8, DAC8_DAC8554_ENABLE );
    Delay_ms( 100 );
}

void application_task ( void )
{
    log_printf( &logger, "---------------------\r\n" );
    
    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_A;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0xFFFF;
    
    log_printf( &logger, " Channel A ~ 2500 mV \r\n" );
    dac8_device_config( &dac8, cfg_dac );
    dac8_load_dac(  &dac8 );
    Delay_ms( 5000 );
    
    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_B;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x7FFF;

    log_printf( &logger, " Channel B ~ 1250 mV \r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac( &dac8 );
    Delay_ms( 5000 );
    
    log_printf( &logger, "---------------------\r\n" );
    
    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_C;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x3FFF;

    log_printf( &logger, " Channel C ~  625 mV \r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac( &dac8 );
    Delay_ms( 5000 );
    
    log_printf( &logger, "---------------------\r\n" );

    cfg_dac.addr = DAC8_ADDR_DEFAULT;
    cfg_dac.ctrl_upd_an_out = DAC8_CTRL_UPD_AN_OUT_SINGLE_CH_STORE;
    cfg_dac.dac_sel = DAC8_DAC_SEL_CH_D;
    cfg_dac.pwr_mode = DAC8_PWR_MODE_POWER_UP;
    cfg_dac.dac_val = 0x1FFF;

    log_printf( &logger, " Channel D ~  312 mV\r\n" );
    dac8_device_config(  &dac8, cfg_dac );
    dac8_load_dac(  &dac8 );
    Delay_ms( 5000 );
}

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.