WIZnet-MbedEthernet / WIZnetInterface

arm Mbed-OS 5 WIZnet chipset driver (W7xxx, W5/6xxx)
8 stars 2 forks source link

W5500 does not work when the reset pin is connected #8

Open strange-v opened 4 years ago

strange-v commented 4 years ago

I have two different modules with the W5500 chip and both of them behave identically. They work correctly only when the reset pin is disconnected or reset functionality is commented out (last four lines in the code below):

// Reset the chip & set the buffer
void WIZnet_Chip::reset()
{
//    reset_pin = 1;
    reset_pin = 0;
    wait_us(500); // 500us (w5500)
    reset_pin = 1;
    wait_ms(400); // 400ms (w5500)

This behavior is strange because the reset functionality looks correct.

Mbed OS 5.14.2 STM32F411CEU6 (blue pill) Please let me know if some additional information will be helpful.

Xeenych commented 4 years ago

This dirver sets MAC, sets IP and then resets the chip. To correct this remove all occurences of _wiznet.reset() in WIZinterface.cpp Then add _wiznet.reset() to the first line of the constructor

 WIZnetInterface::WIZnetInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset) :
    _wiznet(mosi, miso, sclk, cs, reset)
    {
        _wiznet.reset();  
        ip_set = false;
        _dhcp_enable = true;
        thread_read_socket.start(callback(this, &WIZnetInterface::socket_check_read));
    }
Xeenych commented 4 years ago

Also comment all occurencies of error("No more sockets for listening"); Chip supports only 8 sockets. When application layer request more, then error() is callend and system hangs.

strange-v commented 4 years ago

@Xeenych it works after I added fixes that you described. I'll create related PR. Thank you for your help!

strange-v commented 4 years ago

@Xeenych, sorry that I bother you again, but no one else answers questions here) Looks like I've found one more issue with this library #10, seems you are quite familiar with the W5500 chip, maybe you would have a chance to review my thoughts?

Xeenych commented 4 years ago

@strange-v, sorry I can't help you with this.