[From QnA]Initialize a WIZ812MJ

I am doing tests with a WIZ812MJ module and I cannot initialize it.

I connect it to a micro by SPI .

the data I write are the following:

            (0x0000, 0x80);

(0x0016, 0x00);

(0x0001 , 192) ;

(0x0002 , 168) ;

(0x0003 , 1) ;

(0x0004 , 1) ;

(0x0009 , 0xEE);

(0x000A , 0xEE);

(0x000B, 0xEE);

(0x000C, 0xEE);

(0x000D , 0xEE);

(0x000 E, 0xEE);

(0x0005 , 255);

(0x0006 , 255);

(0x0007 , 255);

(0x0008 , 0);

(0x000F , 192);

(0x0010 , 168);

(0x0011 , 1);

(0x0012 , 19);

(0x001A, 0x55);

(0x001B, 0x55);

(0x0401, 0x10);

(0x0400, 0x01);

(0x0404, 0x81);

(0x0405, 0x81);

(0x0401, 0x01);

then I read all the WIZ812 configuration memory and the result is the following:

            0:0.

1:192.

2:168.

3:1.

4:1.

5:255.

6:255.

7:255.

8:0.

9:238.

10:238.

11:238.

12:238.

13:238.

14:238.

15:192.

16:168.

17:1.

18:19.

19:0.

20:0.

21:0.

        …

        …

        …

        …

1024:0.

1025:0.

1026:0.

1027:0.

1028:129.

1029:0.

1030:0.

1031:0.

1032:0.

1033:0.

1034:255.

1035:255.

1036:255.

1037:255.

1038:255.

1039:255.

1040:0.

1041:0.

0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405 position data are not written.

I think I am correctly following the datasheet steps. could you please let me know if I am doing something wrong or where does the problem come from?

Dear customer,
Thanks for your interest in our WIZ812MJ.
First of all, how do you know the WIZ812MJ cannot be initialized. What’s the symptoms?
Second, please show your code about initialization.
Thanks.

Thank you for your quick reply

This is a code extract:

To:

ip[3] = 192; ip[2] = 168; ip[1] = 1; ip[0] = 19;

mask [3] = 255; mask [2] = 255; mask [1] = 255; mask [0] = 0;

mac[5] = 0xEE; mac [4] = 0xEE; mac [3] = 0xEE; mac [2] = 0xEE; mac [1] = 0xEE; mac [0] = 0xEE;

gateway[3] = 192; gateway [2] = 168; gateway [1] = 1; gateway [0] = 1;

             // Activo W5100

escribir_w5100(0x0000, 0x80);

// Activo o Desactivo IRQs

escribir_w5100(0x0016, 0x00);

// Asignamos time out (por defecto 200ms 07D0)

//escribir_w5100(0x0017, 0x07);

//escribir_w5100(0x0018, 0xD0);

// Asignamos numero de retransmisiones (por defecto 8)

//escribir_w5100(0x0019, 0x08);

// Escribo la puerta de enlace

for(i=0; i<4; i++)

        {

        escribir_w5100((0x0001 + i), (gateway[3-i]));

        }

// Escribo la MAC

for(i=0; i<6; i++)

        {

        escribir_w5100((0x0009 + i), (mac[5-i]));

        }

// Escribo la MASK

for(i=0; i<4; i++)

        {

        escribir_w5100((0x0005 + i), (mask[3-i]));

        }

// Escribo la IP

for(i=0; i<4; i++)

        {

        escribir_w5100((0x000F + i), (ip[3-i]));

        }

// Asignamos la memoria a los Sockets de Recepción. (2 k para cada uno)

escribir_w5100(0x001A, 0x55);

// Para 0x55, S0 0x6000 a 0x67FF, S1 0x6800 a 0x6FFF, S2 0x7000 a 0x77FF, S3 0x7800 a 0x7FFF.

// Asignamos la memoria a los Sockets de Transmisión. (2 k para cada uno)

escribir_w5100(0x001B, 0x55);

// Para 0x55, S0 0x4000 a 0x47FF, S1 0x4800 a 0x4FFF, S2 0x5000 a 0x57FF, S3 0x5800 a 0x5FFF.

At this point WIZ812MJ answers to ping.

        escribir_w5100(0x0401, 0x10);

        escribir_w5100(0x0400, 0x01);

        escribir_w5100(0x0404, 0x81);

        escribir_w5100(0x0405, 0x81);

        escribir_w5100(0x0401, 0x01);

At this point, socket does not answer and written data do not appear when reading the configuration memory in positions 0x0401, 0x0400 and 0x0405

Data appears when introduced in position 0x0404 (1028).

Data appear when introduced in ip, mask, mac and gateway.

Why can I not write in positions 0x400, 0x401 and 0x405?

Thank you.

Dear customer,
The below code is for read/write w5100’s register via SPI. Please refer to.
Note: the sample code is based on PIC24 MCU.
Good luck!

UINT8 ReadReg(UINT16 Address)
{
UINT8 r;
//IEC0bits.INT0IE = 0; //External interrupt disable
ENC_CS_IO = 0; //cs assert low
ClearSPIDoneFlag();

SSPBUF = 0x0F;    // SSPBUF is SPI buffer register to transmit or receive of PIC24

WaitForDataByte(); // Wait until opcode/address is transmitted.
r = SSPBUF;

SSPBUF = (BYTE)(Address >> 8);

WaitForDataByte(); // Wait until opcode/address is transmitted.
r = SSPBUF;

SSPBUF = (BYTE)Address;
WaitForDataByte(); // Wait until opcode/address is transmitted.
r = SSPBUF;

SSPBUF = 0x00; // Send a dummy byte to receive the register contents
WaitForDataByte(); // Wait until the register is received
r = SSPBUF;
//WaitForDataByte(); // Wait until the register is received

ENC_CS_IO = 1;

//IEC0bits.INT0IE = 1; //External interrupt enable
return r;
}//end ReadReg

void WriteReg(UINT16 Address, UINT8 Data)
{
volatile BYTE Dummy;

//IEC0bits.INT0IE = 0; //External interrupt disable
ENC_CS_IO = 0;
ClearSPIDoneFlag();
SSPBUF = 0xF0;
WaitForDataByte();
Dummy = SSPBUF;

SSPBUF = (BYTE)(Address >>8);
WaitForDataByte();
Dummy = SSPBUF;

SSPBUF = (BYTE)Address;
WaitForDataByte();
Dummy = SSPBUF;

SSPBUF = Data; // Send the byte to be writen.
WaitForDataByte(); // Wait until finished transmitting
Dummy = SSPBUF;

ENC_CS_IO = 1;

//IEC0bits.INT0IE = 1; //External interrupt enable

}//end WriteReg

Thank for yours replies.

I resolved my problem.
I had got a problem with the times of SPI protocol.