User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 756
UG585 (v1.11) September 27, 2016
Chapter 30: XADC Interface
1. Reset the serial communication channel. Write a 1 and then a 0 to devcfg.XADCIF_MCTL
[RESET].
2. Reset the XADC. Write any 16-bit value to DRP address 0x03 (reset register). Write 08030000h
to the devcfg.XADCIF_CMDFIFO register.
3. Flush the FIFOs. There is no reset signal, instead write 15 NOOPs to the FIFO:
a. Wait for the Command FIFO to empty. The last command should be a NOOP (dummy write).
b. Read the Read Data FIFO until empty.
Example: Start-up Sequence via the PS-XADC Interface
This example sets various interface parameters and includes steps for interrupts and data transfers. It
assumes the interface and the XADC are already initialized.
1. Configure the PS-XADC interface: Program the configuration register. Write 80001114h into
the devcfg.XADCIF_CFG register:
a. Use default Minimum idle gap, [IGAP] = 14h (20 serial clocks).
b. Use default XADC serial clock frequency to 1/4 of PCAP_2x clock frequency, [TCKRATE] = 01.
c. Use default FIFO serial read capture edge (rising), [REDGE] = 1.
d. Use default FIFO serial write launch edge (falling), [WEDGE] = 0.
e. Use default Read Data FIFO threshold level, [DFIFOTH] = 0x0.
f. Use default Command FIFO threshold level, [CFIFOTH] = 0.
g. Enable the PS access of XADC. Write 0x1 to devcfg.XADCIF_CFG [ENABLE].
2. Configure the interrupts: Interrupts are used to manage the alarms from the XADC and
Command/Read Data FIFOs. Refer to the program example in section 30.5.3 Interrupts.
3. Data transfers to the XADC: Refer to section 30.5.2 Read and Write FIFOs.
30.4.1 Read and Write to the FIFOs
This example configures the devcfg.XADCIF_CFG register for the FIFOs and communications channel.
This register controls the command and Read Data FIFO thresholds, the clock rate of the
XADC_PS_TCK, the clocking edges for the serial bus and the idle gap between serial packets.
After power on Command and Read Data FIFOs of the PS-XADC interface are empty, but must be
flushed after an XADC interface reset. Commands for writing to or reading from XADC registers are
sent to the XADC using the Command FIFO, and data returned from the XADC is collected in the Read
Data FIFO.
Example: Write Command to the XADC
This example writes to the XADC V
CCPAUX
Alarm Upper threshold register.
1. Prepare command. Prepare the command as described in section 30.4.3 Command Preparation
for writing to the XADC V
CCPAUX
Alarm Upper threshold register (0x5A) with required threshold.
2. Fill the Command FIFO with data. Write the data formatted in step 1 to the
devcfg.XADCIF_CMDFIFO register.