Have to wait 30 secondes before ping


#1

Hello,

I am working with an arduino mega with W5500 Ethernet Shield (the red one from wiznet).
I am writing a bootloader.

Here is a very basic bootloader:

int main(void)
{
_delay_ms(500);

// Spi init
SPI_PORT = _BV(SCK) | _BV(MISO) | _BV(MOSI) | _BV(SS);
SPI_DDR = _BV(SCK) | _BV(MOSI) | _BV(SS);
ETH_PORT |= _BV(ETH_SS);
ETH_DDR |= _BV(ETH_SS);
SD_PORT |= _BV(SD_SS);
SD_DDR |= _BV(SD_SS);
SPSR = (1 << SPI2X);

_delay_ms(500);

// Network init
for (int i=0; i<8  ; i++)   // MAX_SOCK_NUM
{
    uint8_t cntl_byte = (0x0C + (i<<5));
    spiWriteReg(0x1E, cntl_byte, 2);//0x1E - Sn_RXBUF_SIZE
    spiWriteReg(0x1F, cntl_byte, 2);//0x1F - Sn_TXBUF_SIZE
}

uint8_t registerBuffer[28] = {
    0x80,       // MR Mode - reset device
    
    // EEPROM block starts here
    192,168,0,254,    // GWR Gateway IP Address Register
    255,255,255,0,   // SUBR Subnet Mask Register
    0xDE,0xAD,0xBE,0xEF,0xFE,0xE0,   // SHAR Source Hardware Address Register
    192,168,0,100,    // SIPR Source IP Address Register
    // EEPROM block ends here
    
    0, 0,         // Interrupt Low Level Timer (INTLEVEL0), (INTLEVEL1) (0x0013, 0x0014)
    0,            // IR Interrupt Register (0x0015)
    0,            // IMR Interrupt Mask Register (0x0016)
    0,            // Socket Interrupt (SIR) (0x0017)
    0,            // Socket Interrupt Mask (SIMR) (0x0018)
    0x07, 0xd0,   // RTR Retry Time-value Register ((RTR0),(RTR0)) (0x0019,0x001A)
    0x08,         // RCR Retry Count Register (0x001B)
};

for(int i = 0; i < 28; i++)
{
    spiWriteReg(i, 0x04 , registerBuffer[i]);
}

I do not understand why but i have to wait about 30 seconds between power up and the first ping response.

Why does w5500 takes 30 seconds to setup ?

I have tried the same program on old officiel arduino Ethernet Shield 2 and i do not have this problem.
This shield has the same w5500 chip…

Thanks


#2

Hello,

Are all conditions the same except for the Ethernet shield?
I want to see wireshark capture


#3

There is nothing. The shield does not say anything before 30 seconds.

I have notice the pin 2 is connected on int on w5500 shield whereas it is not connected on arduino official shield