Wiki

This version (24 Jan 2021 18:38) was approved by Dragos Bogdan.The Previously approved version (22 Jul 2019 11:22) is available.Diff

AD7193 - No-OS Driver for Renesas Microcontroller Platforms

Supported devices

Evaluation Boards

Overview

The AD719X family is composed of a low noise, complete analog front end for high precision measurement applications. It contains a low noise, 24-bit sigma-delta (Σ-Δ) analog-to-digital converter (ADC). The on-chip low noise gain stage means that signals of small amplitude can interface directly to the ADC.

The on-chip channel sequencer allows several channels to be enabled simultaneously, and the AD719X sequentially converts on each enabled channel, simplifying communication with the part. The on-chip 4.92 MHz clock can be used as the clock source to the ADC or, alternatively, an external clock or crystal can be used. The output data rate from the part can be varied from 4.7 Hz to 4.8 kHz.

The device has a very flexible digital filter, including a fast settling option. Variables such as output data rate and settling time are dependent on the option selected. The AD7193 also includes a zero latency option.

AD7190 operates with 5 V analog power supply and a digital power supply from 2.7 V to 5.25 V. It consumes a current of 6 mA. It is housed in a 24-lead TSSOP package.

AD7192 operates with a power supply from 3 V to 5.25 V. It consumes a current of 4.35 mA. It is housed in a 24-lead TSSOP package.

AD7193 operates with a power supply from 3 V to 5.25 V. It consumes a current of 4.65 mA, and it is available in a 28-lead TSSOP package and a 32-lead LFCSP package.

AD7194 operates with a power supply from 3 V to 5.25 V. It consumes a current of 4.65 mA, and it is housed in a 32-lead LFCSP package.

AD7195 operates with a 5 V analog power supply and a digital power supply from 2.7 V to 5.25 V. It consumes a current of 6 mA. It is housed in a 32-lead LFCSP package.

Applications

  • Weigh scales
  • Strain gage transducers
  • Pressure measurement
  • Pressure measurement
  • Temperature measurement
  • Chromatography
  • PLC/DCS analog input modules
  • Data acquisition
  • Medical and scientific instrumentation

ADI No-OS

The goal of ADI Microcontroller No-OS is to be able to provide reference projects for lower end processors, which can't run Linux, or aren't running a specific operating system, to help those customers using microcontrollers with ADI parts. ADI No-OS offers generic drivers which can be used as a base for any microcontroller platform and also example projects which are using these drivers on various microcontroller platforms.

For more information about ADI No-OS and supported microcontroller platforms see: no-OS

Driver Description

The source code for AD719X driver can be found here:

The driver also uses the ADI util library, so make sure you also add the necessary files in your project. The source code for the util library can be found here:

The driver contains three parts:

  • The driver for the AD719X part, which may be used, without modifications, with any microcontroller.
  • The Communication Driver, where the specific communication functions for the desired type of processor and communication protocol have to be implemented. This driver implements the communication with the device and hides the actual details of the communication protocol to the ADI driver.
  • The GPIO Driver, where the specific GPIO functions for the desired type of processor have to be implemented. This driver lets the device know when the conversions are ready, hiding the actual details of the GPIO ADI driver.

The Communication and GPIO drivers have a standard interface, so the AD719X driver can be used exactly as it is provided.

For SPI Communication there are three functions which are called by the AD719X driver:

  • no_os_spi_init() – Initializes the communication peripheral.
  • no_os_spi_write_and_read() - Reads and writes data from/to device.
  • no_os_spi_remove() - Removes SPI device.

SPI driver architecture

For GPIO control there are seven functions which are called by the AD719X driver:

  • no_os_gpio_get() – Initializes GPIO peripheral.
  • no_os_gpio_get_optional() - Initializes optional GPIO peripheral.
  • no_os_gpio_direction_input() - Sets GPIO as input.
  • no_os_gpio_direction_output - Sets GPIO as output
  • no_os_gpio_get_value - Gets value of GPIO.
  • no_os_gpio_set_value - Sets value of GPIO.
  • no_os_gpio_remove - Removes GPIO peripheral.

For SPI and GPIO usage there are four data types that have to be defined:

  • no_os_spi_desc - structure holding the SPI descriptor
  • no_os_spi_init_param - structure holding the parameters for SPI initialization
  • no_os_gpio_desc - structure holding the GPIO descriptor
  • no_os_gpio_init_param - structure holding the parameters for GPIO initialization

AD719X Driver Code Documentation

Source code documentation for the driver is automatically generated using the Doxygen tool and it is available below:

AD719X Device Configuration

Driver Initialization

