AD7124 Temperature Measure Firmware Application#

Supported Hardware#

Supported Devices:

Supported Evaluation Boards:

Supported Carrier Boards:

Introduction#

This guide gives an overview of using the temperature measurement console firmware application with Analog Devices AD7124 Evaluation board and SDP-K1 (or other compatible) MCU controller board, leveraging Mbed-OS as a primary software platform. The firmware application provides an user-interactive menu options for user to select and configure the multiple temperature sensors at different instances, such as 2/3/4-wire RTDs, NTC Thermistors and Thermocouples.

The interface used for communicating with PC based console tools (e.g. Teraterm) is UART. Firmware leverages the ADI created no-os and platform driver software layers to communicates with ADC device.

Note

This code has been developed and tested on the SDP-K1 Controller Board with Arduino headers. However, the same code can be used with minimal modifications on any Mbed enabled board which has Arduino Header support on it. To find out all supported Mbed boards, refer this link: https://os.mbed.com/platforms/

Hardware Connections#

Jumper Settings#

SDP-K1:

Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive SDP-K1 GPIOs at 3.3V

EVAL-AD7124:

Refer user manual of required evaluation board.

Communication Interface#

SDP-K1 is powered through USB connection from the computer. SDP-K1 MCU board acts as a serial device when connected to PC, which creates a serial ports to connect to console based tool running on PC. The serial port assigned to a device can be seen through the device manager for windows-based OS as shown below. Use UART (physical) port for PC communication.

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.

  • 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.

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.

Using Firmware#

Configure your serial terminal ( Tera Term) for below settings:

The AD7124 temperature measurement example main menu looks like below (with Tera Term):

Firmware allows user to perform the measurement for single or multiple (more than one) temperature sensors of same type. Below sensors are supported:

  • Single or Multiple 2/3/4-wire RTDs (default is PT100)

  • Single Or Multiple Thermocouple (default is T-type)

  • Single Or Multiple Thermistors (default is 10K NTC)

User must ensure all sensors are connected to AD7124 evaluation board as per configurations specific in the software and on this wiki page (see subsequent sections). If user intend to change these configurations in the software, the hardware connections must be modified as per new configurations. The details about altering the software modules for modifying the configurations are given in ‘Modifying Firmware’ section.

Note

In order to use analog inputs AIN4 and AIN5 on Legacy AD7124 Eval board (with SDP-120 interface only) in any of the demo mode, make sure to route the sensor connections directly through LK6 link, instead of physical screw-terminal connector. Make sure LK6 link is removed for the same purpose.

Multiple RTD (2/3/4-wire Configurations)#

Reference: https://www.analog.com/en/design-center/reference-designs/circuits-from-the-lab/CN0383.html

Multiple 2-wire RTD configurations:

Multiple 3-wire RTD configurations:

Multiple 4-wire RTD configurations:

Multiple Thermocouple Configurations#

Reference: https://www.analog.com/en/design-center/reference-designs/circuits-from-the-lab/CN0384.html

Thermocouple (Hot Junction) configurations for TC measurement:

Cold Junction Compensation (CJC) configurations for TC measurement:

Multiple NTC Thermistor Configurations#

Reference: https://www.analog.com/en/design-center/reference-designs/circuits-from-the-lab/cn0545.html

Calibrating 3-wire RTDs#

Firmware provides an option for user to perform calibrated measurement on 3-wire RTD sensors. There are two types of calibration options available in the firmware. User must modify sensor hardware connections according to configuration defined in the software. Based on selected calibration type, the sensors are first calibrated and then 3-wire RTD measurement is performed on them. For more information on the calibration scheme, refer the design note on RTD measurement.

Note

Calibration is allowed to perform only on Multiple RTD sensors and not on a single RTD sensor.

Calibrating ADC (Internal and System Calibration)#

Firmware allows user to perform ADC calibration on the current sensor configuration (demo mode) selected through console menu. ADC calibration helps to remove any offset Or gain error present on the input channels. The updated device coefficients (gain and offset) post ADC calibration are used/applied during the sensor measurement. Therefore, once calibration is complete, user must go to the previous demo mode which was selected before ADC calibration and then perform the measurement on selected sensors. The calibration coefficients (gain and offset) are applied only on the analog input channels which were enabled prior to calibration. Also after calibration if any new demo mode is selected apart from the one which was enabled during calibration, the calibration coefficients are reset and doesn’t applied on input channels. In this case, user must perform the calibration again.

Internal ADC calibration is straightforward but system calibration needs user inputs (typically after applying full-scale/zero-scale) voltages on selected analog inputs.

Firmware Structure#

Support#

Feel free to ask questions in the EngineerZone