AD5770r Console Application
Supported Hardware
Supported Devices:
Supported Evaluation Boards:
Supported Carrier Boards:
Introduction
The AD5770R is a 6-channel, 14-bit resolution, low noise, programmable current output digital-to-analog converter (DAC) for photonics control applications. This chip incorporates a 1.25 V on-chip voltage reference, a 2.5 kΩ precision resistor for reference current generation, die temperature, output monitoring functions, fault alarm, and reset functions.
The AD5770R contains five 14-bit resolution current sourcing DAC channels and one 14-bit resolution current sourcing/ sinking DAC channel.
Channel 0 can be configured to sink up to 60 mA and source up to 300 mA. Channel 1 to Channel 5 have multiple, programmable output current sourcing ranges, set by register access. Each DAC can operate with a wide power supply rail from 0.8 V to AVDD − 0.4 V for optimizing power efficiency and thermal power dissipation.
This page describes the AD5770R firmware example running on the SDP-K1 controller board, interfacing with the AD5770R evaluation board. The firmware example comprises 3 layers of software, It can support Mbed and STM32 platforms.
Console Application - uses the ADI console libraries to provide a basic terminal UI
AD5770R No-OS Driver - AD5770R device C API
Platform Drivers - Hardware Abstraction Layer (SPI, GPIO, …) to adapt No-OS driver
The AD5770R firmware example can be used as a starting point for developing your own code in your own environment. The Platform simplifies the overall software development process by providing a common low level driver abstraction. This reduces the hardware dependency as any Mbed enabled board(or an STM32 board) can be used with same firmware with little to no modifications, usually just changing the pin mapping.
Interface Diagram
The AD5770R Evaluation Board is connected to SDP-K1 using the 120-pin SDP Connector. The evaluation board must be powered externally, typically using an external 3.3V DC supply connected to the AVDD input supply terminal, if using the default power supply jumper settings.
The SDP-K1 is connected to a PC through a USB cable. The firmware image, a .BIN file created using the online mbed compiler, can be loaded into SDP-K1 board by copying the .BIN file to the drive representing the SDP-K1. The SDP-K1 provides a USB to Serial link (UART) and any serial terminal (such as Teraterm, Putty, Coolterm, etc) can be used to connect to by configuring terminal with the necessary settings (serial port, baud rate, data bits, etc).
Note
Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive SDP-K1 GPIOs at 3.3V
Useful Links
Note
Linux and HDL are not used in emebdded IIO firmware projects but they may be of interest if you require Linux and/or FPGA support.
Build Guide
Build Prerequisites
Prior to building a firmware project, it is required to set up an environment so that the build process may find the necessary tools (compiler, linker, SDK etc.). Use the following steps to prepare your environment for building firmware projects for respective platform.
Visit Arm Keil website to create an user account for accessing the web based Keil Studio IDE.
Open Keil Studio Web IDE with registered user account
Clone Precision Converters Firmware repository with the –recursive flag (not needed if building with web IDE for Mbed platform):
git clone --recursive https://github.com/analogdevicesinc/precision-converters-firmware
If however you’ve already cloned the repository without the –recursive flag, you may initialize all the submodules in an existing cloned repo with:
git submodule update --recursive --init
Install Make in the root of ‘C’ drive without any spaces in the installation path. The path must be C:\GnuWin32\…. Add this path into the system environmental path variable (as shown in below screenshot).
Install Git and add a path of C:\Program Files\Git\usr\bin\ directory into system environmental path variable (please verify your git installation path is correct).
Install Mbed CLI 1 as per guide here.
Install GNU Arm Embedded compiler (for the development, 9-2019-q4-major version is used) and add a path of GNU Arm Embedded Toolchain bin directory into the system environmental path variable (as shown in below screenshot).
Configure the compiler location with Mbed CLI. This can be carried out by running the mbed config -G GCC_ARM_PATH <path-to-your-gcc-compiler> in Command Prompt. For example you can run mbed config -G GCC_ARM_PATH “C:\Program Files (x86)\GNU Tools ARM Embedded\9 2019-q4-major\bin” in command prompt. It will set mentioned compiler path to all the Mbed Projects.
Install STM32CubeIDE
Install STM32CubeMX
Building a project
Once the build enviornment is setup, follow the guide below to build your project and generate executable file (.bin/.hex)
Clone the Precision Converters Firmware repository into Keil Studio using “File->clone…” menu.
Once the project repository is imported, wait until all library dependencies are imported as shown in below screenshot. Now, open the ‘.medignore’ file present in the root directory of repository. Add comment syntax (two forward slashes) in front of the project name which you want to build. This will ignore all other projects and build only the comment syntax selected project.
Select the target device (default used for development is SDP-K1) and click on ‘Clean build’ option to build the project. After a successful build a binary will be downloaded to your computer- store this on your drive. Drag and drop this binary to the USB drive hosted by your controller board to flash the MCU.
Note
If you intend to build different project, then modify the .medignore file in the root directory as mentioned in step2 and clean build project as mentioned in step3
Open Git bash and change current directory to project directory (eg. precision-converters-firmware/projects/ad4130_iio directory) which you want to build.
Type make on the git bash command prompt to build a project.
After successful build, binary file will be created into the Project_Name/build directory.
If you want to clean build, type make reset on git bash command which deletes all generated build files for the given project.
Note
Default TARGET_BOARD is SDP_K1 and COMPILER is GCC_ARM. Current Make based build only support GCC_ARM Compiler.
By default project is built for “SDP_K1” Board and “GCC_ARM” Compiler. If you want to build for other Mbed Board, For example If you want to build the project for “DISCO_F769NI” Board then run make TARGET_BOARD=DISCO_F769NI command in git bash command prompt. If you want to clean build, run make reset TARGET_BOARD=DISCO_F769NI command to delete the generated build files for the given project.
Open the respective project directory by navigating into the “precision_converters_firmware/projects/” folder.
In the “STM32” folder present within the project directory, double click and open the .ioc file present within.
Click on the “Generate Code” option seen on the top right corner
Upon successful generation of drivers for the selected MCU, the autogenerated files would be seen in the same directory where the .ioc file was present. Double click and open the “.project” file seen in the list of files
After the project is loaded to the STM32CubeIDE, unfold the adxxxx_iio project seen in the project explorer, right click the “app” folder, select “Settings” under the “C/C++ Build” section on the left pane and un-check the “Exclude resources from build” checkbox. This would ensure that the project specific files are included by the build system
In order to choose STM32 platform in the firmware, select the “ACTIVE_PLATFORM” as “STM32_PLATFORM” in the app_config.h from the respective project. Alternately , add compiler flag “ACTIVE_PLATFORM=value of STM32_PLATFORM in app_config.h” for selecting stm32 platform.
Add compiler flags “-u _printf_float” to the project settings.
Program by clicking on the “Run adxxxx_iio” option seen or by performing a copy->paste option of the .hex file seen in the STM32/Debug folder
Running a project
Once the firmware build is successful and binary file is generated, copy the generated binary into USB drive hosted by your MCU board (e.g. USB drive hosted by SDP-K1 board on windows). This will flash the binary file into MCU present on the controller board. Programming might vary based on the tools used for building a project. The ‘Project Build’ section above talks about this exception at the end of all build steps.
Quick Start
If you have some familiarity with the Mbed or STM32 platform, the following is a basic list of steps required to start running the code, see below for more detail:
Connect the evaluation board to the SDP-K1 controller board, and power it appropriately, usually 3.3V to AVDD.
Connect the SDP-K1 controller board to your computer over USB.
Follow the steps mentioned in the Build Guide section above.
- Start up a serial terminal emulator (e.g. Tera Term)
Find the com-port your controller board is connected on and select it.
Set the baud-rate for 230400
Reset the controller board and connect.
The terminal windows should display the console menu providing access to the AD5770R functionality.
Using the Firmware
The example is menu driven, providing keyboard shortcuts to access/execute the menus items, and prompting for further inputs where necessary. When the example runs, it attempts to connect and initialize the AD5770R. The configuration used is defined in the ad5770r_user_config.h file, which can be modified as needs be to suit specific applications.
Note
While much of the functionality of the AD5770R No-OS driver is made available through the console UI, not all function are available. The additional AD5770R functionality can only be configured the ad5770r_user_config.c file.
DAC Operaions
This menu provides the ability to set the Input and DAC register values, and control the update of the DAC using both the hardware and software LDAC functions. The ordering of menu items is intended to follow the order in which actions are typically performed by the user.
There are three ways in which the DAC output may be controlled using this menu.
Write to Input Channel(s), set software LDAC shadow value, then write software LDAC to update DAC output
Write to Input Channel(s), toggle hardware LDAC
Write to DAC Channel to directly update DAC output
Toggling a channel in the software LDAC shadow sets a bit corresponding to that channel in a mask. This SW LDAC Channel shadow value can then be written in a single transaction, transferring the input to the DAC value for all of the channels which are set in the shadow mask.
The channels affected by the hardware LDAC pin toggling are set in the ad5770r_user_config.h file at compile time.
Note
The toggling of the hardware LDAC is outside of the AD5770R No-OS driver, and as such the DAC values are not updated by this action.
Support
Feel free to ask questions in the EngineerZone