In order to be able to use the device, you will have to provide the initial parameters for the communication protocol as for the device - spi initial parameters, gpio MISO initial parameters, gpio SYNC initial parameters, polarity, gain, operating mode, data rate code, clock source, input mode, buffer option, bpdsw mode and chip id. The first API to be called is ad719x_init. Make sure that it returns 0, which means that the device was initialized correctly. ad719x_init also performs a soft reset, by calling ad719x_reset, in order to put the device in a known state.

Range Configuration

By calling ad719x_range_setup, driver sets polarity and gain of the device. Accepted values for gain:

  • AD719X_ADC_GAIN_1
  • AD719X_ADC_GAIN_8
  • AD719X_ADC_GAIN_16
  • AD719X_ADC_GAIN_32
  • AD719X_ADC_GAIN_64
  • AD719X_ADC_GAIN_128

Filter Output Data Rate Configuration

By calling ad719x_output_rate_select, driver sets the filter output data rate. Accepted values are between 1 and 1023. The output data rate can be programmed from 4.7 Hz to 4800 Hz.

Buffer Configuration

By calling ad719x_buffer_select, driver sets the inputs as buffered or unbuffered.

Clock Configuration

By calling ad719x_clock_select, driver sets the clock source for the ADC. Accepted values:

  • AD719X_EXT_CRYSTAL_MCLK1_MCLK2 - External crystal. The external crystal is connected from MCLK1 to MCLK2.
  • AD719X_EXT_CRYSTAL_MCLK2 - External Clock applied to MCLK2.
  • AD719X_INT_CLK_4_92_MHZ_TRIST - Internal 4.92 MHz clock. Pin MCLK2 is tristated.
  • AD719X_INT_CLK_4_92_MHZ - Internal 4.92 MHz clock. The internal clock is available on MCLK2.

Bridge Switch Configuration

By calling ad719x_set_bridge_switch, driver opens or closes the bridge power-down switch of the ADC.

Operating Mode Configuration

By calling ad719x_set_operating_mode, driver sets ADC to the desired operation mode.

All the above configurations are done by ad719x_init, so no further configuration is needed.

Channel Calibration

Channel calibration can be done calling ad719x_calibrate and providing desired channel and calibration type.

AD719X Device Measurements

Operation Mode Setting

After the specific configuration was performed as mentioned above, you can set the device in the desired measurement mode, using ad719x_set_operating_mode API. The available operation modes are:

  • AD719X_MODE_CONT - Continuous Conversion Mode
  • AD719X_MODE_SINGLE - Single Conversion Mode
  • AD719X_MODE_IDLE - Idle Mode
  • AD719X_MODE_PWRDN - Power-Down Mode
  • AD719X_MODE_CAL_INT_ZERO - Internal Zero-Scale Calibration
  • AD719X_MODE_CAL_INT_FULL - Internal Full-Scale Calibration
  • AD719X_MODE_CAL_SYS_ZERO - System Zero-Scale Calibration
  • AD719X_MODE_CAL_SYS_FULL - System Full-Scale Calibration

Temperature Data

Temperature can be read using device's internal sensor. ad719x_temperature_read API will read and convert raw value into Celsius degrees.

Single Conversion Data

By using ad719x_single_conversion API, a single read of the enabled channels will occur.

Continuous Conversion Data

By using ad719x_continuous_read_avg API, the device will read the specified number of samples and will store their average value.

For Single Conversion and Continuous Conversion Data, user can use ad719x_convert_to_volts API to transform raw value into Volts.

AD719X Driver Initialization Example on Xilinx Platform

struct xil_spi_init_param spi_extra = {
	.type = SPI_PS,
	.flags = 0U
};
struct spi_init_param spi_ip = {
	.device_id = SPI_DEVICE_ID,
	.max_speed_hz = 1000,
	.mode = SPI_MODE_3,
	.chip_select = 0U,
	.bit_order = SPI_BIT_ORDER_MSB_FIRST,
	.platform_ops = &xil_spi_ops,
	.extra = &spi_extra
};

const struct xil_gpio_init_param gpio_extra = {
	.type = GPIO_PS,
	.device_id = GPIO_DEVICE_ID
};
const struct gpio_init_param miso_ip = {
	.number = RDY_PIN,
	.platform_ops = &xil_gpio_ops,
	.extra = &gpio_extra
};
const struct gpio_init_param sync_ip = {
	.number = SYNC_PIN,
	.platform_ops = &xil_gpio_ops,
	.extra = &gpio_extra
};

/* Device AD719X instance. */
struct ad719x_dev *dev;
struct ad719x_init_param ad7190_dev_ip = {
	.spi_init = &spi_ip,
	.gpio_miso = &miso_ip,
	.sync_pin = NULL,
	.current_polarity = 1,
	.current_gain = AD719X_ADC_GAIN_64,
	.operating_mode = AD719X_MODE_SINGLE,
	.data_rate_code = 480U,
	.clock_source = AD719X_INT_CLK_4_92_MHZ,
	.input_mode = 0,
	.buffer = 0,
	.bpdsw_mode = 0,
	.chip_id = AD7190
};

