• 0
Bui Cuong

---XADC— Value of external voltage doesnt change on Tera Term VT?

Question

now I configure XADC on Zynq-702 Evaluation Board to measure voltage (0->1 V) on VP_VN, Vaux_8 and Vaux0.

The problem is: When I see the value on Tera Term VT, the values of VP_VN, Vaux_8, and Vaux0 don't change when changing the external voltage value. They only change when I reset the system or  when I start Programing HW(.bit) and Launching SW (.elf) into Kit again

Spoiler

 

. Any suggestion for me?

This is my HW: 

47GKx.jpg

XaJub.jpg

B41pF.jpg

This is my SW (SDK):

#include <stdio.h>
#include "platform.h"
#include "xadcps.h"
#include "xil_types.h"
#include "sleep.h"
#define XPAR_AXI_XADC_0_DEVICE_ID 0
#define XAdcPs_RawToExtVoltage(AdcData) ((((float)(AdcData))* (1.0f))/65536.0f)

static XAdcPs XADCMonInst;

int main()
{

    XAdcPs_Config *ConfigPtr;
    XAdcPs *XADCInstPtr = &XADCMonInst;
    int Status_ADC;
    // VP_VN
    u32  VP_VNRaw;
    float VP_VNData;

    // Vaux 0
    u32 Vaux_0Raw;
    float Vaux_0Data;

    // Vaux 8
    u32 Vaux_8Raw;
    float Vaux_8Data;

    // Vref P
    u32 VrefPRaw;
    float VrefPData;

    init_platform();
    printf("Man and Device \n ");

    // XADC initial
    ConfigPtr = XAdcPs_LookupConfig(XPAR_AXI_XADC_0_DEVICE_ID);
    if (ConfigPtr == NULL ){
        return XST_FAILURE;
    }

    Status_ADC = XAdcPs_CfgInitialize(XADCInstPtr,ConfigPtr,ConfigPtr->BaseAddress);

    if ( XST_SUCCESS != Status_ADC ){
        printf("XADC failed initial");
        return XST_FAILURE;
    }
    // self test XADC
    Status_ADC  = XAdcPs_SelfTest(XADCInstPtr);
    if (XST_SUCCESS != Status_ADC){
        printf("XADC failed self test");
        return XST_FAILURE;
    }
    XAdcPs_SetSequencerMode(XADCInstPtr,XADCPS_SEQ_MODE_SAFE);
    XAdcPs_SetSeqChEnables(XADCInstPtr,XADCPS_CH_VPVN|XADCPS_CH_AUX_MIN|XADCPS_CH_AUX_08|XADCPS_CH_VREFP);
    XAdcPs_SetSeqInputMode(XADCInstPtr,XADCPS_CH_VPVN|XADCPS_CH_AUX_MIN|XADCPS_CH_AUX_08);
    XAdcPs_SetAvg(XADCInstPtr,XADCPS_AVG_64_SAMPLES);
    XAdcPs_SetSequencerMode(XADCInstPtr,XADCPS_SEQ_MODE_CONTINPASS);

    while(1){

        // VP_VN
        VP_VNRaw = XAdcPs_GetAdcData(&XADCMonInst,XADCPS_CH_VPVN);
        VP_VNData = XAdcPs_RawToExtVoltage(VP_VNRaw);
        printf("Raw VP_VN %lu   Data VP_VN %f \n\r", VP_VNRaw, VP_VNData);

        // Vaux0
        Vaux_0Raw = XAdcPs_GetAdcData(&XADCMonInst,XADCPS_CH_AUX_MIN);
        Vaux_0Data = XAdcPs_RawToExtVoltage(Vaux_0Raw);
        usleep(1);
        printf("Vaux_0Raw %lu   Vaux_0Data %f \n\r", Vaux_0Raw, Vaux_0Data);

        //Vaux 8
        Vaux_8Raw = XAdcPs_GetAdcData(&XADCMonInst,XADCPS_CH_AUX_08);
        Vaux_8Data = XAdcPs_RawToExtVoltage(Vaux_8Raw);
        printf("Vaux_8Raw %lu   Vaux_8Data %f \n\r", Vaux_8Raw, Vaux_8Data);

        //VrefP
        VrefPRaw = XAdcPs_GetAdcData(&XADCMonInst,XADCPS_CH_VREFP);
        VrefPData = XAdcPs_RawToVoltage(VrefPRaw);
        printf("VrefPRaw %lu    VrefPRaw %f \n\r", VrefPRaw, VrefPData);
        printf("\n");
        printf("\n");
        // delay function
        usleep(500000); // delay 5ms

    }
    return 0;
}

This is my Tera Term VT (to see external voltage :    ) They dont change value when changing external voltage on VP_VN, Vaux_8, and Vaux0 .
7waSL.jpg

Edited by Bui Cuong

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @Bui Cuong,

Please deactivate the XAdcPs_SetAvg(XADCInstPtr,XADCPS_AVG_64_SAMPLES); function, and see if your issue still persist. If yes, please let me know and I will try to replicate your entire setup. Unfortunately I don't have the Zynq-702 Evaluation Board, so I will try your setup with a different Zinq Board, and see if i encounter the same problem. Until then, because your evaluation board it's a Xilinx one, please put the same question on their forum. There are big chances to find in there people that are more familiar with this board than me. I look forward to hearing from you. 

Best Regards,

Bogdan Vanca   

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now