Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
reference:zmod:zmodadc:zmodadc1410libraryuserguide [2020/01/15 15:26]
Cristian Fatu [4.2. ADC Acquisition Related Functions of ZMODADC1410 Class]
reference:zmod:zmodadc:zmodadc1410libraryuserguide [2020/04/01 11:40] (current)
Monica Ignat [2.3. Calibration Related Functions of ZMODADC1410 Class]
Line 3: Line 3:
  
 ====== 1. Overview ====== ====== 1. Overview ======
-Digilent provides the ZmodADC1410 Libraryused to access [[https://​store.digilentinc.com/​zmod-adc-1410-syzygy-compatible-dual-channel-14-bit-analog-to-digital-converter-module/​|ZmodADC1410]] functionality.\\  +Digilent provides the ZmodADC1410 Library used to access [[https://​store.digilentinc.com/​zmod-adc-1410-syzygy-compatible-dual-channel-14-bit-analog-to-digital-converter-module/​|ZmodADC1410]] functionality.\\  
-It is part of a pack of libraries to handle the Zmod modules functionality. They covers ​both linux and baremetal (standalone) platforms.\\  +It is part of a pack of libraries to handle the Zmod modules functionality. They cover both Linux and baremetal (standalone) platforms.\\  
-The [[reference:​zmod:​zmodbaselibraryuserguide|Zmod Base Library]] implements the functionality that is common to all the Zmods.\\  +The [[reference:​zmod:​zmodbaselibraryuserguide|Zmod Base Library]] implements the functionality that is common to all Zmods.\\  
-For each Zmod, separate libraries are implemented,​ based on Zmod Base Library. This document describes the ZmodADC1410 Library.\\  +For each Zmod, separate libraries are implemented,​ based on the Zmod Base Library. This document describes the ZmodADC1410 Library.\\  
-The current usage instructions / demos are provided for the ZmodADC1410 attached to Eclipse ​board, still ZmodADC1410 can be attached to any Zynq board providing the SZG connector.\\  +The current usage instructions / demos are provided for the ZmodADC1410 attached to Eclypse ​board, still ZmodADC1410 can be attached to any Zynq board providing the SYZYGY ​connector.\\  
-The following ​picture ​shows the overall structure of Zmod Libraries.+The following ​image shows the overall structure of Zmod Libraries.
 {{ :​reference:​programmable-logic:​eclypse-z7:​zmod_dev-board_structure_-_adc.png}} {{ :​reference:​programmable-logic:​eclypse-z7:​zmod_dev-board_structure_-_adc.png}}
  
-The ZmodADC1410 and Zmod Base Library run in the Zynq PS (processing system).\\  +The ZmodADC1410 and Zmod Base Library run on the Zynq PS (processing system).\\  
-In the Zynq PL (FPGAthere is an IP core specific to ZmodADC1410. This IP core can be accessed from the Zynq PS through its registers. The IP core is able to communicate with the memory ​over the AXI DMA data bus. Each Zmod has associated ​one particular ​instance of AXI DMA IP core.\\ ​+A ZmodADC1410 specific IP core needs to be instantiated in the programmable logic (PL). This IP core can be accessed from the Zynq PS through its registers. The IP core is able to communicate with the memory ​through a DMA engine. Each Zmod has one particular AXI DMA IP core associated.\\ 
 Basically: Basically:
-  * The ZMODADC1410 IP (figured ​ZMOD_ADC in the above image) features an internal buffer. +  * The ZMODADC1410 IP (labeled ​ZMOD_ADC in the above image) features an internal buffer. 
-  * The ZMODADC1410 IP acquires data (fills its internal buffer) ​using its on-board analog to digital converter device. ​+  * The ZMODADC1410 IP acquires data (fills its internal buffer) ​from its on-board analog to digital converter device. ​
   * Eventually, the ZMODADC1410 IP waits for a trigger condition before starting the acquisition. ​   * Eventually, the ZMODADC1410 IP waits for a trigger condition before starting the acquisition. ​
   * The ZMODADC1410 IP reports when its internal buffer is full.    * The ZMODADC1410 IP reports when its internal buffer is full. 
-  * The ZMODADC1410 Library initiates an AXI DMA receive transfer, transferring data from the IP internal buffer into a memory buffer allocated by ZMODADC1410 Library. This buffer contains data for both channels. +  * The ZMODADC1410 Library initiates an AXI DMA receive transfer, transferring data from the IP'​s ​internal buffer into a memory buffer allocated by ZMODADC1410 Library. This buffer contains data for both channels. 
-Read more on [[#​zmodadc1410_ip_behaviour|ZMODADC1410 IP behaviour]].+Read more on [[#​zmodadc1410_ip_behaviour|ZMODADC1410 IP behaviour]] ​below in the page.
  
  
-====== 2. Library Usage ====== +====== 2. ZMODADC1410 Library Implementation Details ====== 
-The ZMODADC1410 library is delivered as part of the Zmod libraries pack.\\  +The ZMODADC1410 Library implementation ​uses the Zmod Base Librarywhich provides the needed functionality in order to access hardware resources in a consistent manner. No hardware related functionality is implemented on ZMODADC1410 Library.\\ ​
-The library usage is similar for all Zmod libraries, and is explained in the +
-[[reference:​zmod:​zmodbaselibraryuserguide#​library_usage|Library usage]] +
-chapter of Zmod Base Library user guide. +
- +
-====== 3. Background Knowledge ====== +
-===== 3.1. ZMODADC1410 IP Behaviour ===== +
-Basically, the ZMODADC1410 IP (figured ZMOD_ADC in the above image) controls the [[https://​store.digilentinc.com/​zmod-adc-1410-syzygy-compatible-dual-channel-14-bit-analog-to-digital-converter-module/​|ZmodADC1410]] device. It exposes to PS a set of command and status registers. The ZMODADC1410 Library uses these registers to control the IP and read its status.\\  +
-Using these registers, the ADC acquisition can be configured, started or stopped. ADC acquisition means that the ZMODADC1410 IP fills an internal buffer with digital values provided by its on-board analog to digital converter device and then calibrated. The internal buffer has a maximum length of 2^14 - 1 samples and is 32 bits wide, accommodating both ZmodADC1410 channels. The internal buffer length must be set using IP registers.\\  +
-Eventually, the ZMODADC1410 IP waits for a trigger condition before starting the ADC acquisition. This means that the values are compared to a trigger condition and acquisition only starts when the trigger condition is met. The trigger module allows setting the trigger mode, trigger edge, trigger level and window position.\\ ​  +
-The ZMODADC1410 IP reports when its internal buffer is full. While the internal buffer is full, no acquisition is performed.  +
-The ZMODADC1410 Library initiates an AXIDMA-S2MM (AXIDMA receive) transfer, transferring data from the ZMODADC1410 IP internal buffer into a memory buffer allocated by ZMODADC1410 Library. The transferred length must be set using IP registers and AXI DMA registers.\\  +
-The ZMODADC1410 IP can be configured to raise a Buffer Full interrupt, still this interrupt can only be handled by baremetal hardware platform.\\  +
-The ZMODADC1410 IP configures the Analog to Digital acquisition using two gains: HIGH and LOW. In the HIGH gain the input analog values are in the +/- 1 V range, while in LOW gain the input analog values are in the +/- 25 V range.\\  +
-The ZMODADC1410 IP applies calibration coefficients over the digital values got from Analog to Digital acquisition,​ in order to provide exact values. For this, the IP provides calibration registers where the calibration coefficients are set. Normally these coefficients are computed (by the library) starting from the calibration values stored during manufacturing process in the Zmod persistent memory (flash).\\  +
-Read more on [[#​terminology|Terminology]] chapter for more details. +
-===== 3.2. Terminology ===== +
-^ Term  ^ Meaning ​ ^ +
-|channel ​  |One of the two ADC channels provided by ZmodADC1410:​\\ 0 - channel 1\\ 1 - channel 2 | +
-|trigger level   |The value referred by the trigger condition | +
-|trigger mode   |The value indicating the trigger mode:\\ 0 - normal\\ 1 - no trigger | +
-|trigger edge   |The value indicating the trigger edge:\\ 0 - rising\\ 1 - falling | +
-|internal buffer length ​  |The length of the ZmodADC1410 IP internal buffer.\\ Maximum value = 0x3FFE | +
-|transfer length ​  |The number of samples to be transferred over AXI DMA.\\ It has the same value as the internal buffer length. | +
-|window position ​  |The position in the buffer where trigger condition is met.\\ Maximum value = internal buffer length. | +
-|S2MM   ​|**S**tream to **M**emory **Ma**pped\\ The AXI DMA Receive mode | +
-|gain   |The gain for ZmodADC1410:​\\ 0 - LOW Gain\\ 1 - High gain | +
-|coupling ​  |The coupling for ZmodADC1410:​\\ 0 - DC Coupling\\ 1 - AC Coupling| +
- +
-====== 4. ZMODADC1410 Library Implementation Details ====== +
-The ZMODADC1410 Library implementation ​benefits from Zmod Base Library ​implementation ​which provides the needed functionality in order to access hardware resources in a consistent manner. No hardware related functionality is implemented on ZMODADC1410 Library.\\ ​+
 The ZMODADC1410 Library implementation consists of: The ZMODADC1410 Library implementation consists of:
   * a CPP class called ZMODADC1410 Class, derived(inherited) from [[reference:​zmod:​zmodbaselibraryuserguide#​zmod_class|ZMOD base class]]. ZMODADC1410 class is implemented in the zmodadc1410.h,​ zmodadc1410.cpp source files.   * a CPP class called ZMODADC1410 Class, derived(inherited) from [[reference:​zmod:​zmodbaselibraryuserguide#​zmod_class|ZMOD base class]]. ZMODADC1410 class is implemented in the zmodadc1410.h,​ zmodadc1410.cpp source files.
   *  ZMODADC1410 specific registers and register fields definitions contained in the zmodadc1410.h header file.   *  ZMODADC1410 specific registers and register fields definitions contained in the zmodadc1410.h header file.
  
- +===== 2.1. ZMODADC1410 Class Constructor ​ =====
-===== 4.1. ZMODADC1410 Class Constructor ​ =====+
  
 The //​ZMODADC1410 class constructor//​ calls the ZMOD base class constructor providing all the required parameters. For these parameters and how they can be obtained by the user, read [[reference:​zmod:​zmodbaselibraryuserguide#​zmod_class_constructordestructor|ZMOD class Constructor / Destructor]] chapter.\\ ​ The //​ZMODADC1410 class constructor//​ calls the ZMOD base class constructor providing all the required parameters. For these parameters and how they can be obtained by the user, read [[reference:​zmod:​zmodbaselibraryuserguide#​zmod_class_constructordestructor|ZMOD class Constructor / Destructor]] chapter.\\ ​
 The constructor also calls //​initCalib//​ calibration initialziation function, providing the ZmodADC1410 unique ID and the length of the ZmodADC1410 calibration area (see [[reference:​zmod:​zmodbaselibraryuserguide#​calibration_functions_of_zmod_class|Calibration functions of ZMOD class]]). The constructor also calls //​initCalib//​ calibration initialziation function, providing the ZmodADC1410 unique ID and the length of the ZmodADC1410 calibration area (see [[reference:​zmod:​zmodbaselibraryuserguide#​calibration_functions_of_zmod_class|Calibration functions of ZMOD class]]).
   ​   ​
- + ===== 2.2. ADC Acquisition Related Functions of ZMODADC1410 Class ===== 
-===== 4.2. ADC Acquisition Related Functions of ZMODADC1410 Class ===== +ZMODADC1410 class provides functions that implement the analog to digital converter function.  
-ZMODADC1410 class provides functions that relate to ZMODADC1410'​s ​analog to digital converter function.  +Read [[#​zmodadc1410_IP_behaviour|ZMODADC1410 IP behaviour]] chapter for details about ZMODADC1410 IP functionality.\\ ​
-Read [[#​zmodadc1410_IP_behaviour|ZMODADC1410 IP behaviour]] chapter for some details about ZMODADC1410 IP functionality.\\ ​+
 The acquisition related functions of ZMODADC1410 class  are implemented using basic ZMOD class functionality. The acquisition related functions of ZMODADC1410 class  are implemented using basic ZMOD class functionality.
-  * The //​allocChannelsBuffer//​ function allocates acquisition buffer, while the //​freeChannelsBuffer//​ frees the allocated buffer. For these functions, the length is provided in number of elements in the acquisition buffer (each element has the size of bytes).  +  * The //​allocChannelsBuffer//​ function allocates acquisition buffer, while the //​freeChannelsBuffer//​ frees the allocated buffer. For these functions, the length is provided in number of elements in the acquisition buffer (each element has 4-byte representation).  
-  * The //​channelData//​ and //​signedChannelData//​ functions extract ​each channel ​14 bits data from one 32 bits value stored in the acquisition buffer.+  * The //​channelData//​ and //​signedChannelData//​ functions extract 14-bit data for each channel, ​from one 32-bit value stored in the acquisition buffer.
   * the //​setTrigger//​ function sets the trigger values for a specific channel, level, edge and window position.   * the //​setTrigger//​ function sets the trigger values for a specific channel, level, edge and window position.
-  * the //​isBufferFull//​ function reads the buffer full status bit. +  * the //​isBufferFull//​ function reads the "buffer full" ​status bit. 
-  * the //​waitForBufferFullPolling//​ function waits (blocks) until the buffer full status bit is set. +  * the //​waitForBufferFullPolling//​ function waits (blocks) until the "buffer full" ​status bit is set. 
-  * the //​enableBufferFullInterrupt//​ function enables / disables the buffer full interrupt. Note that buffer full interrupt cannot be enabled on linux+  * the //​enableBufferFullInterrupt//​ function enables / disables the "buffer full" ​interrupt. Note that "buffer full" ​interrupt cannot be enabled on Linux
-  * the //start// and //stop// functions start and stop the acquisition process. For example, if the IP Core is armed waiting for a trigger condition, ​it can be stopped, the trigger condition can be modified and started again+  * the //start// and //stop// functions start and stop the acquisition process. For example, if the acquisition process ​is started and waiting for a trigger condition, ​the acquisition process ​can be stopped, the trigger condition can be modified and the acquisition process resumed
-  * the //​acquireTriggeredPolling//​ function automates the following ​process by calling some of the above mentioned ​functions:​ +  * the //​acquireTriggeredPolling//​ function automates the process by calling some of the previously described ​functions. Processes
-    * sets the acquisition ​details (trigger, window position) +    * sets the trigger condition ​details (channel, trigger mode, trigger ​value, window position) 
-    * start the acquisition +    * starts ​the acquisition 
-    * wait until IP internal buffer is full - the IP status is checked by polling +    * waits until IP internal buffer is full - the IP status is checked by polling 
-    * transfer ​data from the internal buffer over the AXI DMA. +    * transfers ​data from the internal buffer over the AXI DMA 
-  * the //​acquireImmediatePolling//​ function is similar to the above mentioned function, the difference ​is that no trigger condition is defined.+  * the //​acquireImmediatePolling//​ function is similar to the above mentioned function, the difference ​being that no trigger condition is defined.
   * the //​autoTestRamp//​ function automates the following process:   * the //​autoTestRamp//​ function automates the following process:
-    * configures the analog to digital converter into a ramp test mode. In this mode, it generates raising consecutive values in a ramp manner+    * configures the analog to digital converter into a ramp test mode. In this mode, it generates raising consecutive values in a ramp manner.
     * starts the //​acquireTriggeredPolling//​ function     * starts the //​acquireTriggeredPolling//​ function
     * interprets the acquired data to be consistent with the ramp pattern, trigger condition, window position. It returns the status of this comparison.     * interprets the acquired data to be consistent with the ramp pattern, trigger condition, window position. It returns the status of this comparison.
-  * the //setGain// function allows setting the gain (LOW / HIGH) for a specific channel.+  * the //setGain// function allows setting the gain (LOW / HIGH) corresponding to the values range (HIGH / LOW)  ​for a specific channel.
   * the //​setCoupling//​ function allows setting the coupling (AC / DC) for a specific channel.   * the //​setCoupling//​ function allows setting the coupling (AC / DC) for a specific channel.
-  * the //​getVoltFromSignedRaw//​ function converts a signed ​value value (as obtained as an element in the acquisition buffer) to a value in Volts. ​+  * the //​getVoltFromSignedRaw//​ function converts a signed value (as element in the acquisition buffer) to a value in Volts. ​
 <WRAP center round box 100%> <WRAP center round box 100%>
-The following functions are only defined for baremetal ​platform, because the ZMODADC1410 IP Buffer full interrupt is not implemented on linux:+The following functions are only defined for **Baremetal** ​platform, because the ZMODADC1410 IP Buffer full interrupt is **not** implemented on **Linux**:
   * the //​acquireTriggeredInterrupt//​ function automates the following process:   * the //​acquireTriggeredInterrupt//​ function automates the following process:
-    * sets the acquisition ​details (trigger, window position) +    * sets the trigger condition ​details (channel, trigger mode, trigger ​value, window position) 
-    * start the acquisition +    * starts ​the acquisition 
-    * wait until IP internal buffer is full - the buffer full is checked by waiting for buffer full interrupt;  +    * waits until IP internal buffer is full - the buffer full is checked by waiting for buffer full interrupt;  
-    * transfer ​data from the internal buffer over the AXI DMA. +    * transfers ​data from the internal buffer over the AXI DMA. 
-  * the //​acquireImmediateInterrupt//​ function is similar to the above mentioned function, the difference ​is that no trigger condition is defined.+  * the //​acquireImmediateInterrupt//​ function is similar to the above mentioned function, the difference ​being that no trigger condition is defined.
 </​WRAP>​ </​WRAP>​
  
-===== 4.3. Calibration Related Functions of ZMODADC1410 Class =====+===== 2.3. Calibration Related Functions of ZMODADC1410 Class =====
 The [[reference:​zmod:​zmodbaselibraryuserguide#​calibration_functions_of_zmod_class|Calibration functions of ZMOD class]] chapter provides information about all the calibration functionality provided by the base ZMOD class.\\ ​ The [[reference:​zmod:​zmodbaselibraryuserguide#​calibration_functions_of_zmod_class|Calibration functions of ZMOD class]] chapter provides information about all the calibration functionality provided by the base ZMOD class.\\ ​
 The //​readUserCalib//​ function calls the base class function //​readUserCalib//​ in order to populate the calibration data, then interprets the calibration data as ZMODADC1410 calibration,​ computes and sets the ZMODADC1410 IP calibration coefficients.\\ ​ The //​readUserCalib//​ function calls the base class function //​readUserCalib//​ in order to populate the calibration data, then interprets the calibration data as ZMODADC1410 calibration,​ computes and sets the ZMODADC1410 IP calibration coefficients.\\ ​
-The ZMODADC1410 class provides //​setCalibValues//​ function that allows user to set the pair of calibration values (gain, additive) for a specific channel (0 or 1) and gain (HIGH, LOW). This function only changes the calibration data image so for these changes ​to be effective  ​the //​writeUserCalib//​ must be called. ​+The ZMODADC1410 class provides //​setCalibValues//​ function that allows ​the user to set the calibration ​pair values (gain, additive) for a specific channel (1, 2) and gain (LOW, HIGH). This function only changes the calibration data imageso in order to actually apply the changes, ​the //​writeUserCalib// ​function ​must be called. ​
 <WRAP center round important 80%> <WRAP center round important 80%>
 The //​writeUserCalib//​ function should be used very careful, as it may alter the calibration values. Note that calibration values can be always restored using //​restoreFactoryCalib//​ function. The //​writeUserCalib//​ function should be used very careful, as it may alter the calibration values. Note that calibration values can be always restored using //​restoreFactoryCalib//​ function.
 </​WRAP>​ </​WRAP>​
  
- +===== 2.4. Register Definitions - ZMODADC1410 Specific ===== 
- +As explained in the [[reference:​zmod:​zmodbaselibraryuserguide#​ip_register_access_functions_of_zmod_class|IP Register access functions of ZMOD class]], the ZMOD class provides read/write register and read/write register ​bit field functions, both in signed and unsigned versions: //​readReg//,​ //​writeReg//,​ //​readRegFld//,​ //​writeRegFld//,​ //​readSignedRegFld//​ and //​writeSignedRegFld//​.\\ 
-  +The registers and register ​bit fields common to all Zmods are defined in the base class header zmod.h and are prefixed by ZMOD_REG and ZMOD_REGFLD.\\  
- +The registers and register ​bit fields specific to ZMODADC1410 are defined in the ZMODADC1410 class header (zmodadc1410.h) and are prefixed by ZMODADC1410_REG and ZMODADC1410_REGFLD.\\ ​
- +
- +
- +
- +
- +
-===== 3.4. Register Definitions - ZMODADC1410 Specific ===== +
-As explained in [[reference:​zmod:​zmodbaselibraryuserguide#​ip_register_access_functions_of_zmod_class|IP Register access functions of ZMOD class]], the ZMOD class provides read/write register and read/write register field functions ​are provided, both in signed and unsigned versions: //​readReg//,​ //​writeReg//,​ //​readRegFld//,​ //​writeRegFld//,​ //​readSignedRegFld//​ and //​writeSignedRegFld//​.\\ +
-The registers and register fields common to all Zmods are defined in the base class header zmod.h and are prefixed by ZMOD_REG and ZMOD_REGFLD.\\  +
-The registers and register fields specific to ZMODADC1410 are defined in the ZMODADC1410 class header (zmodadc1410.h) and are prefixed by ZMODADC1410_REG and ZMODADC1410_REGFLD.\\ ​+
 The following table lists the common and ZMODADC1410 specific register definitions. The ZMODADC1410 specific register definitions are highlighted in <color #​22b14c>​green</​color>​. The following table lists the common and ZMODADC1410 specific register definitions. The ZMODADC1410 specific register definitions are highlighted in <color #​22b14c>​green</​color>​.
  
-^ Address ​                     ^ Register ​                                                  ^ Field                                                                                                                                                                             ​|||| +^ Address ​                     ^ Register ​                                                  ​^ ​Bit Field                                                                                                                                                                             ​|||| 
-| :::                          | :::                                                        ^ Field name                                                   ^ Start bit                  ^ Length ​                    ^ Description ​                                                ^+| :::                          | :::                                                        ^ Bit Field name                                                   ^ Start bit                  ^ Length ​                    ^ Description ​                                                ^
 | 0x00                         | ZMOD_REG_ADDR_CR ​                                          | ZMOD_REGFLD_CR_CMD_RUNSTP ​                                   | 1                          | 1                          | CMD_RUNSTP field of CR register ​                            | | 0x00                         | ZMOD_REG_ADDR_CR ​                                          | ZMOD_REGFLD_CR_CMD_RUNSTP ​                                   | 1                          | 1                          | CMD_RUNSTP field of CR register ​                            |
 | :::                          | :::                                                        | ZMOD_REGFLD_CR_CMD_READ_EN ​                                  | 2                          | 1                          | CMD_READ_EN field of CR register ​                           | | :::                          | :::                                                        | ZMOD_REGFLD_CR_CMD_READ_EN ​                                  | 2                          | 1                          | CMD_READ_EN field of CR register ​                           |
Line 160: Line 119:
  
  
 +====== 3. Library Usage ======
  
 +The ZMODADC1410 library is delivered as part of the Zmod libraries pack.\\ ​
 +The library usage is similar for all Zmod libraries, and it is explained in the
 +[[reference:​zmod:​zmodbaselibraryuserguide#​library_usage|Library usage]]
 +chapter of Zmod Base Library user guide.
  
 +====== 4. Background Knowledge ======
 +===== 4.1. ZMODADC1410 IP Behaviour =====
 +Basically, the ZMODADC1410 IP (labeled ZMOD_ADC [[https://​reference.digilentinc.com/​reference/​zmod/​zmodadc/​zmodadc1410libraryuserguide#​overview|Library block diagram]] of the Overview section) directly interfaces with the [[https://​store.digilentinc.com/​zmod-adc-1410-syzygy-compatible-dual-channel-14-bit-analog-to-digital-converter-module/​|ZmodADC1410]] device performing an initial configuration and providing an easy to use interface that the upper level IPs or software can use to transfer data or configuration information to the device. It exposes to the PS a set of command and status registers that the ZmodADC1410 library functions use to control the IP. The ZMODADC1410 Library uses these registers to control the IP and read its status.\\ ​
 +Using these registers, the ADC acquisition can be configured, started or stopped. The ADC acquisition is composed of the following steps:
 +  * **ADC output data is captured and decoded**. The ZmodADC1410’s ADC multiplexes its 2 channels on one 14-bit wide double data rate (DDR) parallel interface. The ZmodADC1410 IP demultiplexes the input data channel and resynchronizes the received data with its internal clock. \\
 +The ZMODADC1410 IP supports two gain range settings: HIGH and LOW. The** HIGH input RANGE** of the ADC (-25 to +25 V) corresponds to a **LOW** gain selection in the library functions - using the //gain// parameter in the setGain() function of the zmodadc1410 library files, while the **LOW input RANGE** of the ADC (-1V to +1V)  corresponds to a **HIGH** setting value of the gain parameter inside the library mentioned above. \\
 +The raw data exported by the ZMODADC1410 should be further analyzed considering the gain parameter setting used for the acquisition.\\
  
 +For more details about the input ranges of the module, consult the [[https://​reference.digilentinc.com/​reference/​zmod/​zmodadc/​reference-manual#​scope_input_divider_and_gain_selection|ZMODADC1410 Reference Manual]]
 +  * **Sample data is calibrated by applying calibration coefficients**. The ZMODADC1410 IP applies calibration coefficients over the digital values received from Analog to Digital converter, in order to compensate the offset and gain errors introduced by the ADC associated circuitry. For this, the IP provides calibration registers where the calibration coefficients are set. The ZmodADC1410 Library initialization functions available in the library reads the raw values for the gain and offset calibration coefficients from the Zmod’s nonvolatile memory, processes them, and configures the calibration registers.
 +  * **The internal buffer is filled upon detecting a valid trigger condition**. The trigger module allows setting the trigger channel, trigger mode, trigger edge, trigger level and window position. The internal buffer has a maximum length of 2^14 - 1 samples and is 32 bits wide, accommodating both ZmodADC1410 channels. The internal buffer length must be set using the IP registers.
 +  * **Buffer data is transferred from the ZMODADC1410 IP internal buffer to system memory through a DMA engine**. The ZMODADC1410 IP reports when its internal buffer is full. While the internal buffer is full, no new acquisition is performed. The ZMODADC1410 Library initiates an AXIDMA-S2MM (AXIDMA receive) transfer, transferring data from the ZMODADC1410 IP internal buffer into a memory buffer allocated by ZMODADC1410 Library. The transferred length must be set using the ZmodADC1410 IP registers and the AXI DMA IP registers. The ZMODADC1410 IP can be configured to raise a Buffer Full interrupt, still this interrupt can only be handled by baremetal hardware platform.\\ ​
 +For more details on ZmodADC1410 IP interface consult the [[https://​github.com/​Digilent/​vivado-library/​blob/​feature/​zmod-support/​ip/​Zmods/​AXI_Zmod_ADC1410/​docs/​ZmodADC1410AxiAdapter.pdf|ZmodADC1410 IP User Guide]].\\ ​
 +Read more on [[#​parameters_set|Parameters]] chapter below for more details.
 +===== 4.2. Parameters Set=====
 +^ Term  ^ Meaning ​ ^
 +|channel ​  |ADC channels provided by ZmodADC1410:​\\ 0 - channel 1\\ 1 - channel 2 |
 +|trigger level   |The value specified by the trigger condition |
 +|trigger mode   |The value indicating the trigger mode:\\ 0 - normal\\ 1 - no trigger |
 +|trigger edge   |The value indicating the trigger edge:\\ 0 - rising\\ 1 - falling |
 +|internal buffer length ​  |The length of the ZmodADC1410 IP internal buffer.\\ Maximum value = 0x3FFE |
 +|transfer length ​  |The number of samples to be transferred over AXI DMA.\\ It has the same value as the internal buffer length. |
 +|window position ​  |The position in the buffer where trigger condition is met.\\ Maximum value = internal buffer length. |
 +|S2MM   ​|**S**tream to **M**emory **Ma**pped\\ The AXI DMA Receive mode |
 +|gain   |The gain setting, corresponding to a Low or High range of values\\ 0 - LOW Gain\\ 1 - HIGH gain |
 +|coupling ​  |The coupling for ZmodADC1410:​\\ 0 - DC Coupling\\ 1 - AC Coupling|
  
  
-====== 4. Project Settings ====== 
-The project settings are common to all Zmod libraries, and are explained in the [[reference:​zmod:​zmodbaselibraryuserguide#​project_settings|Project Settings]] chapter of Zmod Base Library user guide. 
  
  
----- 
  
 +
 +
 +
 +
 +
 + 
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +====== 5. ADC Demos ======
 +<WRAP GROUP> <WRAP COLUMN HALF>
 +  * Download the git repository containing the Demos using the below command:
 +
 +<​code>​git clone --recursive https://​github.com/​Digilent/​Eclypse-Z7-SW.git -b zmod_adc/​master</​code>​
 +
 +</​WRAP>​ <WRAP COLUMN HALF>
 +^ Download the ADC Demo files                                                                         ^
 +| @#​0000FF:​[[https://​github.com/​Digilent/​Eclypse-Z7-SW/​tree/​zmod_adc/​master|ZMODADC1410 Demo Files]] ​ |
 +
 +</​WRAP>​ </​WRAP> ​
 +===== 5.1 Linux Demo =====
 +
 +The ADC Linux demo performs (repeatedly) un-triggered acquisitions and writes the data to a file and to the standard output.\\ The file only contains the content of one acquisition,​ as it is overwritten.
 + ​Function called from main is //​adcDemo()//,​ with the following parameters:
 +  * channel - the channel where samples were acquired - default is channel 1
 +  * gain - the gain for the channel - default is high range
 +  * length - the buffer length to be used - default is set to 400h
 +
 +This function further calls the //​writeADCData()//​ function, which formats the data contained in the buffer and writes it to a file and to the standard output - SDK console.\\
 +The file is overwritten any time the function is called.
 +It displays the acquired value (in mV), raw value (as 14 bits hexadecimal value) and time stamp within the buffer (in time units) on the UART terminal.\\
 +Parameters transmitted from the user further to library functions:
 +   * filename - the file name to contain the acquisition formatted data
 +   * acqBuffer - the buffer containing acquired data
 +   * channel - the channel where samples were acquired
 +   * gain - the gain for the channel
 +   * length - the buffer length to be used
 +
 +The user is able to dynamically change the parameters values of //​adcDemo()//​ function in order to analyze the module capabilities or use it in further projects.
 +The application is contained in the generic workspace and is suggestively called ZmodADC1410_Demo_Linux.
 +The location and name of the file containing one buffer acquisition is found in the location: **/​home/​eclypse/​buffer_data.csv**
 +
 +==== 5.1.1 Functionality ====
 +Steps to run the Demo:
 +  - Install the demo and libraries files, as indicated in the [[https://​reference.digilentinc.com/​reference/​zmod/​zmodbaselibraryuserguide#​environment_setup|Environment Setup]] section of the Base Library User Guide.
 +  - Connect the required hardware to the host PC: Eclypse board, Zmod ADC1410, power supply and USB cable. We recommend using a waveforms/​signal generator of your choice, together with BNC - SMA adapters, to obtain the analog signal to be converted.
 +  - Load the Petalinux image on the SD card and plug it in the SD card slot on the Eclypse board.
 +  - Optionally, you can edit the uEnv.txt file on the SD card, prior to plug it in the Eclypse board SD slot: change the configuration to use from //​zmod=adc-dac//​ to **zmod=adc**,​ in order to use the git branch containing only the ADC Demo projects.
 +  - Connect the board to a Ethernet network using an Ethernet cable.
 +  - Boot the Petalinux using the UART terminal, as instructed in the [[https://​reference.digilentinc.com/​reference/​zmod/​zmodbaselibraryuserguide#​download_the_sd_card_image|SD card image download section]] of the Base Library User Guide.
 +  - Run the demo project from within SDK application. Follow the [[https://​reference.digilentinc.com/​reference/​zmod/​zmodbaselibraryuserguide#​add_vivado_sdk_workspace_location|3.2.1.1.3,​ 3.2.1.1.4 and 3.2.1.1.5 steps]] of the Base Library User Guide to setup the environment prior to run the project.
 +  - Use the waveform/​signal generator to send the ADC a signal to be converted: ex. DC signal of selected amplitude.
 +  - Visualize the data acquired in either SDK console or .csv file.
 +  - Further use and analyze the data received.
 +
 +
 +===== 5.2 Baremetal Demo =====
 +
 + The ADC Baremetal demo is in fact a simple ADC acquisition and test, performing a un-triggered acquisition. The demo also provides another function that is not called (testZMODADC1410Ramp_Auto) which puts the ADC in the test mode (ramp).\\ It also verifies the acquired data to be consistent with the conditions specified by the trigger settings.
 + ​Function called from main is //​adcDemo()//,​ with the following parameters:
 +  * channel - the channel where samples will be acquired - default is channel 1
 +  * gain - the gain for the channel - default is high range
 +  * length - the buffer length to be used - default is set to 400h
 +
 +This function further calls the //​formatADCDataOverUART()//​ function, which formats the data contained in the buffer and sends it over UART.\\
 +It displays the acquired value (in mV), raw value (as 14 bits hexadecimal value) and time stamp within the buffer (in time units) on the UART terminal.\\
 +Parameters transmitted from the user further to library functions:
 +   * padcZmod - pointer to the ZMODADC1410 class object
 +   * acqBuffer - the buffer containing acquired data
 +   * channel - the channel where samples were acquired
 +   * gain - the gain for the channel
 +   * length - the buffer length to be used
 +
 +The user could change the parameters values of //​adcDemo()//​ function in order to analyze the module capabilities or use it in further projects.
 +The application is contained in the generic workspace and is suggestively called ZmodADC1410_Demo_Baremetal
 +==== 5.2.1 Functionality ====
 +Steps to run the Demo:
 +  - Install the demo and libraries files, as indicated in the [[https://​reference.digilentinc.com/​reference/​zmod/​zmodbaselibraryuserguide#​environment_setup|Environment Setup]] section of the Base Library User Guide.
 +  - Connect the required hardware to the host PC: Eclypse board, Zmod ADC1410, power supply and USB cable. We recommend using a waveforms/​signal generator of your choice, together with BNC - SMA adapters, to obtain the analog signal to be converted.
 +  - Run the demo project from within SDK application.
 +  - Start the selected waveform/​signal generator and select a DC signal of certain set amplitude. ​
 +  - Open the PC UART terminal and visualize the data acquired: Sample value, Raw value and Time stamp.
 +  - Further use and analyze the data received.
 +
 +----