ret = ad719x_init(&dev, ad7190_dev_ip);
if(ret)
	return FAILURE;
01 Oct 2012 15:09 · Dragos Bogdan

Downloads

Renesas RL78G13 Quick Start Guide

This section contains a description of the steps required to run the AD7193 demonstration project on a Renesas RL78G13 platform.

Required Hardware

Required Software

Hardware Setup

A PmodAD5 has to be connected to the PMOD1 connector, pins 1 to 6 (see image below).


  • When using AVDD > DVDD (= 3.3V), JP1 on PmodAD5 must be removed. The range for AVDD is 3.0V ≤ AVDD ≤ 5.25V


Reference Project Overview

The reference project:

  • checks if the AD7193 part is present;
  • configures the AD7193 part for differential input on CH0(AIN1-AIN2);
  • first reads data from a single conversion and displays it;
  • then reads data from multiple conversions, calculates the average value and displays it;
  • in the end reads data from the temperature sensor and displays it in degrees Celsius.

Software Project Setup

This section presents the steps for developing a software application that will run on the Renesas Demo Kit for RL78G13 for controlling and monitoring the operation of the ADI part.

  • Run the IAR Embedded Workbench for Renesas RL78 integrated development environment.
  • Choose to create a new project (Project – Create New Project).
  • Select the RL78 tool chain, the Empty project template and click OK.

  • Select a location and a name for the project (ADIEvalBoard for example) and click Save.

  • Open the project’s options window (Project – Options).
  • From the Target tab of the General Options category select the RL78 – R5F100LE device.

  • From the Setup tab of the Debugger category select the TK driver and click OK.

  • Extract the files from the lab .zip archive and copy them into the project’s folder.

  • The new source files have to be included into the project. Open the Add Files… window (Project – Add Files…), select all the copied files and click open.

  • At this moment, all the files are included into the project.
  • The project is ready to be compiled and downloaded on the board. Press the F7 key to compile it. Press CTRL + D to download and debug the project.
  • A window will appear asking to configure the emulator. Keep the default settings and press OK.

  • To run the project press F5.

03 Sep 2012 13:02 · Dragos Bogdan

Renesas RL78G14 Quick Start Guide

This section contains a description of the steps required to run the AD7193 demonstration project on a Renesas RL78G14 platform using the PmodAD5.

Required Hardware

Required Software

The AD7193 demonstration project for the Renesas RL78G14 platform consists of three parts: the AD7193 Driver, the PmodAD5 Demo for RL78G14 and the RL78G14 Common Drivers.

All three parts have to be downloaded.

Hardware Setup

A PmodAD5 has to be connected to the PMOD1 connector, pins 1 to 6 (see image below).


  • When using AVDD > DVDD (= 3.3V), JP1 on PmodAD5 must be removed. The range for AVDD is 3.0V ≤ AVDD ≤ 5.25V


Reference Project Overview

The reference project:

  • checks if the AD7193 part is present;
  • configures the AD7193 part for differential input on CH0(AIN1-AIN2);
  • first reads data from a single conversion and displays it;
  • then reads data from multiple conversions, calculates the average value and displays it;
  • in the end reads data from the temperature sensor and displays it in degrees Celsius.

Software Project Tutorial

This section presents the steps for developing a software application that will run on the Renesas Demo Kit for RL78G14 for controlling and monitoring the operation of the ADI part.

  • Run the IAR Embedded Workbench for Renesas RL78 integrated development environment.
  • Choose to create a new project (Project – Create New Project).
  • Select the RL78 tool chain, the Empty project template and click OK.

  • Select a location and a name for the project (ADIEvalBoard for example) and click Save.

  • Open the project’s options window (Project – Options).
  • From the Target tab of the General Options category select the RL78 – R5F104PJ device.

  • From the Setup tab of the Debugger category select the TK driver and click OK.

  • Copy the downloaded files into the project's folder.

  • The new source files have to be included into the project. Open the Add Files… window (Project – Add Files…), select all the copied files and click open.

  • At this moment, all the files are included into the project.
  • The project is ready to be compiled and downloaded on the board. Press the F7 key to compile it. Press CTRL + D to download and debug the project.
  • A window will appear asking to configure the emulator. Keep the default settings and press OK.

  • To run the project press F5.

09 May 2013 17:10 · Dragos Bogdan

Renesas RX62N Quick Start Guide

This section contains a description of the steps required to run the AD7193 demonstration project on a Renesas RX62N platform.

