• 0
liwerfm

Input pins GPIO

Question

Hello,

I am trying to drive GPIO's 19 to 0, and trying to turn on the leds when a 3.3 voltage is applied in any of this pins, but it doesn't work

   

u32 btn, led;
    XGpio gpio;
    XGpio_Initialize(&gpio, 0);


    init_platform();

    XGpio_SetDataDirection(&gpio, 2, 0x0); //output leds

    XGpio_SetDataDirection(&gpio, 1, 0xFFFFFFFF); //input pins

    print("Start test\n\r");

    while(1){

        btn = XGpio_DiscreteRead(&gpio, 1);

        putnum(btn); print("\n\r");

        if (btn!=0) // turn all LEDs on when a 3.3 voltage is applied in any input pin
            led = 0xFFFFFFFF;

        else
            led = 0x00000000;

        XGpio_DiscreteWrite(&gpio, 2, led);


    }

The leds are always on and the terminal always print 3FFF

I am using Arty7-35t, Vivado 2016.4.

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

@liwerfm

Please provide your block design, either as screenshots of the design pane and customization GUI for the AXI GPIO controller, or by attaching the TCL script created when you select File>Export>Export Block Design in the top tool bar of Vivado.

Thanks,

Arthur

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