Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - InterruptAttach(): Page 1 of 5 (5 Items)
   
InterruptAttach()  
Hi All,
I have been developing a GPIO driver in QNX Neutrino 6.6 for IMX6Q processor
I am currently using the Saberlite BD_SL_IMX6 kit for the development and testing
Problem: Currently i am facing problem in writing an interrupt handler for the 
driver using the interrupt attach function. 
i am doing the following
defined a global variable
//I have put a global variable defined as a volatile integer type and have set it a value 5 and 
updated the variable in interrupt handler.
volatile uint32_t myVar ;

const struct sigevent *inthandler(void *area, int size)
{
//In the interrupt handler function if i return NULL the board is hanging and getting disconnected.
//If i remove the return NULL from the interrupt handler board is not hanging or disconnected.
   myVar+=myVar;
}
main()
{
//I have mapped the device io memory after a threadctl
   ThreadCtl()
   mmap_device_io()
   //configuring the MUX as GPIO
   //Then i have a function with the configuration of GPIO4_PIN5 as a GPIO and configuring 
it as an input DIR pin.Then i have configured the InterruptConfigurationRegister1 of the GPIO4 base address for 
the interrupt.I have done the masking for the GPIO4_PIN5 in the IMR.

   //GPIO configuring as input   
   //Configured the InterruptConfigurationRegister1 for pin 5 
   //Configured the InterruptMaskRegister for pin 5    
   //I am using the interruptattach function to attach the interrupt with the handler.
   //I have attached the interrupt line 104 for the getting interrupt for GPIO4 (signals 0-15).
   interruptret=InterruptAttach(104,inthandler,&dev,0,_NTO_INTR_FLAGS_PROCESS);
	 	if(interruptret==-1)
	 	{
	 	 printf("Interrupt Attach Error %d\n",interruptret);	 	 
	 	}
		while(1)
		{
		  //printing the status register value
		  //gloabal variable checking for update          		 
          //break if value of the global varible is > 100		  
		}
}

if i just return NULL from the ISR the processor hangs and disconnects but when i remove return the hanging problem is 
solved but i am not getting any interrupt as the variable update in the ISR is not happening but the status register 
keeps updating when i just poll the interrupt status register.
Please suggest if anybody could get something why this problem has occured.