Adam Taylor MicroZed Chronicles: XADC
Adam Taylor has multiple tutorials in his MicroZed Chronicles on the XADC. This post relates to issue 7 and 8. These can be found using the link at the bottom of the page.
What I learned from Adam's Tutorials:
To add the XADC to the Block Diagram
Add the Zynq Processing System and the XADC Wizard then run the block automation and the connection automation. It should look similar to the picture below:
Then continue like you would normally
Validate Design > Create HDL Wrapper > Generate Bitstream > Export Hardware > Launch SDK
Once you are in SDK you need to create a new BSP
File > New > Board Support Package > Finish
Next you need to create a new application program and for this one we will just be using Hello World because it provides us with a file platform.h that we will need. File > New > Application Project > Finish
You then want to copy and past in the file that is at the bottom of issue 8 and use it to replace HellowWorld.c in SDK and SAVE.
Next launch minicom > program the fpga > Run
You should see something similar to the picture below for the output:
The program is reading the Zynq SoC's internal temperature and voltage parameters.
Temp: Internal Temperature
VCCInt: The Internal PL Core Voltage
VCCAux: The Auxiliary PL Voltage
VCCBram: PL BRAM Voltage
VCCPInt: PS Internal Core Voltage
VCCPAux: PS Auxiliary Voltage
VCCDDr: Operating Voltage of DDR RAM Connected to the PS
To convert the temperature from the raw value to the real value this equation is used:
To convert the voltages from the raw value to the real value this equation is used:
From what I understand, 65536 comes from having 16 bits, which in binary has a max of 1111111111111111 which equals 65535 in decimal and then you add one to include 0.
273.15 is used to convert from kelvin to Celsius and the decimal comes from the conversion (look up or given)
3 corresponds to the max voltage (we think)
Looking into the Code:
The Pointer: XAdcPs_Config
The configuration (device ID and base address of the XADC being initialized) will be stored in the pointer.
To use the information stored within the configuration we need a pointer of type XAdcPs.
Configuration Pointer: ConfigPtr
Installation Pointer: XADCInstPtr
Taylor also uses:
He uses "XAdcPs_RawToTemperature()" and "XAdcPs_RawToVoltage()" -- to convert the raw XADC values into their real-world temperature or voltage equivalents.
http://zedboard.org/content/microzed-chronicles
What I learned from Adam's Tutorials:
- The Zynq SoC's XADC block contains two 12-bit ADC inputs with additional input channels connected to on-chip voltages and temp sensors.
- The XADC is capable of unipolar (only + or only -) or bipolar (both + and - range) measurements.
- Each analog input is differential. The 17 differential inputs are split between one dedicated analog input pair (VP/VN) and 16 auxiliary inputs that can be configured as either analog or digital I/O pins (VAuxP/VAuxN).
- The effective input signal band width depends on which input is being utilized
- VP/VN = 500kHz
- Axiliary = < 251kHz
To add the XADC to the Block Diagram
Add the Zynq Processing System and the XADC Wizard then run the block automation and the connection automation. It should look similar to the picture below:
Then continue like you would normally
Validate Design > Create HDL Wrapper > Generate Bitstream > Export Hardware > Launch SDK
Once you are in SDK you need to create a new BSP
File > New > Board Support Package > Finish
Next you need to create a new application program and for this one we will just be using Hello World because it provides us with a file platform.h that we will need. File > New > Application Project > Finish
You then want to copy and past in the file that is at the bottom of issue 8 and use it to replace HellowWorld.c in SDK and SAVE.
Next launch minicom > program the fpga > Run
You should see something similar to the picture below for the output:
The program is reading the Zynq SoC's internal temperature and voltage parameters.
Temp: Internal Temperature
VCCInt: The Internal PL Core Voltage
VCCAux: The Auxiliary PL Voltage
VCCBram: PL BRAM Voltage
VCCPInt: PS Internal Core Voltage
VCCPAux: PS Auxiliary Voltage
VCCDDr: Operating Voltage of DDR RAM Connected to the PS
To convert the temperature from the raw value to the real value this equation is used:
To convert the voltages from the raw value to the real value this equation is used:
273.15 is used to convert from kelvin to Celsius and the decimal comes from the conversion (look up or given)
3 corresponds to the max voltage (we think)
Looking into the Code:
The Pointer: XAdcPs_Config
The configuration (device ID and base address of the XADC being initialized) will be stored in the pointer.
To use the information stored within the configuration we need a pointer of type XAdcPs.
Configuration Pointer: ConfigPtr
Installation Pointer: XADCInstPtr
Taylor also uses:
- The "XAdcPs_SelfTest()" function to perform a self-test to check that there are no issues with the device.
- "XAdcPs_SetSequencerMode()" to stop the sequencer from performing its current operation by setting it to a single channel.
- "XAdcPs_SetAlarmEnables()" to disable any alarms that may be set.
- "XAdcPs_SetSeqInputMode()" to restart the sequencer with the desired sequence.
- "XAdcPs_SetSeqChEnables()" to configure the enables for the channels I wished to sample.
He uses "XAdcPs_RawToTemperature()" and "XAdcPs_RawToVoltage()" -- to convert the raw XADC values into their real-world temperature or voltage equivalents.
http://zedboard.org/content/microzed-chronicles
Comments
Post a Comment