Jump to content

Cecilia

Members
  • Posts

    1
  • Joined

  • Last visited

Cecilia's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I have a zybo z7. I did a simple Vivado tutorial, getting the leds to blink when you push a button. Hours of debugging. Evetything checked out, but lights didn't come on. Just to see what would happen, I tried putting the code on the second core in Vitis, as opposed to the first. It works! Is there some reason it won't work on the first core? Followed instructions of tutorial exactly. Here's the code. #include "xparameters.h" #include "xil_printf.h" #include "xgpio.h" #include "xil_types.h" // Get device IDs from xparameters.h #define BTN_ID XPAR_AXI_GPIO_BUTTONS_DEVICE_ID #define LED_ID XPAR_AXI_GPIO_LED_DEVICE_ID #define BTN_CHANNEL 1 #define LED_CHANNEL 1 #define BTN_MASK 0b1111 #define LED_MASK 0b1111 int main() { XGpio_Config *cfg_ptr; XGpio led_device, btn_device; u32 data; xil_printf("Entered function main\r\n"); // Initialize LED Device cfg_ptr = XGpio_LookupConfig(LED_ID); XGpio_CfgInitialize(&led_device, cfg_ptr, cfg_ptr->BaseAddress); // Initialize Button Device cfg_ptr = XGpio_LookupConfig(BTN_ID); XGpio_CfgInitialize(&btn_device, cfg_ptr, cfg_ptr->BaseAddress); XGpio_SetDataDirection(&btn_device, BTN_CHANNEL, BTN_MASK); XGpio_SetDataDirection(&led_device, LED_CHANNEL, 0); while (1) { data = XGpio_DiscreteRead(&btn_device, BTN_CHANNEL); data &= BTN_MASK; if (data != 0) { data = LED_MASK; } else { data = 0; } XGpio_DiscreteWrite(&led_device, LED_CHANNEL, data); } }
×
×
  • Create New...