WIZnet Developer Forum

W5200 Read/Write Error

Hello,

I’m pretty new to WIZNet, and I was hoping someone could help me with an odd problem.
My nSS, sclk, and MOSI Lines all look how I expect them too, but my MISO behaves in the following way: when nSS goes low, MISO will go low and stay low until nSS goes high again. In other words, the WIZNet is not writing anything to MISO, even if I send a read request.
Additionally, after setting up the IP, I am unable to ping the device.

Looking through the posts, it sounded like maybe it was something to do with the Reset Line, but I polled that pin too and confirmed that it drops to 0V before I set it high again. I’ve posted my initialization code. Does anyone see anything wrong? (It’s a bit rough, but the logic should be sound)

[code]
void SPI_COM::WizInit(Uint8 *MacAddress_, Uint8 *IpAddress_, Uint8 *NetMask_, Uint8 *Gateway_){
//Initialize F28335 SPI FIFO
spi_fifo_init();
CLEARA.bit.GPIO21 = 1; // Set it low and hold for at least 2uS
DELAY_US(4);

SETA.bit.GPIO21 = 1;		// Set it high and hold for at least 150ms to stabilize PLL
DELAY_US(50000);			// such a long time....
DELAY_US(50000);
DELAY_US(60000);

WizWrite(MR8, (Uint8)0x80);
DELAY_US(4);

// Set socket mode?
for (int i=0; i<8; i++){
	//0x61 = Multicasting disabled, MAC Filtering enabled, No ACK delay, TCP Mode
	// There are 7 sockets available, this loop will set each one of them
	WizWrite(SnMode_Reg + i*0x100, (Uint8)0x61);

}

// Set the MAC Address
SetMacAddress(MacAddress_);
DELAY_US(20);
// Set IP Address
SetIpAddress(IpAddress_);
DELAY_US(20);
// Set NetMask
SetNetMask(NetMask_);
DELAY_US(20);
// Set GateWay
SetGateway(Gateway_);
DELAY_US(20);

// Set Port#'s
Uint16 val;
for(int i=0; i<8; i++){
	val = 50000 + i;
	WizWrite(SnPORT16 + i*0x100, (Uint16*)&val);
}

}[/code]

I’m using the TMS320F28335 chip from TI.

Thank you in advance!

Giving this a bump because I’m on a bit of a time constraint. Thanks again!

Hi,

I want to look wave of oscilloscope.
I think MCU is not followed W5200 SPI format.

I’d recommend checking the SPI setup. It sounds possible that your MCU is in slave mode, and is driving the MISO pin when the slave select goes low. If you have a resistor on the MISO line you can remove, or if you can lift one of the pins to create an open circuit, you can verify who is actually driving that line.

I’ve use SPI based Wiznet modules (I think the W5200) before with no problems, so if that’s not it, maybe you are missing a detail of the protocol.

Hi,

So my issue was that I was operating in the wrong SPI Mode and outputting data on the wrong clock edge. Thanks for the help/suggestions!

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