Hi,
We have made our own W5500 custom board and the SPI is not working, we checked MOSI and MISO on the oscilloscope, but we see only MOSI pulses, the W5500 chip is not responding.
And on power ON I am reading chip version.
#define W5500_SPI_READ (0x00 << 2) //< SPI interface Read operation in Control Phase
unsigned char ucWizRead(unsigned long AddrSel)
{
unsigned char ret ;
CE_HIGH() ; // Chip Deselect
_nop();
_nop();
_nop();
CE_LOW() ; // Chip Select
_nop();
_nop();
_nop();
// 0x00003900 Chip Version of Address
AddrSel |= (W5500_SPI_READ | 0x00) ; // Address Phase + Control Phase
vfnSPI_SendByte((AddrSel & 0x00FF0000) >> 16) ;
vfnSPI_SendByte((AddrSel & 0x0000FF00) >> 8) ;
vfnSPI_SendByte((AddrSel & 0x000000FF) >> 0) ;
ret = ucfnSPI_ReceiveByte() ; // Read the response from W5500 chip
_nop();
_nop();
_nop();
CE_HIGH() ; // Chip Deselect
return ret ;
}
// Function for Send byte to W5500
void vfnSPI_SendByte ( unsigned char ucData )
{
unsigned char ucBitIndex = 0x80 ;
unsigned char ucLocal = 0 ;
for ( ucLocal = 0 ; ucLocal < 8 ; ucLocal++ )
{
if ( ucData & ucBitIndex )
SI_HIGH() ; // starts from MSB and if high will give high pulse
else
SI_LOW() ;
SCK_HIGH() ; // Generate Clock Pulse
_NOP();
_NOP() ;
_NOP() ;
_NOP() ;
SCK_LOW() ;
ucBitIndex >>= 1 ;
}
}
// Receive function
unsigned char ucfnSPI_ReceiveByte ()
{
unsigned char ucData = 0x00, ucLocal, ucBitIndex = 0x80 ;
for ( ucLocal = 0 ; ucLocal < 8 ; ucLocal++ )
{
if ( IS_SO_HIGH() )
ucData |= ucBitIndex ; // If there is data from W5500 it will make that bit high.
SCK_HIGH() ; // Generate Serial Clock Pulse
_NOP() ;
_NOP() ;
_NOP() ;
_NOP() ;
SCK_LOW() ;
ucBitIndex >>= 1 ;
}
return ucData ;
}
Please help me!
Reference Circuit: ETHERNET PDF.pdf (22.8 KB)