Reading the IP-Address from the Register

We wrote a routine to get the content of registers:

int read_data_WIZ550io (int addr1, int addr2, int contr, int var){
P9OUT &= ~BIT7; //CS WIZ550io → low

while((UCA1IFG&UCTXIFG) ==0);	//Wait for TX buffer to be ready for new data
UCA1TXBUF = addr1;			//Push address_phase to TX buffer

while((UCA1IFG&UCTXIFG) ==0);	//Wait for TX buffer to be ready for new data
UCA1TXBUF = addr2;			//Push address_phase to TX buffer

while((UCA1IFG&UCTXIFG) ==0);	//Wait for TX buffer to be ready for new data
UCA1TXBUF = contr;			//Push control_phase to TX buffer

while((UCA1IFG&UCTXIFG) ==0);	//Wait for TX buffer to be ready for new data
UCA1TXBUF = dummy_byte;		//Push dummy_byte to TX buffer

while(UCA1STAT & UCBUSY);	//Wait until the last byte is completely sent

while(((UCA1IFG&UCRXIFG) && (UCA1IFG&UCTXIFG)) ==0);

__delay_cycles(200);

RX_Buffer[var] = UCA1RXBUF;

P9OUT |= BIT7;			//CS WIZ550io -> high

return 0;

}

Now I try to get the last Byte of the IP-Adress from the WizNet550io-Register

read_data_WIZ550io(0x00, 0x12, 0x06, 0x00);

But it did not work. The WIZ550io delivers just 0.
What is wrong?

Best regards

Franz Peter Zantis

Franz-Peter, you give insufficient information. Code is not clear for me.
Which IP address (which register exactly) you want to read, and, also important - when - at which stage of W5500/socket progress?

Hi,
It should be the low leve SPI communication routines for a something embed TI …
are you sure that the CPU alone give the clock cycles needed?
If communication is handled by the MPU HW you do not need to move the clock but perhaps not knowing it is better to take a look :wink:
I would have some doubts about it … search the internet for an SPI routine already done for your MPU SPI.

Take care to set MPU SPI in this manner :
- clock idle low
- on rising edge
- set sample on end
and these settings are on all SPI regardless of used CPU.

Another problem could be the W5500 reset routine, once you’ve set and enabled the SPI hold down the RST for at least half a second before you communicate with the W5500 (or test for the RDY pin if you have a free I/O pin)
Then instead of reading the IP address registry try to read the version register (see manual) that you know what needs to return.