Wiznet / RP2040-HAT-C

Ethernet Example for RP2040
64 stars 35 forks source link

DHCP issue W5500 #6

Closed xamanimran closed 2 years ago

xamanimran commented 2 years ago

I am experimenting with DHCP and DNS example. I am using W5500 and Rp2040 pico board with SPI0. I want to use DHCP to get IP. When I build and drag firmware.uf2 file in pico-board. Nothing was displayed on the terminal. I have also changed the configuration to SPI1 but nothing works. I have tested it with circuit python it works fine for me. I want to use C/C++ SDK.

static wiz_NetInfo g_net_info = { .mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address .dhcp = NETINFO_DHCP // DHCP enable/disable };

Screenshot 2022-01-15 163658

GiungKim commented 2 years ago

Hi @xamanimran,

Is there no output in the terminal program even if the device is reset after F/W upload?

xamanimran commented 2 years ago

Hi @xamanimran,

Is there no output in the terminal program even if the device is reset after F/W upload?

yes, there is no output on the terminal. Even the print statement at the start of main() function doesn't print. I have tried both MinGW and NMake toolchains for compilation.

GiungKim commented 2 years ago

Hi @xamanimran,

There seems to be a problem in the process of checking the version information of the chip.

W5100S is '0×51' but W5500 is '0×04'.

Can you try to fix below function(wizchip_check())?

image

But if there's a problem while checking the chip version, the print should come out, but it's weird that it doesn't...

xamanimran commented 2 years ago

Hi @xamanimran,

There seems to be a problem in the process of checking the version information of the chip.

W5100S is '0×51' but W5500 is '0×04'.

Can you try to fix below function(wizchip_check())?

  • W5100S

    • function : getVER()
    • value : 0x51
  • W5500

    • function : getVERSIONR()
    • value : 0x04

image

But if there's a problem while checking the chip version, the print should come out, but it's weird that it doesn't...

Yes, this is helpful but has not resolved the problem as I have identified an issue with wizchip_conf.h file.

Screenshot 2022-01-18 120040

when I changed the value to W5500 and hit the build button. It automatically convert to W5100S. I have deleted the build folder and tried again to build but it changed _WIZCHIP_ value to W5100S from W5500 . This mainly happens when I delete the build folder and build form start. But when I build with W5100S setting and then after that I change value W5100S to W5500 it doesn't changed back to W5100S but then several errors occurs as shown below. Screenshot 2022-01-18 121720

I have also made some changes in w5x00_spi.c file as shown below. Screenshot 2022-01-18 122234

GiungKim commented 2 years ago

Hi @xamanimran,

Did you fix CMakeLists files or other files?

'RP2040-HAT-C' is implemented based on 'W5100S', so there are some parts that need to be fixed to use 'W5500'.

Please refer to the below.

  1. Fix patch file 'rp2040_hat_c-patch.cmake'

image

  1. Fix 'CMakeLists.txt' in 'RP2040-HAT-C\libraries\' directory

image

image

  1. Fix chip version check function → Done
xamanimran commented 2 years ago

Hi @xamanimran,

Did you fix CMakeLists files or other files?

'RP2040-HAT-C' is implemented based on 'W5100S', so there are some parts that need to be fixed to use 'W5500'.

Please refer to the below.

  1. Fix patch file 'rp2040_hat_c-patch.cmake'

image

  1. Fix 'CMakeLists.txt' in 'RP2040-HAT-C\libraries\' directory

image

image

  1. Fix chip version check function → Done

Thanks @GiungKim. The issue is resolved after making the above changes in respective files in CMakefiles.txt, wizchip_conf.h and w5x00_spi.c. Now it works for W5500. Screenshot 2022-01-18 141538