[From QnA]Initialize a WIZ812MJ
IO Modules
No replies yet. Be the first to reply.
Join the discussion.
IO Modules
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: [From QnA]Initialize a WIZ812MJ
by wiznetmuseum ·
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.
RE: [From QnA]Initialize a WIZ812MJ
by wiznetmuseum ·
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;
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++)
// Escribo la MAC
for(i=0; i<6; i++)
// Escribo la MASK
for(i=0; i<4; i++)
// Escribo la IP
for(i=0; i<4; 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.
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.
RE: [From QnA]Initialize a WIZ812MJ
by wiznetmuseum ·
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();
WaitForDataByte(); // Wait until opcode/address is transmitted.
r = SSPBUF;
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
//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;
//IEC0bits.INT0IE = 1; //External interrupt enable
}//end WriteReg
RE: [From QnA]Initialize a WIZ812MJ
by wiznetmuseum ·
Thank for yours replies.
I resolved my problem.
I had got a problem with the times of SPI protocol.