<jupyter_start><jupyter_text>Core temperature and VCCAUX measurements ---  Aim* This notebook illustrates how to measure FPGA Core temperature and VCCAUX using the System Management IP (XADC) Revision History* Initial Release---  Load _base_ Overlay<jupyter_code>from time import sleep
from pynq.overlays.base import BaseOverlay

base = BaseOverlay('base.bit')<jupyter_output><empty_output><jupyter_text>Instantiate the System Management object<jupyter_code>xadc=base.system_management_wiz_0.mmio<jupyter_output><empty_output><jupyter_text>Define registers offset Since there are number of registers required to measure the Core temperature and VCCAUX (1.8V), define them first.<jupyter_code># define registers offset, masks related to the System Management IP
XSM_SRR_OFFSET=0
XSM_SR_OFFSET=4
XSM_IP_OFFSET=0x200

XSM_TEMP_OFFSET=XSM_IP_OFFSET+0x200
XSM_VCCINT_OFFSET=XSM_IP_OFFSET + 0x204
XSM_VCCAUX_OFFSET=XSM_IP_OFFSET + 0x208

XSM_AUX14_OFFSET=XSM_IP_OFFSET + 0x278
XSM_AUX15_OFFSET=XSM_IP_OFFSET + 0x27C

XSM_CFR0_OFFSET=XSM_IP_OFFSET + 0x300
XSM_CFR1_OFFSET=XSM_IP_OFFSET + 0x304
XSM_CFR2_OFFSET=XSM_IP_OFFSET + 0x308
XSM_SEQ00_OFFSET=XSM_IP_OFFSET + 0x320
XSM_SEQ01_OFFSET=XSM_IP_OFFSET + 0x324
XSM_SEQ02_OFFSET=XSM_IP_OFFSET + 0x328
XSM_SEQ03_OFFSET=XSM_IP_OFFSET + 0x32C
XSM_SEQ04_OFFSET=XSM_IP_OFFSET + 0x330
XSM_SEQ05_OFFSET=XSM_IP_OFFSET + 0x334
XSM_SEQ07_OFFSET=XSM_IP_OFFSET + 0x33c

XSM_CFR0_AVG_VALID_MASK=0x3000
XSM_CFR0_AVG16_MASK=0x1000
XSM_CFR1_SEQ_VALID_MASK=0xF000
XSM_CFR1_SEQ_SAFEMODE_MASK=0x0000
XSM_CFR1_SEQ_CONTINPASS_MASK=0x2000
XSM_SRR_IPRST_MASK=0x0000000A
XSM_SR_EOS_MASK=0x00000040

XSM_SEQ_CH_TEMP=0x100
XSM_SEQ_CH_VCCAUX=0x400
XSM_SEQ_CH_AUX00=0x00010000
XSM_SEQ_CH_AUX14=0x40000000
XSM_SEQ_CH_AUX15=0x80000000
XSM_SEQ_CH_AUX_SHIFT=16
XSM_CFR2_CD_SHIFT=8<jupyter_output><empty_output><jupyter_text>Perform measurements and display results Reset the IP and configure to measure the Core temperature and VCCAUX voltage.<jupyter_code># Reset the IP
xadc.write(XSM_SRR_OFFSET,XSM_SRR_IPRST_MASK)
# disable channel sequencer before configuring the sequence register
regvalue=xadc.read(XSM_CFR1_OFFSET)
xadc.write(XSM_CFR0_OFFSET, (regvalue & ~XSM_CFR1_SEQ_VALID_MASK | XSM_CFR1_SEQ_SAFEMODE_MASK))<jupyter_output><empty_output><jupyter_text>Measure every 2 seconds for five times and display the result.<jupyter_code># Read the current value of the on-chip temperature and VCCAUX voltage
for i in range(5):
    print("Core temperature: "+"{:.2f}".format(((xadc.read(XSM_TEMP_OFFSET))/65536)/0.00199451786-273.67)," C")
    print("VCCAUX voltage: "+"{:.2f}".format((xadc.read(XSM_VCCAUX_OFFSET))*3.0/65536)," V")
    sleep(2)<jupyter_output>Core temperature: 33.65  C
VCCAUX voltage: 1.80  V
Core temperature: 33.98  C
VCCAUX voltage: 1.80  V
Core temperature: 31.99  C
VCCAUX voltage: 1.80  V
Core temperature: 33.17  C
VCCAUX voltage: 1.80  V
Core temperature: 33.34  C
VCCAUX voltage: 1.80  V
{'fraction_non_alphanumeric': 0.07489740082079344, 'fraction_numerical': 0.08652530779753762, 'mean_word_length': 8.227129337539433, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '287899', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1201, 'n_words': 226, 'path': 'Pynq-ZU/base/notebooks/utils/core_temperature_and_VCCAUX_measurement.ipynb', 'repo_name': 'Xilinx/PYNQ-ZU', 'size': '2924'}