---
title: "Macro definition problem in W5500 library function"
url: "https://maker.wiznet.io/forum/15075"
markdown_url: "https://maker.wiznet.io/forum/15075/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Bohu-Tang"
created: "2023-11-22T03:28:56+09:00"
last_activity: "2023-12-12T09:19:38+09:00"
language: "en"
views: 168
replies: 5
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Macro definition problem in W5500 library function

## Question

Asked by Bohu-Tang on 2023-11-22 in Ethernet Chips.

Dear all
I was confused when looking at the w5500 library function, as in the first picture, the w5500 Socket_n register corresponds to a 16-bit offset address. But in the actual library function, I see a 24-bit offset address as defined in the second diagram. Why add 08 at the end? And use the statement (ch&lt;&lt;5).Why not just define it as a 16-bit offset address according to the data manual? I will be very grateful if the Official technician will solve my confusion.

[![1](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/c/cc1695161f6305c7d253ee6776ac3624cd92a487.png) 1806×1042 257 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/c/cc1695161f6305c7d253ee6776ac3624cd92a487.png)

[![2](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/f/f484ff259a1e9421e78a3dac7d14490e1a77faf6.png) 21273×767 53.5 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/f/f484ff259a1e9421e78a3dac7d14490e1a77faf6.png)

## Replies

### Reply 1 by Eugeny, 2023-11-22

This must be preparation of the 3rd byte in the SPI transaction. 0x08 is the socket 0 register set. If you add channel (socket) number shifted left by 5 bits you will get 16-bit address + bank identification for respective channel (socket) ready to shift to the SPI. The only additionally needed is set bit for write and 2 bits for transfer mode type.

### Reply 2 by Bohu-Tang, 2023-11-22 (in reply to reply 1)

Thank you very much for solving my confusion with your answer.

### Reply 3 by Bohu-Tang, 2023-11-22 (in reply to reply 1)

Sorry,Eugeny,I just looked at the W5500 datasheet and Socket 0 Register corresponds to 0x01 and 0x08 corresponds to the Reserved field.Am I looking for the wrong register location?

[![1](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/1/1d8b42fcd8cba830102a71e770330a6b24af9c55.png) 1838×1067 324 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/1/1d8b42fcd8cba830102a71e770330a6b24af9c55.png)

### Reply 4 by Eugeny, 2023-11-22

You are looking into wrong place. Read the 2.2 of the datasheet, it will answer your question. 0x08 is bank (block) address of 0x01 shifted 3 bits left because lower 3 bits are occupied by other flags.

### Reply 5 by Bohu-Tang, 2023-11-23

Thanks a lot Eugeny. Your answer clears up my confusion.

---

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