WIZnet Developer Forum

Basic question about basic adress

Hello;
I am just start developing with the 5300 (WIZ830MJ) and STM32F4 µC.
I am a little bit confused about these two things:

  1. Base Address:
    Taken from the W5300 dazasheet"
    "Physical Address of W5300 Reg = Base Address of T.M.S + Address offset of W5300 Reg

For convenience, we assume the Base Address(BA) of T.M.S is 0x08000, and BA of the
Physical Address of W5300 Register is 0x08000."

I have studied some code examples, first I thougt, base address/ address of Mode Register always is 0x08000, but the address in the code example varies.

So what do I have to use in case of an STM32F4 Controller as Start address/First Adress:0x00000 or 0x08000 ???

  1. "Taken from Datasheet Manual of W5300"
    “6.1.1 16 Bit Data Bus Width In case of using a 16bit data bus width, ADDR[9:1] is used and ADDR0 is connected to ground”

Question:
I defined GPIO Port E as Address Port:
How to write a Address to that Port from internal variable value ?
Because : Address uses 9 Portlines, Internal Variable, holding the address is uint_16 type (uint_16 W5300Address) for example
Do I always have to shift the value of W5300Address like : Output_to_Port_E = W5300Address <<1 ??

Thanks in advance

Marc

I can only answer for the first request, the base varies depending on the addressing mode you are set.
In Direct address mode :

COMMON_REG_BASE = 0x8000 
SOCKET_REG_BASE = 0x8000 + 0x0200

In Indirect address mode :

COMMON_REG_BASE = 0x0000
SOCKET_REG_BASE = 0x0200

… but maybe this piece of code can serve for the second question

uint8 IINCHIP_READ(uint16 addr)
{
#if (__DEF_IINCHIP_ADDRESS_MODE__ == __DEF_IINCHIP_DIRECT_MODE__)
	 return ({*((vuint8*)(addr));});
#else
   uint8 data;
      *((vuint8*)IDM_AR) = addr >> 8;
      *((vuint8*)IDM_AR1) = addr;
	  if(addr &0x01) data = *((vuint8*)IDM_DR1);
	  else data = *((vuint8*)IDM_DR);

   return data;
#endif
}

void IINCHIP_WRITE(uint16 addr,uint8 data)
{
#if (__DEF_IINCHIP_ADDRESS_MODE__ == __DEF_IINCHIP_DIRECT_MODE__) 
	 *((vuint8*)(addr)) = data;
#else
    *((vuint8*)IDM_AR) = addr >> 8;
	  *((vuint8*)IDM_AR1) = addr;
	  if(addr &0x01) *((vuint8*)IDM_DR1) = data;
	  else *((vuint8*)IDM_DR) = data;
#endif
}

uint16   getMR(void)
{
   return (IINCHIP_READ(MR_) << 8 | IINCHIP_READ(MR));
}
void     setMR(uint16 val)
{
   *((volatile uint8*)MR_) = val >> 8;
   *((volatile uint8*)MR) = val & 0xff;
}

PS: I used the W5300 only in indirect mode.

hi…
i am using w5300 chip.and i have problem with addressing registers for initialization…
i dont understand what the Base Address(BS) is.
for example mentioned in datasheet, if BA = 0x8000, the IR Register’s address equals 0x8002.
while Address Bus hase only 10 bits.how can we show 0x8002 by 10 bits?

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