cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
soccerno16
Visitor
Visitor
577 Views
Registered: ‎03-22-2018

Troubleshoot PS to PL interrupts

Pulling my hair out. I've been trying all manner of PL to PS examples and must be missing something.  The most recent is an example form ZynqBook.com

http://bertrand.granado.free.fr/FPGA2/FPGA_2/FPGA2_-_Documentation_files/The_Zynq_Book_Tutorials.pdf

 

I've modified the code slightly to verify that the GPIO is working using xil_printf(), but I cannot get an interrupt to register.  I've attached the bitstream and full source.  I am beginning to think my Zybo has a defect.  Please help.

 

blockdiagram.png

 

//----------------------------------------------------
// MAIN FUNCTION
//----------------------------------------------------
int main (void)
{
	xil_printf("Starting main.\r\n");
  int status;
  //----------------------------------------------------
  // INITIALIZE THE PERIPHERALS & SET DIRECTIONS OF GPIO
  //----------------------------------------------------
  // Initialise LEDs
  status = XGpio_Initialize(&LEDInst, LEDS_DEVICE_ID);
  if(status != XST_SUCCESS) return XST_FAILURE;
  // Initialise Push Buttons
  status = XGpio_Initialize(&BTNInst, BTNS_DEVICE_ID);
  if(status != XST_SUCCESS) return XST_FAILURE;
  // Set LEDs direction to outputs
  XGpio_SetDataDirection(&LEDInst, 1, 0x00);
  // Set all buttons direction to inputs
  XGpio_SetDataDirection(&BTNInst, 1, 0xFF);

  // Initialize interrupt controller
  status = IntcInitFunction(INTC_DEVICE_ID, &BTNInst);
  if(status != XST_SUCCESS) return XST_FAILURE;



  u32 led_value, btn_value;
  while(1)
  {
	  led_value = XGpio_DiscreteRead(&LEDInst, 1);
	  btn_value = XGpio_DiscreteRead(&BTNInst, 1);

	  XGpio_DiscreteWrite(&LEDInst,1, (0x0008 | led_value));
	  usleep(1000000);
	  led_value = XGpio_DiscreteRead(&LEDInst, 1);
	  XGpio_DiscreteWrite(&LEDInst,1,(led_value & 0xFFF7));
	  usleep(1000000);
	  xil_printf("btn vale %x\r\n", btn_value);

  }

  return 0;
}

Pushing buttons changes my output but no interrupts?!?!?

zynq_inter.png

 

 

 

0 Kudos
1 Reply
soccerno16
Visitor
Visitor
528 Views
Registered: ‎03-22-2018

So my interrupts started working after changing the GPIO form the board presets to manually configuring them.  Can anyone explain why?

 

blockdiagram.png

0 Kudos