---
title: "W5500 wizchip_getinterrupt() return 0xfff0"
url: "https://maker.wiznet.io/forum/14233"
markdown_url: "https://maker.wiznet.io/forum/14233/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "mrnxp"
created: "2021-05-01T14:28:03+09:00"
last_activity: "2021-05-11T23:08:46+09:00"
language: "en"
views: 481
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W5500 wizchip_getinterrupt() return 0xfff0

## Question

Asked by mrnxp on 2021-05-01 in Ethernet Chips.

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.

## Replies

### Reply 1 by irina, 2021-05-11

![](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/48.png) mrnxp:

> ```
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);
```

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.

---

Source: https://maker.wiznet.io/forum/14233
