liwerfm Posted March 8, 2018 Share Posted March 8, 2018 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. Link to comment Share on other sites More sharing options...
artvvb Posted March 8, 2018 Share Posted March 8, 2018 @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 Link to comment Share on other sites More sharing options...
Question
liwerfm
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.
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.