---
title: "W5500 checking for a SYN packet"
url: "https://maker.wiznet.io/forum/15282"
markdown_url: "https://maker.wiznet.io/forum/15282/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "dennisnsmith2000"
created: "2024-10-01T08:05:25+09:00"
last_activity: "2024-10-06T02:49:51+09:00"
language: "en"
tags: ["W5500"]
views: 6
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W5500 checking for a SYN packet

## Question

Asked by dennisnsmith2000 on 2024-10-01 in Ethernet Chips.

Hello friends,

I am having some issues trying to understand how I can check to see if I have received a SYN packet on my W5500 TCP server. With my wire shark test I have seen that there is a SYN packet sent. I have some code to trigger an interrupt once it receives the SYN packet but im unsure how to handle it.

printf("\r\nSOCKET IS NOW LISTENING\r\n");

enable_interrupts(INT_EXT1);
ext_int_edge(H_TO_L);
enable_interrupts(GLOBAL);
enableSynInterrupt(3);

while (WIZCHIP_SOCKET_READ(Sn_SR(3) | 0x68 != 0x17)) {
printf("\r\nWAITING FOR CLIENT CONNECTION\r\n");
while (!connection_established) {
printf("\r\nWAITING FOR CLIENT CONNECTION\r\n");

// Print the current status of the socket
uint8_t status = WIZCHIP_SOCKET_READ(Sn_SR(3));
printf("Current Socket Status: 0x%02X\r\n", status);

delay_ms(1000);
}
}

#INT_EXT1
void int_pin() {
uint8_t sir = WIZCHIP_SOCKET_READ(0x0017);

if (sir & 0x01) {
uint8_t irVal = WIZCHIP_SOCKET_READ(Sn_IR(3) | 0x68);
if (irVal & 0x01) {
printf("SYN packet received, connection established.\r\n");
WIZCHIP_SOCKET_WRITE(Sn_IR(3) | 0x68, 0x01);
connection_established = 1;
//WIZCHIP_SOCKET_WRITE(Sn_IR(3) | 0x68),
}
}
clear_interrupt(INT_EXT1);
}

void enableSynInterrupt(uint8_t socket) {
uint8_t currentIMR = WIZCHIP_SOCKET_READ(Sn_IMR(3) | 0x68);
WIZCHIP_SOCKET_WRITE(Sn_IMR(3) | 0x68, currentIMR | 0x01);
}

## Replies

### Reply 1 by dennisnsmith2000, 2024-10-03

I have verified the AI suggestions and it doesn't seem to be working still

### Reply 2 by Eugeny, 2024-10-06

AI will not tell you anything material if you do not explain your problem clearly.

I still do not understand what issue you have.

> I am having some issues trying to understand how I can check to see if I have received a SYN packet on my W5500 TCP server

Why do you need to check for SYN packet being received? Datasheet says if connection is established it goes into specific state.

> With my wire shark test I have seen that there is a SYN packet sent.

Right, and it does not mean it was received.

> I have some code to trigger an interrupt once it receives the SYN packet but im unsure how to handle it.

Interrupt registers as AI suggested. If you set those registers up properly, you get INT line low. Is it what you are asking for?

---

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