Required Hardware

Required Software

Hardware Setup

A PmodAD5 has to be interfaced with the Renesas Demonstration Kit (RDK) for RX62N:

  PmodAD5 Pin 1 (CS)   → YRDKRX62N J8 connector Pin 15
  PmodAD5 Pin 2 (MOSI) → YRDKRX62N J8 connector Pin 19
  PmodAD5 Pin 3 (MISO) → YRDKRX62N J8 connector Pin 22
  PmodAD5 Pin 4 (CLK)  → YRDKRX62N J8 connector Pin 20
  PmodAD5 Pin 5 (GND)  → YRDKRX62N J8 connector Pin 4
  PmodAD5 Pin 6 (VCC)  → YRDKRX62N J8 connector Pin 3

Reference Project Overview

The reference project:

  • checks if the AD7193 part is present;
  • configures the AD7193 part;
  • reads data from multiple conversions, calculates the average value and displays it;
  • reads data from the temperature sensor and displays it in degrees Celsius.

Software Project Setup

This section presents the steps for developing a software application that will run on the Renesas Demo Kit for RX62N for controlling and monitoring the operation of the ADI part.

  • Run the High-performance Embedded Workshop integrated development environment.
  • A window will appear asking to create or open project workspace. Choose “Create a new project workspace” option and press OK.
  • From “Project Types” option select “Application”, name the Workspace and the Project “ADIEvalBoard”, select the “RX” CPU family and “Renesas RX Standard” tool chain. Press OK.

  • A few windows will appear asking to configure the project:
    • In the “Select Target CPU” window, select “RX600” CPU series, “RX62N” CPU Type and press Next.
    • In the “Option Setting” windows keep default settings and press Next.
    • In the “Setting the Content of Files to be generated” window select “None” for the “Generate main() Function” option and press Next.
    • In the “Setting the Standard Library” window press “Disable all” and then Next.
    • In the “Setting the Stack Area” window check the “Use User Stack” option and press Next.
    • In the “Setting the Vector” window keep default settings and press Next.
    • In the “Setting the Target System for Debugging” window choose “RX600 Segger J-Link” target and press Next.
    • In the “Setting the Debugger Options” and “Changing the Files Name to be created” windows keep default settings, press Next and Finish.
  • The workspace is created.

  • The RPDL (Renesas Peripheral Driver Library) has to integrated in the project. Unzip the RPDL files (double-click on the file “RPDL_RX62N.exe”). Navigate to where the RPDL files were unpacked and double-click on the “Copy_RPDL_RX62N.bat” to start the copy process. Choose the LQFP package, type the full path where the project was created and after the files were copied, press any key to close the window.
  • The new source files have to be included in the project. Use the key sequence Alt, P, A to open the “Add files to project ‘ADIEvalBoard’” window. Double click on the RPDL folder. From the “Files of type” drop-down list, select “C source file (*.C)”. Select all of the files and press Add.

  • To avoid conflicts with standard project files remove the files “intprg.c” and “vecttbl.c” which are included in the project. Use the key sequence Alt, P, R to open the “Remove Project Files” window. Select the files, click on Remove and press OK.

  • Next the new directory has to be included in the project. Use the key sequence Alt, B, R to open the “RX Standard Toolchain” window. Select the C/C++ tab, select “Show entries for: Include file directories” and press Add. Select “Relative to: Project directory”, type “RPDL” as sub-directory and press OK.

  • The library file path has to be added in the project. Select the Link/Library tab, select “Show entries for: Library files” and press Add. Select “Relative to: Project directory”, type “RPDL\RX62N_library” as file path and press OK.

  • Because the “intprg.c” file was removed the “PIntPrg” specified in option “start” has to be removed. Change “Category” to “Section”. Press “Edit”, select “PIntPRG” and press “Remove”. From this window the address of each section can be also modified. After all the changes are made press OK two times.

  • At this point the files extracted from the zip file located in the “Software Tools” section have to be added into the project. Copy all the files from the archive into the project folder.

  • Now, the files have to be included in the project. Use the key sequence Alt, P, A to open the “Add files to project ‘ADIEvalBoard’” window. Navigate into ADI folder. From the “Files of type” drop-down list, select “Project Files”. Select all the copied files and press Add.

  • Now, the project is ready to be built. Press F7. The message after the Build Process is finished has to be “0 Errors, 0 Warnings”. To run the program on the board, you have to download the firmware into the microprocessor’s memory.
03 Feb 2012 15:32 · Dragos Bogdan

More information

01 Jun 2012 12:17
resources/tools-software/uc-drivers/renesas/ad7193.txt · Last modified: 24 Jan 2021 18:38 by Dragos Bogdan