IRQ interrupt and vTaskDelay

guys this might be obvious, but I am new to freertos :frowning:

Basically I have initialized IRQ interrupt in zynq with the following code

/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
/* Xilinx includes. */
#include "xparameters.h"
#include <stdio.h>
#include "xscugic.h"
/*Interrupt*/
#define INTC_INTERRUPT_ID  61  // IRQ [0]
#define INTC_INTERRUPT_ID2  62  // IRQ [1]

int SetupInterruptSystem()  {
        int result;
        XScuGic *IntcInstancePtr = &Intc;

    XScuGic_Config *IntcConfig;

    IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID);
    if (IntcConfig == NULL)    {
        return XST_FAILURE;
    }
    result = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,    IntcConfig->CpuBaseAddress);
    if (result != XST_SUCCESS)    {
        return XST_FAILURE;
    }
    /* Connect the interrupt handler */
    result = XScuGic_Connect(IntcInstancePtr, INTC_INTERRUPT_ID, (Xil_ExceptionHandler) PIsr1, 0);
    if (result != XST_SUCCESS)    {
        return result;
    }
    result = XScuGic_Connect(IntcInstancePtr, INTC_INTERRUPT_ID2, (Xil_ExceptionHandler) PIsr2, 0);
	if (result != XST_SUCCESS)    {
		return result;
	}
    /* Enable the interrupt for the controller device. */
    XScuGic_Enable(IntcInstancePtr, INTC_INTERRUPT_ID);
    XScuGic_Enable(IntcInstancePtr, INTC_INTERRUPT_ID2);

    Xil_ExceptionInit();
    Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
        (Xil_ExceptionHandler)XScuGic_InterruptHandler, IntcInstancePtr);

    Xil_ExceptionEnable();    /* Enable non-critical exceptions */

    vTaskDelete(handleIntInit);
    return XST_SUCCESS;

} 

Right after initialization of the interrupt, the vTaskDelay stops working, but why? and how to make it run again after the running the initialization?

ok I managed to make it work, so ill reply to myself if somebody with similar problem would struggle with it.

Basically I have managed to find someone’s else code

/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
/* Xilinx includes. */
#include "xparameters.h"
#include <stdio.h>
#include "xscugic.h"
/*Interrupt*/
#define INTC_INTERRUPT_ID  61  // IRQ [0]
#define INTC_INTERRUPT_ID2  62  // IRQ [1]

XScuGic xInterruptController; ///Global variable

void SetupInterruptSystem()
{
	BaseType_t xStatus;
	XScuGic_Config *pxGICConfig;

	pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );

	/* Sanity check the FreeRTOSConfig.h settings are correct for the
	hardware. */
	configASSERT( pxGICConfig );
	configASSERT( pxGICConfig->CpuBaseAddress == ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) );
	configASSERT( pxGICConfig->DistBaseAddress == configINTERRUPT_CONTROLLER_BASE_ADDRESS );

	/* Install a default handler for each GIC interrupt. */
	xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );
	configASSERT( xStatus == XST_SUCCESS );
	( void ) xStatus;

	XScuGic_Connect(&xInterruptController, INTC_INTERRUPT_ID, (Xil_ExceptionHandler) PIsr1, 0);
	XScuGic_Connect(&xInterruptController, INTC_INTERRUPT_ID2, (Xil_ExceptionHandler) PIsr2, 0);
	XScuGic_Enable(&xInterruptController, INTC_INTERRUPT_ID);
	XScuGic_Enable(&xInterruptController, INTC_INTERRUPT_ID2);

	Xil_ExceptionInit();
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
	        (Xil_ExceptionHandler)XScuGic_InterruptHandler, &xInterruptController);

	Xil_ExceptionEnable();
}

So the obvious problem is that I was running it as a task, and when you run the initialization as a task then the delay stops working; additionally, the big issue is that XScuGic xInterruptController is declared as global variable if it is declared as local variable which I did before the initialization does not work when it is called as a function before the vTaskStartScheduler().

Its been awhile since I have worked on the Zynq port, but I seem to remember one issue is that you must be sure not to reinialize the interrupt controller after you have already started to configure it, or it forgets all of the previous configuration.