---
title: "W5500 Interrupt not triggering"
url: "https://maker.wiznet.io/forum/15229"
markdown_url: "https://maker.wiznet.io/forum/15229/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Adel Sehic"
created: "2024-05-27T12:20:41+09:00"
last_activity: "2024-05-27T17:07:50+09:00"
language: "en"
views: 90
replies: 5
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W5500 Interrupt not triggering

## Question

Asked by Adel Sehic on 2024-05-27 in Ethernet Chips.

Hi,

I’m working with W5500 for a college project and I’ve run into a bit of a concrete wall.
I’ve crafted my own TCP/IP server for connecting with STM32F407G-DISC1 over LAN using W5500 chip and serving data to a central interface. Issue I’m currently having is that my HW Interrupt generated by W5500 chip is not being triggered. Here is the relevant code:

```
uint8_t ETH_SocketInit(uint8_t *sck) {
	int8_t ret;
	if ((ret = socket(*sck, Sn_MR_TCP, 5000, SF_TCP_NODELAY)) != 0) {
		return -1;
	}
	setSn_IR(*sck, 0x1f); // clearing all interrupts on chip
	setSn_IMR(*sck, 0x04); // setting the socket mask to RECV
	sprintf(msgbuf, "Socket initialized!\r\n");
	HAL_UART_Transmit(&huart6, (uint8_t*) msgbuf, strlen(msgbuf), 100);
	return 0;
}
```

INT pin is connected to PB0 pin on my board which is in EXTI trigger on falling edge and no pull up/down configuration (although I’ve tested with both to no avail). EXTI0 line is enabled and the interrupt callback gets triggered properly once I physically unplug the connector and it goes from high to low state.

```
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
    UART_Message("HEY IT WORKS\r\n");
    ETH_Listen(&sck, ethbuf);
}

int8_t ETH_Listen(uint8_t *sck, char* buf){
	int RSR_Len = 0, repeat = 500;
	while(!RSR_Len && repeat){
		RSR_Len = getSn_RX_RSR(*sck);
	}
	if(!repeat){
		return 0;
	} else {
		return recv(*sck, buf, RSR_Len);
		setSn_IR(*sck, 0x1f);
	}
}
```

My server writes “ping\r\n” to the connection every 2 seconds and the data goes through to the chip, but the INT line is not being triggered.

*note : I am aware that interrupt callback should only be setting a flag, this is just for development and will be done properly*

## Replies

### Reply 1 by Eugeny, 2024-05-27

Format code properly because it is wrongly displayed.

### Reply 2 by Adel Sehic, 2024-05-27 (in reply to reply 1)

Formatted

### Reply 3 by Eugeny, 2024-05-27

Thanks. What is about setting SIMR register appropriately?

### Reply 4 by Adel Sehic, 2024-05-27

It is set using `setSn_IMR(socket, 0x04)` inside ETH_SocketInit function. 0x04 translates to 0000100 mask, which is to correct mask to only get RECV interrupt.

EDIT:

Forgive me, I did not read the documentation carefully enough and did not realize that SIMR is a separate register. I’ve modified the function to be

```
uint8_t ETH_SocketInit(uint8_t *sck) {
	int8_t ret;
	if ((ret = socket(*sck, Sn_MR_TCP, 5000, SF_TCP_NODELAY)) != 0) {
		return -1;
	}
	setSn_IR(*sck, 0x1f);
	setSn_IMR(*sck, 0x04);
	setSIMR(*sck);
	sprintf(msgbuf, "Socket initialized!\r\n");
	HAL_UART_Transmit(&huart6, (uint8_t*) msgbuf, strlen(msgbuf), 100);
	return 0;
}
```

but no interrupt is still occurring. Have I misunderstood the function?

### Reply 5 by Adel Sehic, 2024-05-27

Forgive my brain malfunction, yes - setting the correct mask for SIMR (and not sending the socket number which is 0 which disables the entire register) was the solution, interrupt works properly.

Many thanks!

---

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