From 6594c1d1e353819cf3f3ac0d019ba42fd0e2af88 Mon Sep 17 00:00:00 2001 From: Vicentiu Neagoe Date: Fri, 27 Mar 2026 16:47:05 +0200 Subject: [PATCH 1/4] reference-designs/eval-ad7124-8-pmdz: Add untracked wiki-migration pages Co-Authored-By: Claude Opus 4.6 --- .../eval-ad7124-8-pmdz/ad7124-stm32.rst | 392 ++++++++++++++++++ .../eval-ad7124-8-pmdz/ad7124.rst | 193 +++++++++ .../ad7124_mbed_support.rst | 190 +++++++++ .../ad7124_temperature_measurement_demo.rst | 322 ++++++++++++++ .../eval-ad7124-8-pmdz/index.rst | 10 + .../linux-drivers/iio-adc/ad7124.rst | 207 +++++++++ .../product-support-software/ad7124-stm32.rst | 392 ++++++++++++++++++ .../ad7124_mbed_support.rst | 190 +++++++++ .../ad7124_temperature_measurement_demo.rst | 322 ++++++++++++++ .../tools-software/uc-drivers/ad7124.rst | 193 +++++++++ 10 files changed, 2411 insertions(+) create mode 100644 docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst create mode 100644 docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124.rst create mode 100644 docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst create mode 100644 docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst create mode 100644 docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst create mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst create mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst create mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst create mode 100644 docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst new file mode 100644 index 00000000000..0d5409da370 --- /dev/null +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst @@ -0,0 +1,392 @@ +AD7124 Example on STM32 Processors +================================== + +Introduction +------------ + +This describes how to take the AD7124 example code and integrate it with STM32 +firmware libraries in a suitable development environment to produce a complete +program. The IDE used here is the STM32CubeIDE, but the general procedure can be +applied to other IDEs. + +Useful links +------------ + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +Overview +-------- + +The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). The AD7124 example application provides a terminal based console interface that allows a user to select between different configurations, and to sample data in single or continuous conversion modes. + +|ad7124_main_menu.png| |image1| + +The example makes use of the :doc:`AD7124 No-OS ` software drivers and platform drivers that are using the STM32 HAL firmware libraries. + +.. important:: + + The example code was developed and tested using the Nucleo-L476RG with + version 1.14.0 of the STM32 firmware libraries, and STMCube32IDE v1.0.0. + However, it may be re-targeted to other STM32 processors/boards, through the + use of the appropriate ST firmware HAL libraries. + +Software Integration Guide +-------------------------- + +Downloads +~~~~~~~~~ + +.. admonition:: Download + :class: download + + + - `ad7124_stm32_example.zip `_ + + +Project Creation +~~~~~~~~~~~~~~~~ + +- If you have not already done so, install the STM32CubeIDE available from www.st.com. +- In the Firmware Update section of the STM32CubeIDE preferences, set the + location to where the firmware package is going to be stored. + + - You may want to place this in a common location, e.g. 'C:\\ST\\Repository' + and not in a directory located under your home directory, to avoid user + specific paths in any shared configuration files + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_firmware_repo.png + :alt: ad7124_firmware_repo.png + :align: center + :width: 400 + +- Select the File >> New >> STM32 project menu option. +- Select the MCU part number or Board being used + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_select_l476.png + :align: center + :width: 400 + +- Give the Project a name, select target language, and project type of + STM32Cube + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_project_setup.png + :align: center + :width: 400 + +- Make sure the Target Reference is correct as it can't be changed once the project is created, and the firmware package repository path is as expected. Set the Code Generator Options to reference library files, or copy library files in your project, depending on how you want to structure your project. +- When you click Finish, the STM32CudeIDE will download the firmware library if + required and unzip it to the repository location specified above. This file + is typically 100's MB in size so this will take several minutes to complete. + +Configuring the Project +~~~~~~~~~~~~~~~~~~~~~~~ + +The Device Configuration Tool with automatic code generation is used to define +pin usage and other default modes of operation for the NUCLEO-L476. In addition +there are some build and linker settings that may be required depending on the +default project build configuration. + +.. important:: + + The pins and configuration provided here need to be tailored to the specific + board/processor being used. + +Device Configuration Tool +^^^^^^^^^^^^^^^^^^^^^^^^^ + +A 4-wire SPI bus is used to connect AD7124 to the NUCLEO-L476RG board, and a +UART is used to provide the serial I/O for the console interface. An LED is also +used to indicate activity. The following sections detail the configuration +settings that need to be made for each of these. + +SPI +""" + +SPI1 port on the processor is used to communicate with the AD7124, with the pin +assigned to each function as shown here, with the corresponding label. + +.. tip:: + + It is recommended that a pull-up resistor be used on the SPI MOSI to ensure + it is never floating in an undefined logic state. This can be a resistor on + the board to the logic supply, or internal to the processor if available. + +|image2| |image3| + +The pin PB10 is used as a software controlled chips select for SP1, and so its +mode must be set to GPIO_output, and set the user label to SPI1_NSS to match +what is used in the platform driver file. The Connectivity >> SPI1 configuration +settings are shown here. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_config.png + :align: center + :width: 400 + +DMA and interrupts are not used and don't need to be configured. The SPI1 GPIO +Settings are as follows. + +{{ :resources:tools-software:product-support-software:ad7124\_\ +example:ad7124_spi_gpios.png?400 \|} + +The GPIO settings for PB10 are as follows. + +|image4| + +Serial UART +""""""""""" + +The serial port uses USART2, and no DMA or interrupts need to be configured. + +|image5| + +The USART2 GPIO settings are as shown. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_gpios.png + :align: center + :width: 400 + +GPIO +"""" + +An LED is toggled on the NUCLEO-L476 board to indicate sampling and other +activity. The activity LED is controlled by Port A, Pin 5, and needs to enabled +as digital output to support this function. + +Build Settings +^^^^^^^^^^^^^^ + +The printf(...) function is used to print numbers formatted as floating point +values in the terminal view. As this feature is often disabled by default due to +the additional memory requirement, floating point support in printf(...) must be +enabled. In the Project properties window, under 'C/C++ Build >> Settings >> MCU +GCC linker >> Miscellaneous > Other Flags' add a '-u \_printf_float' option. + +.. tip:: + + There is also a checkbox option to enable this in the MCU Settings view as + well, but doing it in the linker section, seems to prevent the code analysis + feature in the SMT32CubeIDE reporting '%f' as not supported in the code + editor window. There is no problem enabling it in both locations in + STM32CubeIDE. + +If there are other source or include directories that need to be added to +support the project build, they should also be added to the relevant 'Include +paths' in the MCU GCC Compiler section as required. + +Linker Files +^^^^^^^^^^^^ + +The default value for \_estack may be incorrect in the \*.ld files. This can +cause problems when calling into certain library functions. In particular this +can prevent the %f format specifier working with the floating point version of +printf(...). If instead of a value like '1.23', the terminal output is '0.00', +this can indicate a need to update the linker \*.ld files. For the +NUCLEO-L476RG, the RAM and the FLASH versions of the ld files contain the +following: + +.. code:: c + + /* Highest address of the user mode stack */ + _estack = 0x20017fff; /* end of "RAM" Ram type memory */ + +Changing this as follows fixes the issues related to floating point support in +printf: + +.. code:: c + + /* Highest address of the user mode stack */ + _estack = 0x20018000; /* end of "RAM" Ram type memory */ + +Source File Edits +~~~~~~~~~~~~~~~~~ + +When using the Device Configuration Tool, the code generator produces a two of +these source files, main.c and main.h need minor edits to integrate the AD7124 +example code. There may be an edit required to the \_read(...) function in +syscalls.c to work around an issue, but whether this is required, will depend on +the specific library and build environment. + +main.c +^^^^^^ + +To keep the integration of the AD7124 example application with other user and +platform specific code, there are only two functions that a user needs to call +from their own code, typically as part of the main function. + +- ad7124_app_initialize(..) that does all the one-time initialization work + required by the app, mainly AD7124 device setup + + - It is strongly recommended to test the return value from this function to + determine if the initialization was successful or not + +:: + + *A value less than 0 indicate failure. + +.. code:: c + + /* Initialize the AD7124 application before the main loop */ + int32_t setupResult; + if ((setupResult = ad7124_app_initialize(AD7124_CONFIG_A)) < 0 ) { + // Handle error setting up AD7124 here + } + +- adi_do_console_menu(...) displays the user menu to interact with the + application features + + - This can be called in a while(1) loop so that it is always displayed. + +.. code:: c + + while(1) { + // display the console menu for the AD7124 application + adi_do_console_menu(&ad7124_main_menu); + } + +Both are defined in the "ad7124_console_app.h" header which needs to be added as +#include file. + +main.h +^^^^^^ + +The AD7124 example assumes that all the STM32 hardware is initialized and +appropriate SPI and UART port handles are available, and are used in +platform_drivers.c and platform_support.c. The following extern declarations for +the SPI and serial port handles are required in main.h to make them available to +the platform specific code. + +.. code:: c + + extern SPI_HandleTypeDef hspi1; + extern UART_HandleTypeDef huart2; + +.. important:: + + The names of the port handles are defined by the Device Configuration Tool + based on the selected processor and pin choices. If using a different + processor or pins, these may need to be changed in the platform_drivers.c and + platform_support.c files so they match up. + +syscalls.c +^^^^^^^^^^ + +In the \_read(...) function, the 'len' parameter passed in was found to always +be '1024' for the library and build environment used to develop the example +code. + +.. code:: c + + int _read(int file, char *ptr, int len) + +In order to support the use of getchar(), the expression 'len = 1;' was added +immediately before the for loop in the \_read(...) function. While this is +sufficient for getchar() to work, it does not support use of other stdio.h +functions such as scanf(...). + +Adding AD7124 Example Files +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The distribution of the AD7124 source and header files can be added to the +project that has been created. The files can be added in a dedicated 'adi' +directory, or in the main 'src' directory, or split as appropriate between 'src' +and 'inc' directories, according to the file structure being used. If adding new +source and header file locations, then these will need to be added to the build +settings as necessary, in the relevant 'Include paths' in the MCU GCC Compiler +configuration. + +.. important:: + + The platform_support.c/.h files provide the necessary definitions and + declarations of io_getchar(...) and io_putchar(...) to read/write characters + over the serial port to the connected terminal. If using a compiler other + than GCC, or a different serial port than USART2 then there may be additional + changes required to get serial I/O working. Examples included in the ST + Firmware download can provide guidance. + +At this point, assuming that any necessary changes, pin names, port +usage/configuration have been made, the project should compile cleanly. + +Hardware Connections +-------------------- + +Power & USB +~~~~~~~~~~~ + +A 9V DC supply (barrel jack, center pin positive) is required to power the +EVAl-AD7124-8SDZ evaluation board. The NUCLEO-476RG is powered via the USB +connection to the PC, which also provides the serial UART connection back to the +PC. The NUCLEO-476 creates a COM port that can be connected to by a terminal +emulator, e.g. putty. + +.. tip:: + + If you are unsure what COM port to use to communicate with the board, open + Device Manager, and look under the 'Ports (COM & LPT)' node. + +SPI Interface +~~~~~~~~~~~~~ + +SPI connections to the host processor board can be made to the relevant test points on the eval board, or more easily with an :adi:`SDP Breakout Board `. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_digital_interface.png + :align: center + :width: 400 + +================= ================== ================== +AD7124 SPI Signal SDP Breakout Board NUCLEO-L476 +================= ================== ================== +GND 81 GND on CN5.7 +SCLK 82 D3 (PB3) on CN9.4 +DOUT/RDYB 83 D5 (PB4) on CN9.6 +DIN 84 D4 (PB5) on CN9.5 +CSB 85 D6 (PB10) on CN9.7 +================= ================== ================== + +Analog Input +~~~~~~~~~~~~ + +The screw terminal connections to J6 and J11 can be used to connect appropriate +analog input signals to provide test stimulus to the AD7124. + +In Configuration A + +- AIN0/AIN1 are used for channel 0, simple voltage measurement + +In Configuration B + +- AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are captured on channel 0. This uses an internal reference and has a bias voltage enabled on AIN2. A suitable thermocouple should connected to A2 for this measurement. +- AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is provided + from AIN1 for this. This requires an external RTD and reference resistor + connected as show in the figure below. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png + :align: center + :width: 200 + +Console Application +------------------- + +Once the hardware connections are made, and the compiled code programmed into +the board, open the terminal program, and reset the hardware to see the AD7124 +menu that allows a user to perform a variety of functions. These include reset +the device, program one of the pre-defined configurations, and sample data that +is displayed on screen or streamed so it can captured by the console. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png + :align: center + :width: 400 + +.. |ad7124_main_menu.png| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png + :width: 200 +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_continuous_conversion.png + :width: 200 +.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_l476.png +.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_l476.png +.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_gpio.png + :width: 400 +.. |image5| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_config.png + :width: 400 diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124.rst new file mode 100644 index 00000000000..0a0a4653590 --- /dev/null +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124.rst @@ -0,0 +1,193 @@ +AD7124 No-OS Software +===================== + +.. important:: + + You're looking at a legacy page. The driver API has since changed and does + not correspond anymore to the driver for ad7124 available in no-OS + repository. However, you may use the code in the following no-OS projects to + see examples of ad7124 driver usage: + + + :git-no-OS:`no-OS/tree/master/projects/ad7124-4sdz ` + + :git-no-OS:`no-OS/tree/master/projects/ad7124-8pmdz ` + + +Introduction +------------ + +This document describes the No-OS software used to control the AD7124 part and +includes an example of how to initialize a AD7124 part. + +Overview +-------- + +The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). + +:adi:`AD7124-4` 4 differential / 7 single-ended inputs, 24-lead TSSOP / 32-lead LFCSP :adi:`AD7124-8` 8 differential / 15 single-ended inputs, 32-lead LFCSP + +The on-chip low gain stage ensures that signals of small amplitude can be interfaced directly to the ADC. One of the major advantages of the :adi:`AD7124 ` is that it gives the user the flexibility to employ one of three integrated power modes. The current consumption, range of output data rates, and rms noise can be tailored with the power mode selected. The device also offers a multitude of filter options, ensuring that the user has the highest degree of flexibility. The :adi:`AD7124 ` can achieve simultaneous 50 Hz and 60 Hz rejection when operating at an output data rate of 25 SPS (single cycle settling), with rejection in excess of 80 dB achieved at lower output data rates. The :adi:`AD7124 ` establishes the highest degree of signal chain integration. The device contains a precision, low noise, low drift internal band gap reference, and also accepts an external differential reference, which can be internally buffered. Other key integrated features include programmable low drift excitation current sources, burnout currents, and a bias voltage generator, which sets the common-mode voltage of a channel to AVDD/2. The low-side power switch enables the user to power down bridge sensors between conversions, ensuring the absolute minimal power consumption of the system. The device also allows the user the option of operating with either an internal clock or an external clock. The integrated channel sequencer allows several channels to be enabled simultaneously, and the :adi:`AD7124 ` sequentially converts on each enabled channel, simplifying communication with the device. As many as 16 channels can be enabled at any time; a channel being defined as an analog input or a diagnostic such as a power supply check or a reference check. This unique feature allows diagnostics to be interleaved with conversions. The :adi:`AD7124 ` also supports per channel configuration. The device allows eight configurations or setups. Each configuration consists of gain, filter type, output data rate, buffering, and reference source. The user can assign any of these setups on a channel by channel basis. The :adi:`AD7124 ` also has extensive diagnostic functionality integrated as part of its comprehensive feature set. These diagnostics include a cyclic redundancy check (CRC), signal chain checks, and serial interface checks, which lead to a more robust solution. These diagnostics reduce the need for external components to implement diagnostics, resulting in reduced board space needs, reduced design cycle times, and cost savings. The failure modes effects and diagnostic analysis (FMEDA) of a typical application has shown a safe failure fraction (SFF) greater than 90% according to IEC 61508. The device operates with a single analog power supply from 2.7 V to 3.6 V or a dual 1.8 V power supply. The digital supply has a range of 1.65 V to 3.6 V. It is specified for a temperature range of −40°C to +105°C. + +Supported Devices +----------------- + +- :adi:`AD7124-4` +- :adi:`AD7124-8` + +Evaluation Boards +----------------- + +- :adi:`EVAL-AD7124-4` +- :adi:`EVAL-AD7124-8` + +Driver Description +------------------ + +The driver contains two parts: + +- The driver for the AD7124 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 Communication Driver has a standard interface, so the AD7124 driver can be +used exactly as it is provided. + +There are three functions which are called by the AD7124 driver: + +- SPI_Init() – initializes the communication peripheral. +- SPI_Write() – writes data to the device. +- SPI_Read() – reads data from the device. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/uc-drivers/spi_architecture.png + :align: center + +.. container:: centeralign + + SPI driver architecture + +The AD7124 driver contains the following: + +- AD7124.h - Header file of the driver. Contains the driver function declarations, custom data types to be used by the driver and driver specific constants. +- AD7124.c - Implementation file of the driver. Contains the implementations of the driver functions. +- AD7124_regs.h - Register map of the driver. Contains the register map + definitions and an array of all device registers to be used with the driver. + +The following functions are implemented in this version of AD7124 driver: + ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| Function | Description | ++========================================================================================+==========================================================================+ +| ``int32_t AD7124_ReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_NoCheckReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register without a device state check. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_NoCheckWriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register without a device state check. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_Reset(ad7124_device *device)`` | Resets the device. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitForSpiReady(ad7124_device *device, uint32_t timeout)`` | Waits until the device can accept read and write user actions. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitToPowerOn(ad7124_device *device, uint32_t timeout)`` | Waits until the device finishes the power-on reset operation. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitForConvReady(ad7124_device *device, uint32_t timeout)`` | Waits until a new conversion result is available. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_ReadData(ad7124_device *device, int32_t* pData)`` | Reads the conversion result from the device. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``uint8_t AD7124_ComputeCRC8(uint8_t* pBuf, uint8_t bufSize)`` | Computes the CRC checksum for a data buffer. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``void AD7124_UpdateCRCSetting(ad7124_device *device)`` | Updates the CRC settings. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``void AD7124_UpdateDevSpiSettings(ad7124_device *device)`` | Updates the device SPI interface settings. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_Setup(ad7124_device *device, int slave_select, ad7124_st_reg *regs)`` | Initializes the AD7124. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ + +Downloads +--------- + +.. admonition:: Download + :class: download + + + - **AD7124 Driver:** :git-no-OS:`drivers/adc/ad7124` + - **Generic Platform Driver** :git-no-OS:`drivers/platform/generic` + + +Using the API +------------- + +The driver can only work together with a structure that holds the state of a +device, where state means all information about the device including a copy of +all register values written to the device at a certain point. This structure +will henceforth be referred as an instance of a driver. All driver functions +take a handler of a driver instance as the first argument. This allows the +driver to be used with multiple devices simultaneously, without the need to +replicate the .c and .h files. + +Before using any API call, an instance of the driver must first be created and +then initialized using the AD7124_Setup() which has the following parameters: + +- **device**: the reference of the new driver instance. A new instance can be obtained by simply declaring one: struct ad7124_device my_ad7124; +- **slave_select**: the index of the SPI Chip Select. It will be stored into the driver instance to be used with all SPI calls for that particular instance. +- **regs**: must point to a register array of the device. It will be too stored into the driver and used by the driver. There is a default register array already defined in AD7124_regs.h and AD7124_regs.c files. The name of the array is ad7124_regs and can be passed here as parameter. Alternatively, a new register array can be defined by user which must be properly initialized before calling AD7124_Setup() function. ad7124_st_reg my_ad7124_regs[AD7124_REG_NO]; + +A AD7124_Setup() call will also reset the part then use all register values stored in the array pointed by the **regs** parameter to configure the part (the registers flagged as "Read-only" will be skipped). + +The following code snipped provides an example of driver usage: + +.. code:: c + + #include "AD7124.h" /* AD7124 definitions */ + #include "AD7124_regs.h" /* We want to use the ad7124_regs array defined in ad7124_regs.h/.c */ + + void main(void) + { + struct ad7124_device my_ad7124; /* A new driver instance */ + struct ad7124_device *ad7124_handler = &my_ad7124; /* A driver handle to pass around */ + enum ad7124_registers regNr; /* Variable to iterate through registers */ + long timeout = 1000; /* Number of tries before a function times out */ + long ret = 0; /* Return value */ + long sample; /* Stores raw value read from the ADC */ + + /* Initialize AD7124 device. */ + ret = AD7124_Setup(ad7124_handler, AD7124_SLAVE_ID, (ad7124_st_reg *)&ad7124_regs); + if (ret < 0) + { + /* AD7124 initialization failed, check the value of ret! */ + } + else + { + /* AD7124 initialization OK */ + } + + /* Read all registers */ + for (regNr = AD7124_Status; (regNr < AD7124_REG_NO) && !(ret < 0); regNr++) + { + ret = AD7124_ReadRegister(ad7124_handler, &ad7124_regs[regNr]); + } + + /* Read data from the ADC */ + ret = AD7124_WaitForConvReady(ad7124_handler, timeout); + if (ret < 0) + { + /* Something went wrong, check the value of ret! */ + } + + ret = AD7124_ReadData(ad7124_handler, &sample); + if (ret < 0) + { + /* Something went wrong, check the value of ret! */ + } + } + +More information +================ + +.. note:: + + See `more-information `_ diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst new file mode 100644 index 00000000000..b76dc842d73 --- /dev/null +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst @@ -0,0 +1,190 @@ +AD7124 Console Application +========================== + +Introduction +------------ + +This page gives an overview of using the AD7124 Firmware Example with SDP-K1 +EVAL board and AD7124 EVAL board. The firmware example comprises 3 layers of +software (from top to bottom): Console Application Layer, Device No-OS Layer and +Platform Drivers (Mbed-OS) layer. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_layers.jpg + :align: center + :width: 150 + +The application layer uses the ADI Console Libraries to create console based +User Interactive (UI). The middle layer of No-OS device library have device +specific APIs to interface with AD7124 device. These APIs allows direct access +to device register map in order to read/write device registers. The bottom layer +of Platform Drivers is responsible for Low Level Interface. The platform drivers +uses mbed-os libraries to access low level peripheral (like GPIOs, SPI, I2C, +etc). + +The Mbed Platform simplifies the overall software development process by +providing the low level driver support. This reduces the hardware dependency as +any Mbed enabled board can be used with same firmware with little modifications +(precisely changing a pin mapping). + +Interface Diagram +----------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_interface_diagram.jpg + :align: center + :width: 600 + +The :adi:`AD7124-EVAL ` board is connected to :adi:`SDP-K1 ` through default 120-pin SDP Connector. The AD7124-EVAL board has external connector to connect up-to 8 analog inputs. The board needs to be powered-up through 9-12V external DC supply. The SDP-K1 is connected to PC through USB cable. The firmware can be loaded into SDP-K1 board through this USB interface from PC. The SDP-K1 acts as a Serial Device and firmware loaded into it interacts with any serial terminal (like Teraterm, Putty, Coolterm, etc) by configuring terminal for proper serial settings (COM Port, Baud Rate, etc). + +Useful links +------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter + :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +Hardware Connections +-------------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/hardware_connections_ad7124-eval.jpg + :align: center + :width: 400 + +Power Supply and USB Connection +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A 7V to 9V DC supply (barrel jack, center pin positive) is required to power the +EVAL-AD7124-8SDZ evaluation board. SDP-K1 is powered through USB connection to +PC. SDP-K1 acts as a Serial device when connected to PC, which creates a COM +Port to connect to Serial Terminals like Teraterm, Putty, etc. The COM port +assigned to a device can be seen through the device manager for windows based +OS. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg + :align: center + :width: 300 + +Analog Inputs +~~~~~~~~~~~~~ + +The screw terminal connections to J6 and J11 can be used to connect appropriate +analog input signals to provide test stimulus to the AD7124. + +The AD7124 device can be software configured to interface with external devices +(e.g. sensors). The AD7124 Firmware example provides such 2 configurations +(selected through console UI) as described below: + +**Configuration A:** + +AIN0/AIN1 are used for channel 0, simple voltage measurement + +**Configuration B:** + +AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are +captured on channel 0. This uses an internal reference and has a bias voltage +enabled on AIN2. A suitable thermocouple should be connected to A2 for this +measurement. AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is +provided from AIN1 for this. This requires an external RTD and reference +resistor connected as show in the figure below. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png + :align: center + :width: 200 + +Temperature sensing application using AD7124: :adi:`media/en/reference-design-documentation/reference-designs/CN0383.pdf` + +AD7124 Mbed Firmware +-------------------- + +This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. + +.. admonition:: Download + :class: download + + Source code is hosted here: + + + - `precision-converters-firmware `_ + + Build Guide for Precision Converters MBED firmware (Use below link): + + - :doc:`Precision Converters MBED Firmware ` + + +The software execution sequence for the AD7124 Firmware Example is shown below. +This is a blocking application as it waits for user input over serial interface +(UART). The input is scanned and processed through 'adi console libraries'. The +menu functionality is executed from ad7124_conole_app.c file. The application +layer talks with No-OS layer for device registers and data access. The No-OS +layer interfaces with Platform Drivers layer for accessing low level +peripherals. As name suggests, this layer is platform dependent. AD7124 firmware +uses Mbed libraries within Platform Drivers layer. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_sequence.jpg + :align: center + :width: 800 + +Quick Start +=========== + +If you have some familiarity with the Mbed platform, the following is a basic +list of steps required to start running the code, see below for more detail: + +- Connect the AD7124 EVAL-board to the SDP-K1 controller board. +- Connect the SDP-K1 controller board to your computer over USB. +- Go to the link of the code provided above in the 'Downloads' section and import code into Mbed online compiler. +- Ensure SDP-K1 controller board is selected (top right of online-compiler page). +- Compile the code. +- After a successful compile 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. +- 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. + +- Use the menu provided over the terminal window to access the evaluation + board. + +Using the Firmware +------------------ + +The AD7124 firmware example is configured to have following serial settings: + +- Baud rate: 230400 +- Data bits: 8-bits +- Parity: None +- Stop bits: 1 + +Configure your serial terminal (`Tera Term `_) for below settings: + +|image1| The AD7124 Main menu looks like below (with Tera Term): + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_main_menu.jpg + :align: center + :width: 600 + +The firmware is designed to be intuitive to use, and requires little +explanation, simply enter a number corresponding to the required command and +follow the on-screen prompts. + +The console menu application provides the following main features: + +- Enable/Disable individual ADC channel (0-15). +- Connect analog input pins to individual channel. +- Configure the device setup (0-7) and assign to individual channel (0-15). +- Display device and channel setup. +- Perform internal device calibration. +- Read die temperature (using internal temperature sensor). +- Read/Write device registers. + +.. tip:: + + It is hoped that the most common functions of the AD7124 device are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. + +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/baud_rate_update.png + :width: 600 diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst new file mode 100644 index 00000000000..9d4d4e3dfd0 --- /dev/null +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst @@ -0,0 +1,322 @@ +AD7124 Temperature Measurement Demo Example +=========================================== + +This page gives an overview of using the 'ARM Mbed' platform supported +temperature measurement firmware example with Analog Devices AD7124 Evaluation +board and SDP-K1 controller board (or any other Mbed supported target board). +The firmware example is console based, which 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 connection block diagram is described below: + +|image1| + +.. important:: + + This code has been developed and tested on SDP-K1 Controller Board using the + on-board Arduino/SDP-120 Headers. However, same code can be used without or + with little modifications on any other Mbed supported board which has Arduino + Header Support on it, such as STM32-Discovery, STM32-Nucleo, etc. + +-------------- + +Useful links +------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter + :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +-------------- + +Hardware Connections +-------------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_hw_connections.jpg + :align: center + :width: 650 + +.. note:: + + Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive + SDP-K1 GPIOs at 3.3V. + + + For AD7124 evaluation board connections and jumper settings, refer the + respective evaluation board manual. Arduino connector is used as default + interface type for both the boards in the software. + +SDP-K1 is powered through USB connection from the computer. SDP-K1 acts as a +serial device when connected to PC, which creates a COM Port to connect to +serial terminal (console based application) running on windows-os. The COM port +assigned to a device can be seen through the device manager for windows based +OS. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg + :align: center + :width: 350 + +-------------- + +Software Downloads +------------------ + +AD7124 Temperature Measurement Mbed Firmware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. + +.. admonition:: Download + :class: download + + Source code is hosted here: + + + - `precision-converters-firmware `_ + + Build Guide for Precision Converters MBED firmware (Use below link): + + - :doc:`Precision Converters MBED Firmware ` + + +Quick Start to use AD7124 Mbed Firmware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are familiar with the Mbed platform, the following is a basic list of +steps required to start running the code: + +- 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. +- Go to the link of the code provided above in the 'Source Code' section and import the code into the Mbed online compiler +- Ensure the SDP-K1 controller board is selected as the target + + - *If a different controller board is being used, then it should be selected, and the pin out in app_config.h may also need to be updated.* + +- In the Mbed Online IDE compile the code. +- After a successful compile a binary file (.BIN) will be downloaded to your computer. +- Drag and drop this binary to the USB drive corresponding to the SDP-K1 controller board. +- 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 baud, 8 data, no parity, 1 stop bit. + - Reset the controller board and connect. + +- The terminal windows should display the console menu providing access to the + functionality. + +Using the Firmware +------------------ + +Configure your serial terminal (`Tera Term `_) for below settings: + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_example_teraterm_settings.jpg + :align: center + :width: 600 + +The AD7124 temperature measurement example main menu looks like below (with Tera +Term): + +|image2| + +.. tip:: + + The firmware is designed to be intuitive to use, and requires little + explanation, simply enter a number corresponding to the required command and + follow the on-screen prompts. + +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. + +|image3| + +.. tip:: + + 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: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0383.html` + +Multiple 2-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_2_wire_rtd_configs.jpg + :align: center + +Multiple 3-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_3_wire_rtd_configs.jpg + :align: center + +Multiple 4-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_4_wire_rtd_configs.jpg + :align: center + +-------------- + +Multiple Thermocouple Configurations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0384.html` + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_tc_configs.jpg + :align: center + +Cold Junction Compensation (CJC) configurations for TC measurement: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_cjc_configs.jpg + :align: center + :width: 700 + +-------------- + +Multiple NTC Thermistor Configurations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/cn0545.html` + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_ntc10k_configs.jpg + :align: center + +-------------- + +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 :adi:`design note ` on RTD measurement. + +|image4| + +.. tip:: + + 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. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_calibration_menu.jpg + :align: center + :width: 700 + +-------------- + +Modifying Firmware +------------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_sensor_file_structure.jpg + :align: center + :width: 700 + +app_config.h +~~~~~~~~~~~~ + +This file can be used to: + +- Select the 'Active Device' as either AD7124-4 Or AD7124-8. Default active device is AD7124-4. +- Select the SDP_K1 interface type as either Arduino Or SDP-120. Default is + Arduino. + +ad7124_regs_configs.h +~~~~~~~~~~~~~~~~~~~~~ + +This file defines the analog inputs, excitation sources, PGA, reference sources +and power mode for all sensor demo mode configurations. + +ad7124_regs_config_rtd.c, ad7124_regs_config_thermistor.c, ad7124_regs_config_thermocouple.c +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These files define the AD7124 register configurations used for various sensor +demo modes. + +ad7124_user_config.c +~~~~~~~~~~~~~~~~~~~~ + +This file defines the user configurations for the AD7124, such as SPI parameters +(frequency, mode, etc) and other init parameters used by No-OS drivers to +initialize AD7124 device. These are the parameters loaded into device when +device is powered-up or power-cycled. + +ad7124_console_app.c +~~~~~~~~~~~~~~~~~~~~ + +This file defines the functionality for selecting and displaying sensor +configurations (hardcoded in the software), perform ADC sampling on selected +sensor channels and display temperature measurement result for selected sensors. + +ad7124_temperature_sensor.cpp +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This file defines the functions which acts as wrapper for calling 'tempsensor' +library functions to calculate the temperature based on resistance or voltages. +The fixed sensors such as NTC 10K, T type thermocouple, PT100/PT1000 RTD are +used. + +No-OS Drivers for AD7124 +~~~~~~~~~~~~~~~~~~~~~~~~ + +No-OS drivers provide the high level abstracted layer for digital interface of +AD7124 device. The complete digital interface (to access memory map and perform +data read) is done in integration with low level platform drivers. + +The functionality related with No-OS drivers is covered in below 2 files: + +- ad7124.c +- ad7124.h + +.. tip:: + + It is hoped that the most common functions of the AD7124 are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. + +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_sensor_interface_block.jpg + :width: 650 +.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_measure_main_menu.jpg + :width: 400 +.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/bypassing_lk6_link_on_legacy_board.jpg + :width: 600 +.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_3wire_rtd_calibration_menu.jpg + :width: 700 diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst index d6c992cb519..4ec32f2c395 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst @@ -228,3 +228,13 @@ Reference Demos & Software :glob: */index + + +.. toctree:: + :hidden: + + ad7124 + ad7124 + ad7124-stm32 + ad7124_mbed_support + ad7124_temperature_measurement_demo diff --git a/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst b/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst new file mode 100644 index 00000000000..ac2590878c4 --- /dev/null +++ b/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst @@ -0,0 +1,207 @@ +AD7124 IIO Sigma-Delta ADC Linux Driver +======================================= + +Supported Devices +----------------- + +This driver supports the + +- :adi:`AD7124-4` +- :adi:`AD7124-8` + +Evaluation Boards +----------------- + +- :adi:`EVAL-AD7124-4` +- :adi:`EVAL-AD7124-8` + +Description +----------- + +This is a Linux industrial I/O (:doc:`IIO `) subsystem driver, targeting single channel serial interface ADCs. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See :doc:`IIO ` for more information. + +Status +------ + ++------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ +| Source | Mainlined? | ++============================================================================================================+============================================================================================================+ +| `git `_ | `Yes `_ | ++------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ + +Files +----- + ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| Function | File | ++=====================+===================================================================================================================================================================================================+ +| driver | `drivers/iio/adc/ad7124.c `_ | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| devicetree bindings | `Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml `_ | ++---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +Driver testing +============== + +Each and every IIO device, typically a hardware chip, has a device folder under +/sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under +every of these directory folders reside a set of files, depending on the +characteristics and features of the hardware device in question. These files are +consistently generalized and documented in the IIO ABI documentation. In order +to determine which IIO deviceX corresponds to which hardware device, the user +can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the +sequence in which the iio device drivers are loaded/registered is constant, the +numbering is constant and may be known in advance. + +.. tip:: + + \ TIP: An example program which uses the interface can be found here: + + + - :doc:`IIO Oscilloscope ` + + +.. container:: box bggreen + + This specifies any shell prompt running on the target + + + :: + + root:/> cd /sys/bus/iio/devices/ + root:/sys/bus/iio/devices> ls + iio:device0 + + root:/sys/bus/iio/devices> cd iio\:device0 + + root:/sys/bus/iio/devices/iio:device0> ls -l + drwxr-xr-x 2 root root 0 Jun 23 21:46 buffer + -r--r--r-- 1 root root 4096 Jun 23 21:46 dev + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_offset + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_raw + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_sampling_frequency + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_scale + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_offset + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_raw + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_sampling_frequency + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_scale + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_offset + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_raw + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_sampling_frequency + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_scale + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_offset + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_raw + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_sampling_frequency + -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_scale + -r--r--r-- 1 root root 4096 Jun 23 21:46 name + lrwxrwxrwx 1 root root 0 Jun 23 21:46 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ad7124-4@0 + drwxr-xr-x 2 root root 0 Jun 23 21:46 power + drwxr-xr-x 2 root root 0 Jun 23 21:46 scan_elements + lrwxrwxrwx 1 root root 0 Jun 23 21:46 subsystem -> ../../../../../../../../bus/iio + drwxr-xr-x 2 root root 0 Jun 23 21:46 trigger + -rw-r--r-- 1 root root 4096 Jun 23 21:46 uevent + + +Show device name +---------------- + +.. container:: box bggreen + + This specifies any shell prompt running on the target + + + :: + + root:/sys/bus/iio/devices/iio:device0> cat name + ad7124-4 + + +Show channel scale and offset +----------------------------- + +**Description:** Scales and offsets to be applied to in_voltagex_voltagey_raw in order to obdatin the measured voltage in millivolts + +.. container:: box bggreen + + This specifies any shell prompt running on the target + + + :: + + root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_scale + 0.000149011 + root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_offset + 0 + root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_raw + 2679470 + + +**Description:** Channel Ainp0-Ainm1 is configured as unipolar, with a gain of 1 **U** = //in_voltage0-voltage1_raw \* in_voltage0-voltage1_scale - in_voltage0-voltage1_offset // = 2679470 \* 0.000149011 - 0 = **399.27 mV** + +.. container:: box bggreen + + This specifies any shell prompt running on the target + + + :: + + root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_scale + 0.000298023 + root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_offset + -2500 + root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_raw + 9716211 + + +**Description:** Channel Ainp2-Ainm3 is configured as bipolar, with a gain of 1 **U** = //in_voltage2-voltage3_raw \* in_voltage2-voltage3_scale - in_voltage2-voltage3_offset // = 9716211\* 0.000298023 - 2500= **395.65 mV** + +Set sampling frequency +---------------------- + +**Description:** The output data rate depends on the master clock frequency (fclk) which in turn determines the power mode: + +- Full power (fCLK = 614.4 kHz): 9.38 SPS to 19,200 SPS +- Mid power (fCLK = 153.6 kHz): 2.34 SPS to 4800 SPS +- Low power (fCLK = 76.8 kHz): 1.17 SPS to 2400 SPS + +.. container:: box bggreen + + This specifies any shell prompt running on the target + + + :: + + root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_sampling_frequency + 10 + root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_sampling_frequency + 960 + root:/sys/bus/iio/devices/iio:device0> echo 2400 > in_voltage0-voltage1_sampling_frequency + root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_sampling_frequency + 2400 + root:/sys/bus/iio/devices/iio:device0> echo 5000 > in_voltage2-voltage3_sampling_frequency + root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_sampling_frequency + 4800 + + +More Information +================ + +- IIO mailing list: linux-iio@vger.kernel.org +- `IIO Linux Kernel Documentation sysfs-bus-iio-\* `_ +- `IIO Documentation `_ +- :doc:`IIO test and visualization application ` +- :doc:`libiio - IIO system library ` +- :doc:`libiio - Internals ` +- :doc:`Pointers and good books ` +- `IIO High Speed `_ +- `Software Defined Radio using the IIO framework `_ +- + +|libiio introduction| + +*Need Help?* + +- :ez:`Analog Devices Linux Device Drivers Help Forum ` +- `Ask a Question `_ + +.. |libiio introduction| image:: https://wiki.analog.com/_media/software/linux/docs/iio/youtube>p_vntewue24 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst new file mode 100644 index 00000000000..0d5409da370 --- /dev/null +++ b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst @@ -0,0 +1,392 @@ +AD7124 Example on STM32 Processors +================================== + +Introduction +------------ + +This describes how to take the AD7124 example code and integrate it with STM32 +firmware libraries in a suitable development environment to produce a complete +program. The IDE used here is the STM32CubeIDE, but the general procedure can be +applied to other IDEs. + +Useful links +------------ + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +Overview +-------- + +The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). The AD7124 example application provides a terminal based console interface that allows a user to select between different configurations, and to sample data in single or continuous conversion modes. + +|ad7124_main_menu.png| |image1| + +The example makes use of the :doc:`AD7124 No-OS ` software drivers and platform drivers that are using the STM32 HAL firmware libraries. + +.. important:: + + The example code was developed and tested using the Nucleo-L476RG with + version 1.14.0 of the STM32 firmware libraries, and STMCube32IDE v1.0.0. + However, it may be re-targeted to other STM32 processors/boards, through the + use of the appropriate ST firmware HAL libraries. + +Software Integration Guide +-------------------------- + +Downloads +~~~~~~~~~ + +.. admonition:: Download + :class: download + + + - `ad7124_stm32_example.zip `_ + + +Project Creation +~~~~~~~~~~~~~~~~ + +- If you have not already done so, install the STM32CubeIDE available from www.st.com. +- In the Firmware Update section of the STM32CubeIDE preferences, set the + location to where the firmware package is going to be stored. + + - You may want to place this in a common location, e.g. 'C:\\ST\\Repository' + and not in a directory located under your home directory, to avoid user + specific paths in any shared configuration files + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_firmware_repo.png + :alt: ad7124_firmware_repo.png + :align: center + :width: 400 + +- Select the File >> New >> STM32 project menu option. +- Select the MCU part number or Board being used + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_select_l476.png + :align: center + :width: 400 + +- Give the Project a name, select target language, and project type of + STM32Cube + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_project_setup.png + :align: center + :width: 400 + +- Make sure the Target Reference is correct as it can't be changed once the project is created, and the firmware package repository path is as expected. Set the Code Generator Options to reference library files, or copy library files in your project, depending on how you want to structure your project. +- When you click Finish, the STM32CudeIDE will download the firmware library if + required and unzip it to the repository location specified above. This file + is typically 100's MB in size so this will take several minutes to complete. + +Configuring the Project +~~~~~~~~~~~~~~~~~~~~~~~ + +The Device Configuration Tool with automatic code generation is used to define +pin usage and other default modes of operation for the NUCLEO-L476. In addition +there are some build and linker settings that may be required depending on the +default project build configuration. + +.. important:: + + The pins and configuration provided here need to be tailored to the specific + board/processor being used. + +Device Configuration Tool +^^^^^^^^^^^^^^^^^^^^^^^^^ + +A 4-wire SPI bus is used to connect AD7124 to the NUCLEO-L476RG board, and a +UART is used to provide the serial I/O for the console interface. An LED is also +used to indicate activity. The following sections detail the configuration +settings that need to be made for each of these. + +SPI +""" + +SPI1 port on the processor is used to communicate with the AD7124, with the pin +assigned to each function as shown here, with the corresponding label. + +.. tip:: + + It is recommended that a pull-up resistor be used on the SPI MOSI to ensure + it is never floating in an undefined logic state. This can be a resistor on + the board to the logic supply, or internal to the processor if available. + +|image2| |image3| + +The pin PB10 is used as a software controlled chips select for SP1, and so its +mode must be set to GPIO_output, and set the user label to SPI1_NSS to match +what is used in the platform driver file. The Connectivity >> SPI1 configuration +settings are shown here. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_config.png + :align: center + :width: 400 + +DMA and interrupts are not used and don't need to be configured. The SPI1 GPIO +Settings are as follows. + +{{ :resources:tools-software:product-support-software:ad7124\_\ +example:ad7124_spi_gpios.png?400 \|} + +The GPIO settings for PB10 are as follows. + +|image4| + +Serial UART +""""""""""" + +The serial port uses USART2, and no DMA or interrupts need to be configured. + +|image5| + +The USART2 GPIO settings are as shown. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_gpios.png + :align: center + :width: 400 + +GPIO +"""" + +An LED is toggled on the NUCLEO-L476 board to indicate sampling and other +activity. The activity LED is controlled by Port A, Pin 5, and needs to enabled +as digital output to support this function. + +Build Settings +^^^^^^^^^^^^^^ + +The printf(...) function is used to print numbers formatted as floating point +values in the terminal view. As this feature is often disabled by default due to +the additional memory requirement, floating point support in printf(...) must be +enabled. In the Project properties window, under 'C/C++ Build >> Settings >> MCU +GCC linker >> Miscellaneous > Other Flags' add a '-u \_printf_float' option. + +.. tip:: + + There is also a checkbox option to enable this in the MCU Settings view as + well, but doing it in the linker section, seems to prevent the code analysis + feature in the SMT32CubeIDE reporting '%f' as not supported in the code + editor window. There is no problem enabling it in both locations in + STM32CubeIDE. + +If there are other source or include directories that need to be added to +support the project build, they should also be added to the relevant 'Include +paths' in the MCU GCC Compiler section as required. + +Linker Files +^^^^^^^^^^^^ + +The default value for \_estack may be incorrect in the \*.ld files. This can +cause problems when calling into certain library functions. In particular this +can prevent the %f format specifier working with the floating point version of +printf(...). If instead of a value like '1.23', the terminal output is '0.00', +this can indicate a need to update the linker \*.ld files. For the +NUCLEO-L476RG, the RAM and the FLASH versions of the ld files contain the +following: + +.. code:: c + + /* Highest address of the user mode stack */ + _estack = 0x20017fff; /* end of "RAM" Ram type memory */ + +Changing this as follows fixes the issues related to floating point support in +printf: + +.. code:: c + + /* Highest address of the user mode stack */ + _estack = 0x20018000; /* end of "RAM" Ram type memory */ + +Source File Edits +~~~~~~~~~~~~~~~~~ + +When using the Device Configuration Tool, the code generator produces a two of +these source files, main.c and main.h need minor edits to integrate the AD7124 +example code. There may be an edit required to the \_read(...) function in +syscalls.c to work around an issue, but whether this is required, will depend on +the specific library and build environment. + +main.c +^^^^^^ + +To keep the integration of the AD7124 example application with other user and +platform specific code, there are only two functions that a user needs to call +from their own code, typically as part of the main function. + +- ad7124_app_initialize(..) that does all the one-time initialization work + required by the app, mainly AD7124 device setup + + - It is strongly recommended to test the return value from this function to + determine if the initialization was successful or not + +:: + + *A value less than 0 indicate failure. + +.. code:: c + + /* Initialize the AD7124 application before the main loop */ + int32_t setupResult; + if ((setupResult = ad7124_app_initialize(AD7124_CONFIG_A)) < 0 ) { + // Handle error setting up AD7124 here + } + +- adi_do_console_menu(...) displays the user menu to interact with the + application features + + - This can be called in a while(1) loop so that it is always displayed. + +.. code:: c + + while(1) { + // display the console menu for the AD7124 application + adi_do_console_menu(&ad7124_main_menu); + } + +Both are defined in the "ad7124_console_app.h" header which needs to be added as +#include file. + +main.h +^^^^^^ + +The AD7124 example assumes that all the STM32 hardware is initialized and +appropriate SPI and UART port handles are available, and are used in +platform_drivers.c and platform_support.c. The following extern declarations for +the SPI and serial port handles are required in main.h to make them available to +the platform specific code. + +.. code:: c + + extern SPI_HandleTypeDef hspi1; + extern UART_HandleTypeDef huart2; + +.. important:: + + The names of the port handles are defined by the Device Configuration Tool + based on the selected processor and pin choices. If using a different + processor or pins, these may need to be changed in the platform_drivers.c and + platform_support.c files so they match up. + +syscalls.c +^^^^^^^^^^ + +In the \_read(...) function, the 'len' parameter passed in was found to always +be '1024' for the library and build environment used to develop the example +code. + +.. code:: c + + int _read(int file, char *ptr, int len) + +In order to support the use of getchar(), the expression 'len = 1;' was added +immediately before the for loop in the \_read(...) function. While this is +sufficient for getchar() to work, it does not support use of other stdio.h +functions such as scanf(...). + +Adding AD7124 Example Files +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The distribution of the AD7124 source and header files can be added to the +project that has been created. The files can be added in a dedicated 'adi' +directory, or in the main 'src' directory, or split as appropriate between 'src' +and 'inc' directories, according to the file structure being used. If adding new +source and header file locations, then these will need to be added to the build +settings as necessary, in the relevant 'Include paths' in the MCU GCC Compiler +configuration. + +.. important:: + + The platform_support.c/.h files provide the necessary definitions and + declarations of io_getchar(...) and io_putchar(...) to read/write characters + over the serial port to the connected terminal. If using a compiler other + than GCC, or a different serial port than USART2 then there may be additional + changes required to get serial I/O working. Examples included in the ST + Firmware download can provide guidance. + +At this point, assuming that any necessary changes, pin names, port +usage/configuration have been made, the project should compile cleanly. + +Hardware Connections +-------------------- + +Power & USB +~~~~~~~~~~~ + +A 9V DC supply (barrel jack, center pin positive) is required to power the +EVAl-AD7124-8SDZ evaluation board. The NUCLEO-476RG is powered via the USB +connection to the PC, which also provides the serial UART connection back to the +PC. The NUCLEO-476 creates a COM port that can be connected to by a terminal +emulator, e.g. putty. + +.. tip:: + + If you are unsure what COM port to use to communicate with the board, open + Device Manager, and look under the 'Ports (COM & LPT)' node. + +SPI Interface +~~~~~~~~~~~~~ + +SPI connections to the host processor board can be made to the relevant test points on the eval board, or more easily with an :adi:`SDP Breakout Board `. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_digital_interface.png + :align: center + :width: 400 + +================= ================== ================== +AD7124 SPI Signal SDP Breakout Board NUCLEO-L476 +================= ================== ================== +GND 81 GND on CN5.7 +SCLK 82 D3 (PB3) on CN9.4 +DOUT/RDYB 83 D5 (PB4) on CN9.6 +DIN 84 D4 (PB5) on CN9.5 +CSB 85 D6 (PB10) on CN9.7 +================= ================== ================== + +Analog Input +~~~~~~~~~~~~ + +The screw terminal connections to J6 and J11 can be used to connect appropriate +analog input signals to provide test stimulus to the AD7124. + +In Configuration A + +- AIN0/AIN1 are used for channel 0, simple voltage measurement + +In Configuration B + +- AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are captured on channel 0. This uses an internal reference and has a bias voltage enabled on AIN2. A suitable thermocouple should connected to A2 for this measurement. +- AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is provided + from AIN1 for this. This requires an external RTD and reference resistor + connected as show in the figure below. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png + :align: center + :width: 200 + +Console Application +------------------- + +Once the hardware connections are made, and the compiled code programmed into +the board, open the terminal program, and reset the hardware to see the AD7124 +menu that allows a user to perform a variety of functions. These include reset +the device, program one of the pre-defined configurations, and sample data that +is displayed on screen or streamed so it can captured by the console. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png + :align: center + :width: 400 + +.. |ad7124_main_menu.png| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png + :width: 200 +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_continuous_conversion.png + :width: 200 +.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_l476.png +.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_l476.png +.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_gpio.png + :width: 400 +.. |image5| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_config.png + :width: 400 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst new file mode 100644 index 00000000000..b76dc842d73 --- /dev/null +++ b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst @@ -0,0 +1,190 @@ +AD7124 Console Application +========================== + +Introduction +------------ + +This page gives an overview of using the AD7124 Firmware Example with SDP-K1 +EVAL board and AD7124 EVAL board. The firmware example comprises 3 layers of +software (from top to bottom): Console Application Layer, Device No-OS Layer and +Platform Drivers (Mbed-OS) layer. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_layers.jpg + :align: center + :width: 150 + +The application layer uses the ADI Console Libraries to create console based +User Interactive (UI). The middle layer of No-OS device library have device +specific APIs to interface with AD7124 device. These APIs allows direct access +to device register map in order to read/write device registers. The bottom layer +of Platform Drivers is responsible for Low Level Interface. The platform drivers +uses mbed-os libraries to access low level peripheral (like GPIOs, SPI, I2C, +etc). + +The Mbed Platform simplifies the overall software development process by +providing the low level driver support. This reduces the hardware dependency as +any Mbed enabled board can be used with same firmware with little modifications +(precisely changing a pin mapping). + +Interface Diagram +----------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_interface_diagram.jpg + :align: center + :width: 600 + +The :adi:`AD7124-EVAL ` board is connected to :adi:`SDP-K1 ` through default 120-pin SDP Connector. The AD7124-EVAL board has external connector to connect up-to 8 analog inputs. The board needs to be powered-up through 9-12V external DC supply. The SDP-K1 is connected to PC through USB cable. The firmware can be loaded into SDP-K1 board through this USB interface from PC. The SDP-K1 acts as a Serial Device and firmware loaded into it interacts with any serial terminal (like Teraterm, Putty, Coolterm, etc) by configuring terminal for proper serial settings (COM Port, Baud Rate, etc). + +Useful links +------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter + :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +Hardware Connections +-------------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/hardware_connections_ad7124-eval.jpg + :align: center + :width: 400 + +Power Supply and USB Connection +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A 7V to 9V DC supply (barrel jack, center pin positive) is required to power the +EVAL-AD7124-8SDZ evaluation board. SDP-K1 is powered through USB connection to +PC. SDP-K1 acts as a Serial device when connected to PC, which creates a COM +Port to connect to Serial Terminals like Teraterm, Putty, etc. The COM port +assigned to a device can be seen through the device manager for windows based +OS. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg + :align: center + :width: 300 + +Analog Inputs +~~~~~~~~~~~~~ + +The screw terminal connections to J6 and J11 can be used to connect appropriate +analog input signals to provide test stimulus to the AD7124. + +The AD7124 device can be software configured to interface with external devices +(e.g. sensors). The AD7124 Firmware example provides such 2 configurations +(selected through console UI) as described below: + +**Configuration A:** + +AIN0/AIN1 are used for channel 0, simple voltage measurement + +**Configuration B:** + +AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are +captured on channel 0. This uses an internal reference and has a bias voltage +enabled on AIN2. A suitable thermocouple should be connected to A2 for this +measurement. AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is +provided from AIN1 for this. This requires an external RTD and reference +resistor connected as show in the figure below. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png + :align: center + :width: 200 + +Temperature sensing application using AD7124: :adi:`media/en/reference-design-documentation/reference-designs/CN0383.pdf` + +AD7124 Mbed Firmware +-------------------- + +This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. + +.. admonition:: Download + :class: download + + Source code is hosted here: + + + - `precision-converters-firmware `_ + + Build Guide for Precision Converters MBED firmware (Use below link): + + - :doc:`Precision Converters MBED Firmware ` + + +The software execution sequence for the AD7124 Firmware Example is shown below. +This is a blocking application as it waits for user input over serial interface +(UART). The input is scanned and processed through 'adi console libraries'. The +menu functionality is executed from ad7124_conole_app.c file. The application +layer talks with No-OS layer for device registers and data access. The No-OS +layer interfaces with Platform Drivers layer for accessing low level +peripherals. As name suggests, this layer is platform dependent. AD7124 firmware +uses Mbed libraries within Platform Drivers layer. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_sequence.jpg + :align: center + :width: 800 + +Quick Start +=========== + +If you have some familiarity with the Mbed platform, the following is a basic +list of steps required to start running the code, see below for more detail: + +- Connect the AD7124 EVAL-board to the SDP-K1 controller board. +- Connect the SDP-K1 controller board to your computer over USB. +- Go to the link of the code provided above in the 'Downloads' section and import code into Mbed online compiler. +- Ensure SDP-K1 controller board is selected (top right of online-compiler page). +- Compile the code. +- After a successful compile 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. +- 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. + +- Use the menu provided over the terminal window to access the evaluation + board. + +Using the Firmware +------------------ + +The AD7124 firmware example is configured to have following serial settings: + +- Baud rate: 230400 +- Data bits: 8-bits +- Parity: None +- Stop bits: 1 + +Configure your serial terminal (`Tera Term `_) for below settings: + +|image1| The AD7124 Main menu looks like below (with Tera Term): + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_main_menu.jpg + :align: center + :width: 600 + +The firmware is designed to be intuitive to use, and requires little +explanation, simply enter a number corresponding to the required command and +follow the on-screen prompts. + +The console menu application provides the following main features: + +- Enable/Disable individual ADC channel (0-15). +- Connect analog input pins to individual channel. +- Configure the device setup (0-7) and assign to individual channel (0-15). +- Display device and channel setup. +- Perform internal device calibration. +- Read die temperature (using internal temperature sensor). +- Read/Write device registers. + +.. tip:: + + It is hoped that the most common functions of the AD7124 device are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. + +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/baud_rate_update.png + :width: 600 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst new file mode 100644 index 00000000000..9d4d4e3dfd0 --- /dev/null +++ b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst @@ -0,0 +1,322 @@ +AD7124 Temperature Measurement Demo Example +=========================================== + +This page gives an overview of using the 'ARM Mbed' platform supported +temperature measurement firmware example with Analog Devices AD7124 Evaluation +board and SDP-K1 controller board (or any other Mbed supported target board). +The firmware example is console based, which 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 connection block diagram is described below: + +|image1| + +.. important:: + + This code has been developed and tested on SDP-K1 Controller Board using the + on-board Arduino/SDP-120 Headers. However, same code can be used without or + with little modifications on any other Mbed supported board which has Arduino + Header Support on it, such as STM32-Discovery, STM32-Nucleo, etc. + +-------------- + +Useful links +------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter + :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter + +- :doc:`AD7124 No-OS Software ` +- :adi:`AD7124-8 Product Page ` +- :adi:`AD7124-4 Product Page ` +- :adi:`AD7124-8 Evaluation Board ` +- :adi:`AD7124-4 Evaluation Board ` + +-------------- + +Hardware Connections +-------------------- + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_hw_connections.jpg + :align: center + :width: 650 + +.. note:: + + Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive + SDP-K1 GPIOs at 3.3V. + + + For AD7124 evaluation board connections and jumper settings, refer the + respective evaluation board manual. Arduino connector is used as default + interface type for both the boards in the software. + +SDP-K1 is powered through USB connection from the computer. SDP-K1 acts as a +serial device when connected to PC, which creates a COM Port to connect to +serial terminal (console based application) running on windows-os. The COM port +assigned to a device can be seen through the device manager for windows based +OS. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg + :align: center + :width: 350 + +-------------- + +Software Downloads +------------------ + +AD7124 Temperature Measurement Mbed Firmware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. + +.. admonition:: Download + :class: download + + Source code is hosted here: + + + - `precision-converters-firmware `_ + + Build Guide for Precision Converters MBED firmware (Use below link): + + - :doc:`Precision Converters MBED Firmware ` + + +Quick Start to use AD7124 Mbed Firmware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are familiar with the Mbed platform, the following is a basic list of +steps required to start running the code: + +- 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. +- Go to the link of the code provided above in the 'Source Code' section and import the code into the Mbed online compiler +- Ensure the SDP-K1 controller board is selected as the target + + - *If a different controller board is being used, then it should be selected, and the pin out in app_config.h may also need to be updated.* + +- In the Mbed Online IDE compile the code. +- After a successful compile a binary file (.BIN) will be downloaded to your computer. +- Drag and drop this binary to the USB drive corresponding to the SDP-K1 controller board. +- 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 baud, 8 data, no parity, 1 stop bit. + - Reset the controller board and connect. + +- The terminal windows should display the console menu providing access to the + functionality. + +Using the Firmware +------------------ + +Configure your serial terminal (`Tera Term `_) for below settings: + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_example_teraterm_settings.jpg + :align: center + :width: 600 + +The AD7124 temperature measurement example main menu looks like below (with Tera +Term): + +|image2| + +.. tip:: + + The firmware is designed to be intuitive to use, and requires little + explanation, simply enter a number corresponding to the required command and + follow the on-screen prompts. + +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. + +|image3| + +.. tip:: + + 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: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0383.html` + +Multiple 2-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_2_wire_rtd_configs.jpg + :align: center + +Multiple 3-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_3_wire_rtd_configs.jpg + :align: center + +Multiple 4-wire RTD configurations: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_4_wire_rtd_configs.jpg + :align: center + +-------------- + +Multiple Thermocouple Configurations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0384.html` + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_tc_configs.jpg + :align: center + +Cold Junction Compensation (CJC) configurations for TC measurement: +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_cjc_configs.jpg + :align: center + :width: 700 + +-------------- + +Multiple NTC Thermistor Configurations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/cn0545.html` + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_ntc10k_configs.jpg + :align: center + +-------------- + +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 :adi:`design note ` on RTD measurement. + +|image4| + +.. tip:: + + 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. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_calibration_menu.jpg + :align: center + :width: 700 + +-------------- + +Modifying Firmware +------------------ + +.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_sensor_file_structure.jpg + :align: center + :width: 700 + +app_config.h +~~~~~~~~~~~~ + +This file can be used to: + +- Select the 'Active Device' as either AD7124-4 Or AD7124-8. Default active device is AD7124-4. +- Select the SDP_K1 interface type as either Arduino Or SDP-120. Default is + Arduino. + +ad7124_regs_configs.h +~~~~~~~~~~~~~~~~~~~~~ + +This file defines the analog inputs, excitation sources, PGA, reference sources +and power mode for all sensor demo mode configurations. + +ad7124_regs_config_rtd.c, ad7124_regs_config_thermistor.c, ad7124_regs_config_thermocouple.c +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These files define the AD7124 register configurations used for various sensor +demo modes. + +ad7124_user_config.c +~~~~~~~~~~~~~~~~~~~~ + +This file defines the user configurations for the AD7124, such as SPI parameters +(frequency, mode, etc) and other init parameters used by No-OS drivers to +initialize AD7124 device. These are the parameters loaded into device when +device is powered-up or power-cycled. + +ad7124_console_app.c +~~~~~~~~~~~~~~~~~~~~ + +This file defines the functionality for selecting and displaying sensor +configurations (hardcoded in the software), perform ADC sampling on selected +sensor channels and display temperature measurement result for selected sensors. + +ad7124_temperature_sensor.cpp +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This file defines the functions which acts as wrapper for calling 'tempsensor' +library functions to calculate the temperature based on resistance or voltages. +The fixed sensors such as NTC 10K, T type thermocouple, PT100/PT1000 RTD are +used. + +No-OS Drivers for AD7124 +~~~~~~~~~~~~~~~~~~~~~~~~ + +No-OS drivers provide the high level abstracted layer for digital interface of +AD7124 device. The complete digital interface (to access memory map and perform +data read) is done in integration with low level platform drivers. + +The functionality related with No-OS drivers is covered in below 2 files: + +- ad7124.c +- ad7124.h + +.. tip:: + + It is hoped that the most common functions of the AD7124 are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. + +.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_sensor_interface_block.jpg + :width: 650 +.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_measure_main_menu.jpg + :width: 400 +.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/bypassing_lk6_link_on_legacy_board.jpg + :width: 600 +.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_3wire_rtd_calibration_menu.jpg + :width: 700 diff --git a/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst b/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst new file mode 100644 index 00000000000..0a0a4653590 --- /dev/null +++ b/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst @@ -0,0 +1,193 @@ +AD7124 No-OS Software +===================== + +.. important:: + + You're looking at a legacy page. The driver API has since changed and does + not correspond anymore to the driver for ad7124 available in no-OS + repository. However, you may use the code in the following no-OS projects to + see examples of ad7124 driver usage: + + + :git-no-OS:`no-OS/tree/master/projects/ad7124-4sdz ` + + :git-no-OS:`no-OS/tree/master/projects/ad7124-8pmdz ` + + +Introduction +------------ + +This document describes the No-OS software used to control the AD7124 part and +includes an example of how to initialize a AD7124 part. + +Overview +-------- + +The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). + +:adi:`AD7124-4` 4 differential / 7 single-ended inputs, 24-lead TSSOP / 32-lead LFCSP :adi:`AD7124-8` 8 differential / 15 single-ended inputs, 32-lead LFCSP + +The on-chip low gain stage ensures that signals of small amplitude can be interfaced directly to the ADC. One of the major advantages of the :adi:`AD7124 ` is that it gives the user the flexibility to employ one of three integrated power modes. The current consumption, range of output data rates, and rms noise can be tailored with the power mode selected. The device also offers a multitude of filter options, ensuring that the user has the highest degree of flexibility. The :adi:`AD7124 ` can achieve simultaneous 50 Hz and 60 Hz rejection when operating at an output data rate of 25 SPS (single cycle settling), with rejection in excess of 80 dB achieved at lower output data rates. The :adi:`AD7124 ` establishes the highest degree of signal chain integration. The device contains a precision, low noise, low drift internal band gap reference, and also accepts an external differential reference, which can be internally buffered. Other key integrated features include programmable low drift excitation current sources, burnout currents, and a bias voltage generator, which sets the common-mode voltage of a channel to AVDD/2. The low-side power switch enables the user to power down bridge sensors between conversions, ensuring the absolute minimal power consumption of the system. The device also allows the user the option of operating with either an internal clock or an external clock. The integrated channel sequencer allows several channels to be enabled simultaneously, and the :adi:`AD7124 ` sequentially converts on each enabled channel, simplifying communication with the device. As many as 16 channels can be enabled at any time; a channel being defined as an analog input or a diagnostic such as a power supply check or a reference check. This unique feature allows diagnostics to be interleaved with conversions. The :adi:`AD7124 ` also supports per channel configuration. The device allows eight configurations or setups. Each configuration consists of gain, filter type, output data rate, buffering, and reference source. The user can assign any of these setups on a channel by channel basis. The :adi:`AD7124 ` also has extensive diagnostic functionality integrated as part of its comprehensive feature set. These diagnostics include a cyclic redundancy check (CRC), signal chain checks, and serial interface checks, which lead to a more robust solution. These diagnostics reduce the need for external components to implement diagnostics, resulting in reduced board space needs, reduced design cycle times, and cost savings. The failure modes effects and diagnostic analysis (FMEDA) of a typical application has shown a safe failure fraction (SFF) greater than 90% according to IEC 61508. The device operates with a single analog power supply from 2.7 V to 3.6 V or a dual 1.8 V power supply. The digital supply has a range of 1.65 V to 3.6 V. It is specified for a temperature range of −40°C to +105°C. + +Supported Devices +----------------- + +- :adi:`AD7124-4` +- :adi:`AD7124-8` + +Evaluation Boards +----------------- + +- :adi:`EVAL-AD7124-4` +- :adi:`EVAL-AD7124-8` + +Driver Description +------------------ + +The driver contains two parts: + +- The driver for the AD7124 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 Communication Driver has a standard interface, so the AD7124 driver can be +used exactly as it is provided. + +There are three functions which are called by the AD7124 driver: + +- SPI_Init() – initializes the communication peripheral. +- SPI_Write() – writes data to the device. +- SPI_Read() – reads data from the device. + +.. image:: https://wiki.analog.com/_media/resources/tools-software/uc-drivers/spi_architecture.png + :align: center + +.. container:: centeralign + + SPI driver architecture + +The AD7124 driver contains the following: + +- AD7124.h - Header file of the driver. Contains the driver function declarations, custom data types to be used by the driver and driver specific constants. +- AD7124.c - Implementation file of the driver. Contains the implementations of the driver functions. +- AD7124_regs.h - Register map of the driver. Contains the register map + definitions and an array of all device registers to be used with the driver. + +The following functions are implemented in this version of AD7124 driver: + ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| Function | Description | ++========================================================================================+==========================================================================+ +| ``int32_t AD7124_ReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_NoCheckReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register without a device state check. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_NoCheckWriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register without a device state check. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_Reset(ad7124_device *device)`` | Resets the device. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitForSpiReady(ad7124_device *device, uint32_t timeout)`` | Waits until the device can accept read and write user actions. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitToPowerOn(ad7124_device *device, uint32_t timeout)`` | Waits until the device finishes the power-on reset operation. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_WaitForConvReady(ad7124_device *device, uint32_t timeout)`` | Waits until a new conversion result is available. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_ReadData(ad7124_device *device, int32_t* pData)`` | Reads the conversion result from the device. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``uint8_t AD7124_ComputeCRC8(uint8_t* pBuf, uint8_t bufSize)`` | Computes the CRC checksum for a data buffer. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``void AD7124_UpdateCRCSetting(ad7124_device *device)`` | Updates the CRC settings. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``void AD7124_UpdateDevSpiSettings(ad7124_device *device)`` | Updates the device SPI interface settings. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ +| ``int32_t AD7124_Setup(ad7124_device *device, int slave_select, ad7124_st_reg *regs)`` | Initializes the AD7124. | ++----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ + +Downloads +--------- + +.. admonition:: Download + :class: download + + + - **AD7124 Driver:** :git-no-OS:`drivers/adc/ad7124` + - **Generic Platform Driver** :git-no-OS:`drivers/platform/generic` + + +Using the API +------------- + +The driver can only work together with a structure that holds the state of a +device, where state means all information about the device including a copy of +all register values written to the device at a certain point. This structure +will henceforth be referred as an instance of a driver. All driver functions +take a handler of a driver instance as the first argument. This allows the +driver to be used with multiple devices simultaneously, without the need to +replicate the .c and .h files. + +Before using any API call, an instance of the driver must first be created and +then initialized using the AD7124_Setup() which has the following parameters: + +- **device**: the reference of the new driver instance. A new instance can be obtained by simply declaring one: struct ad7124_device my_ad7124; +- **slave_select**: the index of the SPI Chip Select. It will be stored into the driver instance to be used with all SPI calls for that particular instance. +- **regs**: must point to a register array of the device. It will be too stored into the driver and used by the driver. There is a default register array already defined in AD7124_regs.h and AD7124_regs.c files. The name of the array is ad7124_regs and can be passed here as parameter. Alternatively, a new register array can be defined by user which must be properly initialized before calling AD7124_Setup() function. ad7124_st_reg my_ad7124_regs[AD7124_REG_NO]; + +A AD7124_Setup() call will also reset the part then use all register values stored in the array pointed by the **regs** parameter to configure the part (the registers flagged as "Read-only" will be skipped). + +The following code snipped provides an example of driver usage: + +.. code:: c + + #include "AD7124.h" /* AD7124 definitions */ + #include "AD7124_regs.h" /* We want to use the ad7124_regs array defined in ad7124_regs.h/.c */ + + void main(void) + { + struct ad7124_device my_ad7124; /* A new driver instance */ + struct ad7124_device *ad7124_handler = &my_ad7124; /* A driver handle to pass around */ + enum ad7124_registers regNr; /* Variable to iterate through registers */ + long timeout = 1000; /* Number of tries before a function times out */ + long ret = 0; /* Return value */ + long sample; /* Stores raw value read from the ADC */ + + /* Initialize AD7124 device. */ + ret = AD7124_Setup(ad7124_handler, AD7124_SLAVE_ID, (ad7124_st_reg *)&ad7124_regs); + if (ret < 0) + { + /* AD7124 initialization failed, check the value of ret! */ + } + else + { + /* AD7124 initialization OK */ + } + + /* Read all registers */ + for (regNr = AD7124_Status; (regNr < AD7124_REG_NO) && !(ret < 0); regNr++) + { + ret = AD7124_ReadRegister(ad7124_handler, &ad7124_regs[regNr]); + } + + /* Read data from the ADC */ + ret = AD7124_WaitForConvReady(ad7124_handler, timeout); + if (ret < 0) + { + /* Something went wrong, check the value of ret! */ + } + + ret = AD7124_ReadData(ad7124_handler, &sample); + if (ret < 0) + { + /* Something went wrong, check the value of ret! */ + } + } + +More information +================ + +.. note:: + + See `more-information `_ From c1f29b984b480e08ee742ffd3f10de0d606c3d7f Mon Sep 17 00:00:00 2001 From: Vicentiu Neagoe Date: Tue, 7 Apr 2026 13:21:26 +0300 Subject: [PATCH 2/4] Fix build: remove leaked wiki-migration source files, fix index.rst Co-Authored-By: Claude Opus 4.6 --- .../linux-drivers/iio-adc/ad7124.rst | 207 --------- .../product-support-software/ad7124-stm32.rst | 392 ------------------ .../ad7124_mbed_support.rst | 190 --------- .../ad7124_temperature_measurement_demo.rst | 322 -------------- .../tools-software/uc-drivers/ad7124.rst | 193 --------- 5 files changed, 1304 deletions(-) delete mode 100644 docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst delete mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst delete mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst delete mode 100644 docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst delete mode 100644 docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst diff --git a/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst b/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst deleted file mode 100644 index ac2590878c4..00000000000 --- a/docs/wiki-migration/resources/tools-software/linux-drivers/iio-adc/ad7124.rst +++ /dev/null @@ -1,207 +0,0 @@ -AD7124 IIO Sigma-Delta ADC Linux Driver -======================================= - -Supported Devices ------------------ - -This driver supports the - -- :adi:`AD7124-4` -- :adi:`AD7124-8` - -Evaluation Boards ------------------ - -- :adi:`EVAL-AD7124-4` -- :adi:`EVAL-AD7124-8` - -Description ------------ - -This is a Linux industrial I/O (:doc:`IIO `) subsystem driver, targeting single channel serial interface ADCs. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See :doc:`IIO ` for more information. - -Status ------- - -+------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ -| Source | Mainlined? | -+============================================================================================================+============================================================================================================+ -| `git `_ | `Yes `_ | -+------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ - -Files ------ - -+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| Function | File | -+=====================+===================================================================================================================================================================================================+ -| driver | `drivers/iio/adc/ad7124.c `_ | -+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| devicetree bindings | `Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml `_ | -+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - -Driver testing -============== - -Each and every IIO device, typically a hardware chip, has a device folder under -/sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under -every of these directory folders reside a set of files, depending on the -characteristics and features of the hardware device in question. These files are -consistently generalized and documented in the IIO ABI documentation. In order -to determine which IIO deviceX corresponds to which hardware device, the user -can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the -sequence in which the iio device drivers are loaded/registered is constant, the -numbering is constant and may be known in advance. - -.. tip:: - - \ TIP: An example program which uses the interface can be found here: - - - - :doc:`IIO Oscilloscope ` - - -.. container:: box bggreen - - This specifies any shell prompt running on the target - - - :: - - root:/> cd /sys/bus/iio/devices/ - root:/sys/bus/iio/devices> ls - iio:device0 - - root:/sys/bus/iio/devices> cd iio\:device0 - - root:/sys/bus/iio/devices/iio:device0> ls -l - drwxr-xr-x 2 root root 0 Jun 23 21:46 buffer - -r--r--r-- 1 root root 4096 Jun 23 21:46 dev - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_offset - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_raw - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_sampling_frequency - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_scale - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_offset - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_raw - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_sampling_frequency - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_scale - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_offset - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_raw - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_sampling_frequency - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_scale - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_offset - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_raw - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_sampling_frequency - -rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_scale - -r--r--r-- 1 root root 4096 Jun 23 21:46 name - lrwxrwxrwx 1 root root 0 Jun 23 21:46 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ad7124-4@0 - drwxr-xr-x 2 root root 0 Jun 23 21:46 power - drwxr-xr-x 2 root root 0 Jun 23 21:46 scan_elements - lrwxrwxrwx 1 root root 0 Jun 23 21:46 subsystem -> ../../../../../../../../bus/iio - drwxr-xr-x 2 root root 0 Jun 23 21:46 trigger - -rw-r--r-- 1 root root 4096 Jun 23 21:46 uevent - - -Show device name ----------------- - -.. container:: box bggreen - - This specifies any shell prompt running on the target - - - :: - - root:/sys/bus/iio/devices/iio:device0> cat name - ad7124-4 - - -Show channel scale and offset ------------------------------ - -**Description:** Scales and offsets to be applied to in_voltagex_voltagey_raw in order to obdatin the measured voltage in millivolts - -.. container:: box bggreen - - This specifies any shell prompt running on the target - - - :: - - root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_scale - 0.000149011 - root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_offset - 0 - root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_raw - 2679470 - - -**Description:** Channel Ainp0-Ainm1 is configured as unipolar, with a gain of 1 **U** = //in_voltage0-voltage1_raw \* in_voltage0-voltage1_scale - in_voltage0-voltage1_offset // = 2679470 \* 0.000149011 - 0 = **399.27 mV** - -.. container:: box bggreen - - This specifies any shell prompt running on the target - - - :: - - root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_scale - 0.000298023 - root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_offset - -2500 - root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_raw - 9716211 - - -**Description:** Channel Ainp2-Ainm3 is configured as bipolar, with a gain of 1 **U** = //in_voltage2-voltage3_raw \* in_voltage2-voltage3_scale - in_voltage2-voltage3_offset // = 9716211\* 0.000298023 - 2500= **395.65 mV** - -Set sampling frequency ----------------------- - -**Description:** The output data rate depends on the master clock frequency (fclk) which in turn determines the power mode: - -- Full power (fCLK = 614.4 kHz): 9.38 SPS to 19,200 SPS -- Mid power (fCLK = 153.6 kHz): 2.34 SPS to 4800 SPS -- Low power (fCLK = 76.8 kHz): 1.17 SPS to 2400 SPS - -.. container:: box bggreen - - This specifies any shell prompt running on the target - - - :: - - root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_sampling_frequency - 10 - root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_sampling_frequency - 960 - root:/sys/bus/iio/devices/iio:device0> echo 2400 > in_voltage0-voltage1_sampling_frequency - root:/sys/bus/iio/devices/iio:device0> cat in_voltage0-voltage1_sampling_frequency - 2400 - root:/sys/bus/iio/devices/iio:device0> echo 5000 > in_voltage2-voltage3_sampling_frequency - root:/sys/bus/iio/devices/iio:device0> cat in_voltage2-voltage3_sampling_frequency - 4800 - - -More Information -================ - -- IIO mailing list: linux-iio@vger.kernel.org -- `IIO Linux Kernel Documentation sysfs-bus-iio-\* `_ -- `IIO Documentation `_ -- :doc:`IIO test and visualization application ` -- :doc:`libiio - IIO system library ` -- :doc:`libiio - Internals ` -- :doc:`Pointers and good books ` -- `IIO High Speed `_ -- `Software Defined Radio using the IIO framework `_ -- - -|libiio introduction| - -*Need Help?* - -- :ez:`Analog Devices Linux Device Drivers Help Forum ` -- `Ask a Question `_ - -.. |libiio introduction| image:: https://wiki.analog.com/_media/software/linux/docs/iio/youtube>p_vntewue24 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst deleted file mode 100644 index 0d5409da370..00000000000 --- a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124-stm32.rst +++ /dev/null @@ -1,392 +0,0 @@ -AD7124 Example on STM32 Processors -================================== - -Introduction ------------- - -This describes how to take the AD7124 example code and integrate it with STM32 -firmware libraries in a suitable development environment to produce a complete -program. The IDE used here is the STM32CubeIDE, but the general procedure can be -applied to other IDEs. - -Useful links ------------- - -- :doc:`AD7124 No-OS Software ` -- :adi:`AD7124-8 Product Page ` -- :adi:`AD7124-4 Product Page ` -- :adi:`AD7124-8 Evaluation Board ` -- :adi:`AD7124-4 Evaluation Board ` - -Overview --------- - -The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). The AD7124 example application provides a terminal based console interface that allows a user to select between different configurations, and to sample data in single or continuous conversion modes. - -|ad7124_main_menu.png| |image1| - -The example makes use of the :doc:`AD7124 No-OS ` software drivers and platform drivers that are using the STM32 HAL firmware libraries. - -.. important:: - - The example code was developed and tested using the Nucleo-L476RG with - version 1.14.0 of the STM32 firmware libraries, and STMCube32IDE v1.0.0. - However, it may be re-targeted to other STM32 processors/boards, through the - use of the appropriate ST firmware HAL libraries. - -Software Integration Guide --------------------------- - -Downloads -~~~~~~~~~ - -.. admonition:: Download - :class: download - - - - `ad7124_stm32_example.zip `_ - - -Project Creation -~~~~~~~~~~~~~~~~ - -- If you have not already done so, install the STM32CubeIDE available from www.st.com. -- In the Firmware Update section of the STM32CubeIDE preferences, set the - location to where the firmware package is going to be stored. - - - You may want to place this in a common location, e.g. 'C:\\ST\\Repository' - and not in a directory located under your home directory, to avoid user - specific paths in any shared configuration files - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_firmware_repo.png - :alt: ad7124_firmware_repo.png - :align: center - :width: 400 - -- Select the File >> New >> STM32 project menu option. -- Select the MCU part number or Board being used - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_select_l476.png - :align: center - :width: 400 - -- Give the Project a name, select target language, and project type of - STM32Cube - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_project_setup.png - :align: center - :width: 400 - -- Make sure the Target Reference is correct as it can't be changed once the project is created, and the firmware package repository path is as expected. Set the Code Generator Options to reference library files, or copy library files in your project, depending on how you want to structure your project. -- When you click Finish, the STM32CudeIDE will download the firmware library if - required and unzip it to the repository location specified above. This file - is typically 100's MB in size so this will take several minutes to complete. - -Configuring the Project -~~~~~~~~~~~~~~~~~~~~~~~ - -The Device Configuration Tool with automatic code generation is used to define -pin usage and other default modes of operation for the NUCLEO-L476. In addition -there are some build and linker settings that may be required depending on the -default project build configuration. - -.. important:: - - The pins and configuration provided here need to be tailored to the specific - board/processor being used. - -Device Configuration Tool -^^^^^^^^^^^^^^^^^^^^^^^^^ - -A 4-wire SPI bus is used to connect AD7124 to the NUCLEO-L476RG board, and a -UART is used to provide the serial I/O for the console interface. An LED is also -used to indicate activity. The following sections detail the configuration -settings that need to be made for each of these. - -SPI -""" - -SPI1 port on the processor is used to communicate with the AD7124, with the pin -assigned to each function as shown here, with the corresponding label. - -.. tip:: - - It is recommended that a pull-up resistor be used on the SPI MOSI to ensure - it is never floating in an undefined logic state. This can be a resistor on - the board to the logic supply, or internal to the processor if available. - -|image2| |image3| - -The pin PB10 is used as a software controlled chips select for SP1, and so its -mode must be set to GPIO_output, and set the user label to SPI1_NSS to match -what is used in the platform driver file. The Connectivity >> SPI1 configuration -settings are shown here. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_config.png - :align: center - :width: 400 - -DMA and interrupts are not used and don't need to be configured. The SPI1 GPIO -Settings are as follows. - -{{ :resources:tools-software:product-support-software:ad7124\_\ -example:ad7124_spi_gpios.png?400 \|} - -The GPIO settings for PB10 are as follows. - -|image4| - -Serial UART -""""""""""" - -The serial port uses USART2, and no DMA or interrupts need to be configured. - -|image5| - -The USART2 GPIO settings are as shown. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_gpios.png - :align: center - :width: 400 - -GPIO -"""" - -An LED is toggled on the NUCLEO-L476 board to indicate sampling and other -activity. The activity LED is controlled by Port A, Pin 5, and needs to enabled -as digital output to support this function. - -Build Settings -^^^^^^^^^^^^^^ - -The printf(...) function is used to print numbers formatted as floating point -values in the terminal view. As this feature is often disabled by default due to -the additional memory requirement, floating point support in printf(...) must be -enabled. In the Project properties window, under 'C/C++ Build >> Settings >> MCU -GCC linker >> Miscellaneous > Other Flags' add a '-u \_printf_float' option. - -.. tip:: - - There is also a checkbox option to enable this in the MCU Settings view as - well, but doing it in the linker section, seems to prevent the code analysis - feature in the SMT32CubeIDE reporting '%f' as not supported in the code - editor window. There is no problem enabling it in both locations in - STM32CubeIDE. - -If there are other source or include directories that need to be added to -support the project build, they should also be added to the relevant 'Include -paths' in the MCU GCC Compiler section as required. - -Linker Files -^^^^^^^^^^^^ - -The default value for \_estack may be incorrect in the \*.ld files. This can -cause problems when calling into certain library functions. In particular this -can prevent the %f format specifier working with the floating point version of -printf(...). If instead of a value like '1.23', the terminal output is '0.00', -this can indicate a need to update the linker \*.ld files. For the -NUCLEO-L476RG, the RAM and the FLASH versions of the ld files contain the -following: - -.. code:: c - - /* Highest address of the user mode stack */ - _estack = 0x20017fff; /* end of "RAM" Ram type memory */ - -Changing this as follows fixes the issues related to floating point support in -printf: - -.. code:: c - - /* Highest address of the user mode stack */ - _estack = 0x20018000; /* end of "RAM" Ram type memory */ - -Source File Edits -~~~~~~~~~~~~~~~~~ - -When using the Device Configuration Tool, the code generator produces a two of -these source files, main.c and main.h need minor edits to integrate the AD7124 -example code. There may be an edit required to the \_read(...) function in -syscalls.c to work around an issue, but whether this is required, will depend on -the specific library and build environment. - -main.c -^^^^^^ - -To keep the integration of the AD7124 example application with other user and -platform specific code, there are only two functions that a user needs to call -from their own code, typically as part of the main function. - -- ad7124_app_initialize(..) that does all the one-time initialization work - required by the app, mainly AD7124 device setup - - - It is strongly recommended to test the return value from this function to - determine if the initialization was successful or not - -:: - - *A value less than 0 indicate failure. - -.. code:: c - - /* Initialize the AD7124 application before the main loop */ - int32_t setupResult; - if ((setupResult = ad7124_app_initialize(AD7124_CONFIG_A)) < 0 ) { - // Handle error setting up AD7124 here - } - -- adi_do_console_menu(...) displays the user menu to interact with the - application features - - - This can be called in a while(1) loop so that it is always displayed. - -.. code:: c - - while(1) { - // display the console menu for the AD7124 application - adi_do_console_menu(&ad7124_main_menu); - } - -Both are defined in the "ad7124_console_app.h" header which needs to be added as -#include file. - -main.h -^^^^^^ - -The AD7124 example assumes that all the STM32 hardware is initialized and -appropriate SPI and UART port handles are available, and are used in -platform_drivers.c and platform_support.c. The following extern declarations for -the SPI and serial port handles are required in main.h to make them available to -the platform specific code. - -.. code:: c - - extern SPI_HandleTypeDef hspi1; - extern UART_HandleTypeDef huart2; - -.. important:: - - The names of the port handles are defined by the Device Configuration Tool - based on the selected processor and pin choices. If using a different - processor or pins, these may need to be changed in the platform_drivers.c and - platform_support.c files so they match up. - -syscalls.c -^^^^^^^^^^ - -In the \_read(...) function, the 'len' parameter passed in was found to always -be '1024' for the library and build environment used to develop the example -code. - -.. code:: c - - int _read(int file, char *ptr, int len) - -In order to support the use of getchar(), the expression 'len = 1;' was added -immediately before the for loop in the \_read(...) function. While this is -sufficient for getchar() to work, it does not support use of other stdio.h -functions such as scanf(...). - -Adding AD7124 Example Files -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The distribution of the AD7124 source and header files can be added to the -project that has been created. The files can be added in a dedicated 'adi' -directory, or in the main 'src' directory, or split as appropriate between 'src' -and 'inc' directories, according to the file structure being used. If adding new -source and header file locations, then these will need to be added to the build -settings as necessary, in the relevant 'Include paths' in the MCU GCC Compiler -configuration. - -.. important:: - - The platform_support.c/.h files provide the necessary definitions and - declarations of io_getchar(...) and io_putchar(...) to read/write characters - over the serial port to the connected terminal. If using a compiler other - than GCC, or a different serial port than USART2 then there may be additional - changes required to get serial I/O working. Examples included in the ST - Firmware download can provide guidance. - -At this point, assuming that any necessary changes, pin names, port -usage/configuration have been made, the project should compile cleanly. - -Hardware Connections --------------------- - -Power & USB -~~~~~~~~~~~ - -A 9V DC supply (barrel jack, center pin positive) is required to power the -EVAl-AD7124-8SDZ evaluation board. The NUCLEO-476RG is powered via the USB -connection to the PC, which also provides the serial UART connection back to the -PC. The NUCLEO-476 creates a COM port that can be connected to by a terminal -emulator, e.g. putty. - -.. tip:: - - If you are unsure what COM port to use to communicate with the board, open - Device Manager, and look under the 'Ports (COM & LPT)' node. - -SPI Interface -~~~~~~~~~~~~~ - -SPI connections to the host processor board can be made to the relevant test points on the eval board, or more easily with an :adi:`SDP Breakout Board `. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_digital_interface.png - :align: center - :width: 400 - -================= ================== ================== -AD7124 SPI Signal SDP Breakout Board NUCLEO-L476 -================= ================== ================== -GND 81 GND on CN5.7 -SCLK 82 D3 (PB3) on CN9.4 -DOUT/RDYB 83 D5 (PB4) on CN9.6 -DIN 84 D4 (PB5) on CN9.5 -CSB 85 D6 (PB10) on CN9.7 -================= ================== ================== - -Analog Input -~~~~~~~~~~~~ - -The screw terminal connections to J6 and J11 can be used to connect appropriate -analog input signals to provide test stimulus to the AD7124. - -In Configuration A - -- AIN0/AIN1 are used for channel 0, simple voltage measurement - -In Configuration B - -- AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are captured on channel 0. This uses an internal reference and has a bias voltage enabled on AIN2. A suitable thermocouple should connected to A2 for this measurement. -- AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is provided - from AIN1 for this. This requires an external RTD and reference resistor - connected as show in the figure below. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png - :align: center - :width: 200 - -Console Application -------------------- - -Once the hardware connections are made, and the compiled code programmed into -the board, open the terminal program, and reset the hardware to see the AD7124 -menu that allows a user to perform a variety of functions. These include reset -the device, program one of the pre-defined configurations, and sample data that -is displayed on screen or streamed so it can captured by the console. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png - :align: center - :width: 400 - -.. |ad7124_main_menu.png| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_main_menu.png - :width: 200 -.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_continuous_conversion.png - :width: 200 -.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_spi_l476.png -.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_l476.png -.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_csb_gpio.png - :width: 400 -.. |image5| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_uart_config.png - :width: 400 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst deleted file mode 100644 index b76dc842d73..00000000000 --- a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_mbed_support.rst +++ /dev/null @@ -1,190 +0,0 @@ -AD7124 Console Application -========================== - -Introduction ------------- - -This page gives an overview of using the AD7124 Firmware Example with SDP-K1 -EVAL board and AD7124 EVAL board. The firmware example comprises 3 layers of -software (from top to bottom): Console Application Layer, Device No-OS Layer and -Platform Drivers (Mbed-OS) layer. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_layers.jpg - :align: center - :width: 150 - -The application layer uses the ADI Console Libraries to create console based -User Interactive (UI). The middle layer of No-OS device library have device -specific APIs to interface with AD7124 device. These APIs allows direct access -to device register map in order to read/write device registers. The bottom layer -of Platform Drivers is responsible for Low Level Interface. The platform drivers -uses mbed-os libraries to access low level peripheral (like GPIOs, SPI, I2C, -etc). - -The Mbed Platform simplifies the overall software development process by -providing the low level driver support. This reduces the hardware dependency as -any Mbed enabled board can be used with same firmware with little modifications -(precisely changing a pin mapping). - -Interface Diagram ------------------ - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_interface_diagram.jpg - :align: center - :width: 600 - -The :adi:`AD7124-EVAL ` board is connected to :adi:`SDP-K1 ` through default 120-pin SDP Connector. The AD7124-EVAL board has external connector to connect up-to 8 analog inputs. The board needs to be powered-up through 9-12V external DC supply. The SDP-K1 is connected to PC through USB cable. The firmware can be loaded into SDP-K1 board through this USB interface from PC. The SDP-K1 acts as a Serial Device and firmware loaded into it interacts with any serial terminal (like Teraterm, Putty, Coolterm, etc) by configuring terminal for proper serial settings (COM Port, Baud Rate, etc). - -Useful links ------------- - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter - :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter - -- :doc:`AD7124 No-OS Software ` -- :adi:`AD7124-8 Product Page ` -- :adi:`AD7124-4 Product Page ` -- :adi:`AD7124-8 Evaluation Board ` -- :adi:`AD7124-4 Evaluation Board ` - -Hardware Connections --------------------- - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/hardware_connections_ad7124-eval.jpg - :align: center - :width: 400 - -Power Supply and USB Connection -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -A 7V to 9V DC supply (barrel jack, center pin positive) is required to power the -EVAL-AD7124-8SDZ evaluation board. SDP-K1 is powered through USB connection to -PC. SDP-K1 acts as a Serial device when connected to PC, which creates a COM -Port to connect to Serial Terminals like Teraterm, Putty, etc. The COM port -assigned to a device can be seen through the device manager for windows based -OS. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg - :align: center - :width: 300 - -Analog Inputs -~~~~~~~~~~~~~ - -The screw terminal connections to J6 and J11 can be used to connect appropriate -analog input signals to provide test stimulus to the AD7124. - -The AD7124 device can be software configured to interface with external devices -(e.g. sensors). The AD7124 Firmware example provides such 2 configurations -(selected through console UI) as described below: - -**Configuration A:** - -AIN0/AIN1 are used for channel 0, simple voltage measurement - -**Configuration B:** - -AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are -captured on channel 0. This uses an internal reference and has a bias voltage -enabled on AIN2. A suitable thermocouple should be connected to A2 for this -measurement. AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is -provided from AIN1 for this. This requires an external RTD and reference -resistor connected as show in the figure below. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_example/ad7124_rtd_thermocouple_connections.png - :align: center - :width: 200 - -Temperature sensing application using AD7124: :adi:`media/en/reference-design-documentation/reference-designs/CN0383.pdf` - -AD7124 Mbed Firmware --------------------- - -This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. - -.. admonition:: Download - :class: download - - Source code is hosted here: - - - - `precision-converters-firmware `_ - - Build Guide for Precision Converters MBED firmware (Use below link): - - - :doc:`Precision Converters MBED Firmware ` - - -The software execution sequence for the AD7124 Firmware Example is shown below. -This is a blocking application as it waits for user input over serial interface -(UART). The input is scanned and processed through 'adi console libraries'. The -menu functionality is executed from ad7124_conole_app.c file. The application -layer talks with No-OS layer for device registers and data access. The No-OS -layer interfaces with Platform Drivers layer for accessing low level -peripherals. As name suggests, this layer is platform dependent. AD7124 firmware -uses Mbed libraries within Platform Drivers layer. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_software_sequence.jpg - :align: center - :width: 800 - -Quick Start -=========== - -If you have some familiarity with the Mbed platform, the following is a basic -list of steps required to start running the code, see below for more detail: - -- Connect the AD7124 EVAL-board to the SDP-K1 controller board. -- Connect the SDP-K1 controller board to your computer over USB. -- Go to the link of the code provided above in the 'Downloads' section and import code into Mbed online compiler. -- Ensure SDP-K1 controller board is selected (top right of online-compiler page). -- Compile the code. -- After a successful compile 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. -- 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. - -- Use the menu provided over the terminal window to access the evaluation - board. - -Using the Firmware ------------------- - -The AD7124 firmware example is configured to have following serial settings: - -- Baud rate: 230400 -- Data bits: 8-bits -- Parity: None -- Stop bits: 1 - -Configure your serial terminal (`Tera Term `_) for below settings: - -|image1| The AD7124 Main menu looks like below (with Tera Term): - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_main_menu.jpg - :align: center - :width: 600 - -The firmware is designed to be intuitive to use, and requires little -explanation, simply enter a number corresponding to the required command and -follow the on-screen prompts. - -The console menu application provides the following main features: - -- Enable/Disable individual ADC channel (0-15). -- Connect analog input pins to individual channel. -- Configure the device setup (0-7) and assign to individual channel (0-15). -- Display device and channel setup. -- Perform internal device calibration. -- Read die temperature (using internal temperature sensor). -- Read/Write device registers. - -.. tip:: - - It is hoped that the most common functions of the AD7124 device are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. - -.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/baud_rate_update.png - :width: 600 diff --git a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst b/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst deleted file mode 100644 index 9d4d4e3dfd0..00000000000 --- a/docs/wiki-migration/resources/tools-software/product-support-software/ad7124_temperature_measurement_demo.rst +++ /dev/null @@ -1,322 +0,0 @@ -AD7124 Temperature Measurement Demo Example -=========================================== - -This page gives an overview of using the 'ARM Mbed' platform supported -temperature measurement firmware example with Analog Devices AD7124 Evaluation -board and SDP-K1 controller board (or any other Mbed supported target board). -The firmware example is console based, which 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 connection block diagram is described below: - -|image1| - -.. important:: - - This code has been developed and tested on SDP-K1 Controller Board using the - on-board Arduino/SDP-120 Headers. However, same code can be used without or - with little modifications on any other Mbed supported board which has Arduino - Header Support on it, such as STM32-Discovery, STM32-Nucleo, etc. - --------------- - -Useful links ------------- - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter - :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter - -- :doc:`AD7124 No-OS Software ` -- :adi:`AD7124-8 Product Page ` -- :adi:`AD7124-4 Product Page ` -- :adi:`AD7124-8 Evaluation Board ` -- :adi:`AD7124-4 Evaluation Board ` - --------------- - -Hardware Connections --------------------- - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_hw_connections.jpg - :align: center - :width: 650 - -.. note:: - - Connect the VIO_ADJUST jumper on the SDP-K1 board to 3.3V position to drive - SDP-K1 GPIOs at 3.3V. - - - For AD7124 evaluation board connections and jumper settings, refer the - respective evaluation board manual. Arduino connector is used as default - interface type for both the boards in the software. - -SDP-K1 is powered through USB connection from the computer. SDP-K1 acts as a -serial device when connected to PC, which creates a COM Port to connect to -serial terminal (console based application) running on windows-os. The COM port -assigned to a device can be seen through the device manager for windows based -OS. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/com_port_sdp-k1.jpg - :align: center - :width: 350 - --------------- - -Software Downloads ------------------- - -AD7124 Temperature Measurement Mbed Firmware -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This section briefs on the usage of MBED firmware. This also explains the steps to compile and build the application using mbed and *make* based build. - -.. admonition:: Download - :class: download - - Source code is hosted here: - - - - `precision-converters-firmware `_ - - Build Guide for Precision Converters MBED firmware (Use below link): - - - :doc:`Precision Converters MBED Firmware ` - - -Quick Start to use AD7124 Mbed Firmware -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If you are familiar with the Mbed platform, the following is a basic list of -steps required to start running the code: - -- 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. -- Go to the link of the code provided above in the 'Source Code' section and import the code into the Mbed online compiler -- Ensure the SDP-K1 controller board is selected as the target - - - *If a different controller board is being used, then it should be selected, and the pin out in app_config.h may also need to be updated.* - -- In the Mbed Online IDE compile the code. -- After a successful compile a binary file (.BIN) will be downloaded to your computer. -- Drag and drop this binary to the USB drive corresponding to the SDP-K1 controller board. -- 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 baud, 8 data, no parity, 1 stop bit. - - Reset the controller board and connect. - -- The terminal windows should display the console menu providing access to the - functionality. - -Using the Firmware ------------------- - -Configure your serial terminal (`Tera Term `_) for below settings: - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_example_teraterm_settings.jpg - :align: center - :width: 600 - -The AD7124 temperature measurement example main menu looks like below (with Tera -Term): - -|image2| - -.. tip:: - - The firmware is designed to be intuitive to use, and requires little - explanation, simply enter a number corresponding to the required command and - follow the on-screen prompts. - -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. - -|image3| - -.. tip:: - - 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: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0383.html` - -Multiple 2-wire RTD configurations: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_2_wire_rtd_configs.jpg - :align: center - -Multiple 3-wire RTD configurations: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_3_wire_rtd_configs.jpg - :align: center - -Multiple 4-wire RTD configurations: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_4_wire_rtd_configs.jpg - :align: center - --------------- - -Multiple Thermocouple Configurations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/CN0384.html` - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_tc_configs.jpg - :align: center - -Cold Junction Compensation (CJC) configurations for TC measurement: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_cjc_configs.jpg - :align: center - :width: 700 - --------------- - -Multiple NTC Thermistor Configurations -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Reference: :adi:`en/design-center/reference-designs/circuits-from-the-lab/cn0545.html` - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_ntc10k_configs.jpg - :align: center - --------------- - -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 :adi:`design note ` on RTD measurement. - -|image4| - -.. tip:: - - 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. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_calibration_menu.jpg - :align: center - :width: 700 - --------------- - -Modifying Firmware ------------------- - -.. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temp_sensor_file_structure.jpg - :align: center - :width: 700 - -app_config.h -~~~~~~~~~~~~ - -This file can be used to: - -- Select the 'Active Device' as either AD7124-4 Or AD7124-8. Default active device is AD7124-4. -- Select the SDP_K1 interface type as either Arduino Or SDP-120. Default is - Arduino. - -ad7124_regs_configs.h -~~~~~~~~~~~~~~~~~~~~~ - -This file defines the analog inputs, excitation sources, PGA, reference sources -and power mode for all sensor demo mode configurations. - -ad7124_regs_config_rtd.c, ad7124_regs_config_thermistor.c, ad7124_regs_config_thermocouple.c -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -These files define the AD7124 register configurations used for various sensor -demo modes. - -ad7124_user_config.c -~~~~~~~~~~~~~~~~~~~~ - -This file defines the user configurations for the AD7124, such as SPI parameters -(frequency, mode, etc) and other init parameters used by No-OS drivers to -initialize AD7124 device. These are the parameters loaded into device when -device is powered-up or power-cycled. - -ad7124_console_app.c -~~~~~~~~~~~~~~~~~~~~ - -This file defines the functionality for selecting and displaying sensor -configurations (hardcoded in the software), perform ADC sampling on selected -sensor channels and display temperature measurement result for selected sensors. - -ad7124_temperature_sensor.cpp -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This file defines the functions which acts as wrapper for calling 'tempsensor' -library functions to calculate the temperature based on resistance or voltages. -The fixed sensors such as NTC 10K, T type thermocouple, PT100/PT1000 RTD are -used. - -No-OS Drivers for AD7124 -~~~~~~~~~~~~~~~~~~~~~~~~ - -No-OS drivers provide the high level abstracted layer for digital interface of -AD7124 device. The complete digital interface (to access memory map and perform -data read) is done in integration with low level platform drivers. - -The functionality related with No-OS drivers is covered in below 2 files: - -- ad7124.c -- ad7124.h - -.. tip:: - - It is hoped that the most common functions of the AD7124 are coded, but it's likely that some special functionality is not implemented. Feel free to consult Analog Devices :adi:`Engineer-Zone ` for feature requests, feedback, bug-reports etc. - -.. |image1| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_multiple_sensor_interface_block.jpg - :width: 650 -.. |image2| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_temperature_measure_main_menu.jpg - :width: 400 -.. |image3| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/bypassing_lk6_link_on_legacy_board.jpg - :width: 600 -.. |image4| image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/ad7124_3wire_rtd_calibration_menu.jpg - :width: 700 diff --git a/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst b/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst deleted file mode 100644 index 0a0a4653590..00000000000 --- a/docs/wiki-migration/resources/tools-software/uc-drivers/ad7124.rst +++ /dev/null @@ -1,193 +0,0 @@ -AD7124 No-OS Software -===================== - -.. important:: - - You're looking at a legacy page. The driver API has since changed and does - not correspond anymore to the driver for ad7124 available in no-OS - repository. However, you may use the code in the following no-OS projects to - see examples of ad7124 driver usage: - - - :git-no-OS:`no-OS/tree/master/projects/ad7124-4sdz ` - - :git-no-OS:`no-OS/tree/master/projects/ad7124-8pmdz ` - - -Introduction ------------- - -This document describes the No-OS software used to control the AD7124 part and -includes an example of how to initialize a AD7124 part. - -Overview --------- - -The :adi:`AD7124 ` is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). - -:adi:`AD7124-4` 4 differential / 7 single-ended inputs, 24-lead TSSOP / 32-lead LFCSP :adi:`AD7124-8` 8 differential / 15 single-ended inputs, 32-lead LFCSP - -The on-chip low gain stage ensures that signals of small amplitude can be interfaced directly to the ADC. One of the major advantages of the :adi:`AD7124 ` is that it gives the user the flexibility to employ one of three integrated power modes. The current consumption, range of output data rates, and rms noise can be tailored with the power mode selected. The device also offers a multitude of filter options, ensuring that the user has the highest degree of flexibility. The :adi:`AD7124 ` can achieve simultaneous 50 Hz and 60 Hz rejection when operating at an output data rate of 25 SPS (single cycle settling), with rejection in excess of 80 dB achieved at lower output data rates. The :adi:`AD7124 ` establishes the highest degree of signal chain integration. The device contains a precision, low noise, low drift internal band gap reference, and also accepts an external differential reference, which can be internally buffered. Other key integrated features include programmable low drift excitation current sources, burnout currents, and a bias voltage generator, which sets the common-mode voltage of a channel to AVDD/2. The low-side power switch enables the user to power down bridge sensors between conversions, ensuring the absolute minimal power consumption of the system. The device also allows the user the option of operating with either an internal clock or an external clock. The integrated channel sequencer allows several channels to be enabled simultaneously, and the :adi:`AD7124 ` sequentially converts on each enabled channel, simplifying communication with the device. As many as 16 channels can be enabled at any time; a channel being defined as an analog input or a diagnostic such as a power supply check or a reference check. This unique feature allows diagnostics to be interleaved with conversions. The :adi:`AD7124 ` also supports per channel configuration. The device allows eight configurations or setups. Each configuration consists of gain, filter type, output data rate, buffering, and reference source. The user can assign any of these setups on a channel by channel basis. The :adi:`AD7124 ` also has extensive diagnostic functionality integrated as part of its comprehensive feature set. These diagnostics include a cyclic redundancy check (CRC), signal chain checks, and serial interface checks, which lead to a more robust solution. These diagnostics reduce the need for external components to implement diagnostics, resulting in reduced board space needs, reduced design cycle times, and cost savings. The failure modes effects and diagnostic analysis (FMEDA) of a typical application has shown a safe failure fraction (SFF) greater than 90% according to IEC 61508. The device operates with a single analog power supply from 2.7 V to 3.6 V or a dual 1.8 V power supply. The digital supply has a range of 1.65 V to 3.6 V. It is specified for a temperature range of −40°C to +105°C. - -Supported Devices ------------------ - -- :adi:`AD7124-4` -- :adi:`AD7124-8` - -Evaluation Boards ------------------ - -- :adi:`EVAL-AD7124-4` -- :adi:`EVAL-AD7124-8` - -Driver Description ------------------- - -The driver contains two parts: - -- The driver for the AD7124 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 Communication Driver has a standard interface, so the AD7124 driver can be -used exactly as it is provided. - -There are three functions which are called by the AD7124 driver: - -- SPI_Init() – initializes the communication peripheral. -- SPI_Write() – writes data to the device. -- SPI_Read() – reads data from the device. - -.. image:: https://wiki.analog.com/_media/resources/tools-software/uc-drivers/spi_architecture.png - :align: center - -.. container:: centeralign - - SPI driver architecture - -The AD7124 driver contains the following: - -- AD7124.h - Header file of the driver. Contains the driver function declarations, custom data types to be used by the driver and driver specific constants. -- AD7124.c - Implementation file of the driver. Contains the implementations of the driver functions. -- AD7124_regs.h - Register map of the driver. Contains the register map - definitions and an array of all device registers to be used with the driver. - -The following functions are implemented in this version of AD7124 driver: - -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| Function | Description | -+========================================================================================+==========================================================================+ -| ``int32_t AD7124_ReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_WriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_NoCheckReadRegister(ad7124_device *device, ad7124_st_reg* pReg)`` | Reads the value of the specified register without a device state check. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_NoCheckWriteRegister(ad7124_device *device, ad7124_st_reg reg)`` | Writes the value of the specified register without a device state check. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_Reset(ad7124_device *device)`` | Resets the device. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_WaitForSpiReady(ad7124_device *device, uint32_t timeout)`` | Waits until the device can accept read and write user actions. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_WaitToPowerOn(ad7124_device *device, uint32_t timeout)`` | Waits until the device finishes the power-on reset operation. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_WaitForConvReady(ad7124_device *device, uint32_t timeout)`` | Waits until a new conversion result is available. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_ReadData(ad7124_device *device, int32_t* pData)`` | Reads the conversion result from the device. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``uint8_t AD7124_ComputeCRC8(uint8_t* pBuf, uint8_t bufSize)`` | Computes the CRC checksum for a data buffer. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``void AD7124_UpdateCRCSetting(ad7124_device *device)`` | Updates the CRC settings. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``void AD7124_UpdateDevSpiSettings(ad7124_device *device)`` | Updates the device SPI interface settings. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ -| ``int32_t AD7124_Setup(ad7124_device *device, int slave_select, ad7124_st_reg *regs)`` | Initializes the AD7124. | -+----------------------------------------------------------------------------------------+--------------------------------------------------------------------------+ - -Downloads ---------- - -.. admonition:: Download - :class: download - - - - **AD7124 Driver:** :git-no-OS:`drivers/adc/ad7124` - - **Generic Platform Driver** :git-no-OS:`drivers/platform/generic` - - -Using the API -------------- - -The driver can only work together with a structure that holds the state of a -device, where state means all information about the device including a copy of -all register values written to the device at a certain point. This structure -will henceforth be referred as an instance of a driver. All driver functions -take a handler of a driver instance as the first argument. This allows the -driver to be used with multiple devices simultaneously, without the need to -replicate the .c and .h files. - -Before using any API call, an instance of the driver must first be created and -then initialized using the AD7124_Setup() which has the following parameters: - -- **device**: the reference of the new driver instance. A new instance can be obtained by simply declaring one: struct ad7124_device my_ad7124; -- **slave_select**: the index of the SPI Chip Select. It will be stored into the driver instance to be used with all SPI calls for that particular instance. -- **regs**: must point to a register array of the device. It will be too stored into the driver and used by the driver. There is a default register array already defined in AD7124_regs.h and AD7124_regs.c files. The name of the array is ad7124_regs and can be passed here as parameter. Alternatively, a new register array can be defined by user which must be properly initialized before calling AD7124_Setup() function. ad7124_st_reg my_ad7124_regs[AD7124_REG_NO]; - -A AD7124_Setup() call will also reset the part then use all register values stored in the array pointed by the **regs** parameter to configure the part (the registers flagged as "Read-only" will be skipped). - -The following code snipped provides an example of driver usage: - -.. code:: c - - #include "AD7124.h" /* AD7124 definitions */ - #include "AD7124_regs.h" /* We want to use the ad7124_regs array defined in ad7124_regs.h/.c */ - - void main(void) - { - struct ad7124_device my_ad7124; /* A new driver instance */ - struct ad7124_device *ad7124_handler = &my_ad7124; /* A driver handle to pass around */ - enum ad7124_registers regNr; /* Variable to iterate through registers */ - long timeout = 1000; /* Number of tries before a function times out */ - long ret = 0; /* Return value */ - long sample; /* Stores raw value read from the ADC */ - - /* Initialize AD7124 device. */ - ret = AD7124_Setup(ad7124_handler, AD7124_SLAVE_ID, (ad7124_st_reg *)&ad7124_regs); - if (ret < 0) - { - /* AD7124 initialization failed, check the value of ret! */ - } - else - { - /* AD7124 initialization OK */ - } - - /* Read all registers */ - for (regNr = AD7124_Status; (regNr < AD7124_REG_NO) && !(ret < 0); regNr++) - { - ret = AD7124_ReadRegister(ad7124_handler, &ad7124_regs[regNr]); - } - - /* Read data from the ADC */ - ret = AD7124_WaitForConvReady(ad7124_handler, timeout); - if (ret < 0) - { - /* Something went wrong, check the value of ret! */ - } - - ret = AD7124_ReadData(ad7124_handler, &sample); - if (ret < 0) - { - /* Something went wrong, check the value of ret! */ - } - } - -More information -================ - -.. note:: - - See `more-information `_ From 0a58728dd250255741809a325ed9c94ee113f8aa Mon Sep 17 00:00:00 2001 From: Vicentiu Neagoe Date: Tue, 7 Apr 2026 13:46:10 +0300 Subject: [PATCH 3/4] Fix :doc: refs to wiki-migration paths and RST errors Co-Authored-By: Claude Opus 4.6 --- .../reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst | 4 ++-- .../eval-ad7124-8-pmdz/ad7124_mbed_support.rst | 4 ++-- .../ad7124_temperature_measurement_demo.rst | 4 ++-- .../reference-designs/eval-ad7124-8-pmdz/demo/index.rst | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst index 0d5409da370..3c6cd283f6c 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124-stm32.rst @@ -12,7 +12,7 @@ applied to other IDEs. Useful links ------------ -- :doc:`AD7124 No-OS Software ` +- `AD7124 No-OS Software `_ - :adi:`AD7124-8 Product Page ` - :adi:`AD7124-4 Product Page ` - :adi:`AD7124-8 Evaluation Board ` @@ -25,7 +25,7 @@ The :adi:`AD7124 ` is a low power, low noise, completely integrated an |ad7124_main_menu.png| |image1| -The example makes use of the :doc:`AD7124 No-OS ` software drivers and platform drivers that are using the STM32 HAL firmware libraries. +The example makes use of the `AD7124 No-OS `_ software drivers and platform drivers that are using the STM32 HAL firmware libraries. .. important:: diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst index b76dc842d73..c7c06f0883d 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_mbed_support.rst @@ -41,7 +41,7 @@ Useful links .. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter -- :doc:`AD7124 No-OS Software ` +- `AD7124 No-OS Software `_ - :adi:`AD7124-8 Product Page ` - :adi:`AD7124-4 Product Page ` - :adi:`AD7124-8 Evaluation Board ` @@ -112,7 +112,7 @@ This section briefs on the usage of MBED firmware. This also explains the steps Build Guide for Precision Converters MBED firmware (Use below link): - - :doc:`Precision Converters MBED Firmware ` + - `Precision Converters MBED Firmware `_ The software execution sequence for the AD7124 Firmware Example is shown below. diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst index 9d4d4e3dfd0..8a467f3f47a 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/ad7124_temperature_measurement_demo.rst @@ -27,7 +27,7 @@ Useful links .. image:: https://wiki.analog.com/_media/resources/tools-software/product-support-software/section>resources/tools-software/product-support-software/useful_links#useful_link&showfooter=nofooter :alt: section>resources/tools-software/product-support-software/useful_links#Useful Link&showfooter=nofooter -- :doc:`AD7124 No-OS Software ` +- `AD7124 No-OS Software `_ - :adi:`AD7124-8 Product Page ` - :adi:`AD7124-4 Product Page ` - :adi:`AD7124-8 Evaluation Board ` @@ -82,7 +82,7 @@ This section briefs on the usage of MBED firmware. This also explains the steps Build Guide for Precision Converters MBED firmware (Use below link): - - :doc:`Precision Converters MBED Firmware ` + - `Precision Converters MBED Firmware `_ Quick Start to use AD7124 Mbed Firmware diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/demo/index.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/demo/index.rst index 71857872743..6a6d5e85b1a 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/demo/index.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/demo/index.rst @@ -108,9 +108,9 @@ line driver / receiver and connected to the PC via a 9-pin or 25-pin serial port.) There are many open-source applications, and while there are many choices, typically we use one of the following: -- `TeraTerm `__ -- `Putty `__ -- `Real Term `__ +- `TeraTerm `_ +- `Putty `_ +- `Real Term `_ Before continuing, please make sure you download and install one of the above programs. From 049d554de46b4fc34bca56ff08b6d80ddde39f5a Mon Sep 17 00:00:00 2001 From: Vicentiu Neagoe Date: Tue, 7 Apr 2026 15:37:56 +0300 Subject: [PATCH 4/4] Fix build: remove duplicate toctree entry Co-Authored-By: Claude Opus 4.6 --- docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst index 4ec32f2c395..ae8ff5c5ac9 100644 --- a/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst +++ b/docs/solutions/reference-designs/eval-ad7124-8-pmdz/index.rst @@ -233,7 +233,6 @@ Reference Demos & Software .. toctree:: :hidden: - ad7124 ad7124 ad7124-stm32 ad7124_mbed_support