WIZnet Developer Forum

W5500 wizchip_getinterrupt() return 0xfff0

Hello to all
I enabled socket 2 interrupt, but in ISR the wizchip_getinterrupt () function returns 0xfff0.
I have enabled the interrupt using the following commands:

setIR(0xf0); //clear IR register
setSIR(0xff); //clear SIR register
setIMR(0); //Disable all INTERRUPTS
setSIMR(0); //Disable all socket INTERRUPTS

wizchip_setinterruptmask(IK_SOCK_2 ); // enable socket 2 interrupt
setSn_IMR(CLIENT_SOCKET,Sn_IR_CON); // enable socket 2 Sn_IR_CON interrupt

and my ISR is :

  uint16_t int_src ;
  uint8_t sn_int_src = 0;
  void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
  {

	if(HAL_GPIO_ReadPin(WIZ_INT_GPIO_Port , WIZ_INT_Pin) == GPIO_PIN_RESET){
		int_src = wizchip_getinterrupt();
		if(int_src == IK_SOCK_2){
			sn_int_src = getSn_IR(CLIENT_SOCKET) & Sn_IR_CON;
			if(sn_int_src == Sn_IR_CON ){
				setSn_IR(CLIENT_SOCKET, Sn_IR_CON);
			}
			wizchip_clrinterrupt(IK_SOCK_2);
		}	
		setIR(0xf0);
		setSIR(0xff);
	}	
}

But the variable int_src most of the time has the value 0xfff0. Sometimes it’s 0x0400 and it works fine, but most of the time it’s 0xfff0 which is wrong.

As far as I know, code that you use can’t use in EXTI callback function.
Only GPIO control operations or flags are allowed inside the EXTI callback function.
Please check again by changing the code.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.