WIZnet Developer Forum

About the culation of registers' adress

According to the dirver code, the SN_MR adress is 0x00_0008, but according to the datasheet, it is BSB adress 0x01+OFFSET adress 0x0000, 0x01_0000.
There is the code #define Sn_MR(N) (W5500_IO_BASE + (0x0000 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) for socket0
what in the datasheet is the below figure,

Where did you find it?

W5500_IO_BASE is 0, and WIZCHIP_SREG_BLOCK(0) is 1.
1<<3=0x8
So i summed them and get 0x00_0008

Because bits [7:0] of resulting value you have (0x08) correspond to control phase byte, and this byte’s bits [7:3] correspond to field BSB[4:0], and its value of 1 corresponds to the base of socket 0 registers.

1 Like

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.