---
title: "INTn pin always high"
url: "https://maker.wiznet.io/forum/14276"
markdown_url: "https://maker.wiznet.io/forum/14276/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "murseloguzandic"
created: "2021-06-24T12:20:05+09:00"
last_activity: "2021-06-29T05:59:24+09:00"
language: "en"
views: 615
replies: 6
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# INTn pin always high

## Question

Asked by murseloguzandic on 2021-06-24 in Ethernet Chips.

Hello,

I’m trying to get falling edge interrupt for per UDP receive message. Here my init codes but it didn’t work, INTn pin always high.

```
	reg_wizchip_spi_cbfunc(readByte, writeByte);
	reg_wizchip_cs_cbfunc(csSelect, csDeselect);

	wizchip_init(w5500.spiBuffer, w5500.spiBuffer);
	wizchip_setnetinfo(&w5500);
	setINTLEVEL(100);
	setSIMR(0x01);
	setSn_IMR(w5500.socketNumber, 0x04);

	w5500.result = socket(w5500.socketNumber, Sn_MR_UDP, w5500.localPort, 0); //
```

## Replies

### Reply 1 by becky, 2021-06-28

According to the code above, it is normal for an interrupt to occur.
First I want you to check if udp data receive is done.
Also, I wonder how the interrupt row is checked.

### Reply 2 by murseloguzandic, 2021-06-28 (in reply to reply 1)

Hello, here mine RX code part

```
void w5500RX() {

	if (wizphy_getphylink() > 0) { //Check Ethernet cable up or down

		switch (getSn_SR(w5500.socketNumber)) { //Get status of selected socket
		case SOCK_UDP:

			if (getSn_IR(w5500.socketNumber) == 0x04) { //Sn_IR_RECV -> RX interrupt

				if (getSn_RX_RSR(w5500.socketNumber) > 0) { //If rx buffer is not empty

					memset(w5500.rxMessage, 0, w5500.rxBufferLength); //Erase all buffer before receive
					w5500.rxBufferLength = getSn_RX_RSR(w5500.socketNumber);
					recvfrom(w5500.socketNumber, rxBuffer_ptr,
							w5500.rxBufferLength, w5500.remoteIp,
							&w5500.remotePort); //Receive command

					for (int i = 0; i < (w5500.rxBufferLength - 8); i++) { //Copy message memory to struct

						w5500.rxMessage[i] = *(rxBuffer_ptr + i);
					}
					memset(rxBuffer_ptr, 0, w5500.rxBufferLength);
					free(rxBuffer_ptr);
				}
			}
			break;
		case SOCK_CLOSED: //If socket closed, try to connect again
			socket(w5500.socketNumber, Sn_MR_UDP, w5500.localPort, 0); // 0 -> No flag need at UDP
			break;
		}
	}

}
```

Falling edge interrupt working at mcu side I have tested already.

Best regards.

### Reply 3 by becky, 2021-06-29

![](https://avatars.discourse-cdn.com/v4/letter/m/41988e/48.png) murseloguzandic:

> `if (getSn_IR(w5500.socketNumber) == 0x04) `

Are you on this condition?

I can’t see the code to clear the interrupt, are you clearing it?

### Reply 4 by murseloguzandic, 2021-06-29

Yes code enter `if (getSn_IR(w5500.socketNumber) == 0x04)`.
I can’t see any change on INTn pin. As I understand pin stays low until I clear interrupt. If pin fall, I will add clear interrupt.

### Reply 5 by becky, 2021-06-29

What is the w5500.socketNumber ?
In your code it should be zero.

### Reply 6 by murseloguzandic, 2021-06-29

Yes, it’s zero. I’m taking messages on UDP no problem there.

---

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