# W5500 Ethernet controller on OpenMV

**URL:** <https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001>\
**Category:** OpenMV Boards\
**Created:** [November 16, 2018, 3:18am UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001 "2018-11-16T03:18:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![piliwilliam](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@piliwilliam](https://forums.openmv.io/u/piliwilliam)\
**Post date:** [November 16, 2018, 3:18am UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/1 "2018-11-16T03:18:41Z")

</div>

Hi all,

I was wondering if anyone successfully built the openmv with the “MICROPY\_PY\_WIZNET5K=5500” flag?  
Below is the error when I try to build it.  
Thanks,  
Will

```python
CC src/usbd_uvc_if.c
CC src/usbd_conf.c
CC src/main.c
CC src/usbd_core.c
CC src/usbd_ctlreq.c
CC src/stm32fxxx_it.c
CC src/string0.c
CC src/usbd_uvc.c
CC src/usbd_ioreq.c
CC src/usbd_desc.c
CC src/systick.c
make[1]: Leaving directory '/home/piliwilliam/openmv/src/uvc'
/home/piliwilliam/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:497: recipe for target 'firmware' failed
make: *** [firmware] Error 1

```

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 16, 2018, 4:04am UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/2 "2018-11-16T04:04:01Z")

</div>

It looks like you need to edit the MakeFile to include the wiznet c code. Usually, this means you need to find what .c file makes that thing up and add it to the MakeFile which compiles the C file and you also need to edit the main MakeFile that links the .o files.

---

<div class="post-metadata">

**Author:** ![JackBonnell](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jackbonnell/32/67_2.png) [@JackBonnell](https://forums.openmv.io/u/JackBonnell)\
**Post date:** [November 13, 2020, 4:48pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/3 "2020-11-13T16:48:58Z")

</div>

Having the same issue the screenshot showed the relevant files needed for this variable are available i’m not expert in C code but any help would be very much appreciated as there is only a hand full of comments on this error online.

 ![Screenshot from 2020-11-13 16-44-16.png](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/1X/53c9186a197a3fafc3bae1a719bc720ad0681a1c.png)

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 13, 2020, 5:55pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/4 "2020-11-13T17:55:27Z")

</div>

You need to edit the make file system to include the compile the specified file and then include the .o.

I don’t actually know which files you need to modify. However, it’s not hard. You just have to go into the make files and add the missing file in the right places.

---

<div class="post-metadata">

**Author:** ![JackBonnell](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jackbonnell/32/67_2.png) [@JackBonnell](https://forums.openmv.io/u/JackBonnell)\
**Post date:** [November 16, 2020, 10:21am UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/5 "2020-11-16T10:21:31Z")

</div>

This is a update of my findings:

Using the “MICROPY\_PY\_WIZNET5K=5500” flag:

this files the compiling of the c code in the stm32/makefile

```python
ifneq ($(MICROPY_PY_WIZNET5K),0)
WIZNET5K_DIR=drivers/wiznet5k
INC += -I$(TOP)/$(WIZNET5K_DIR)
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=$(MICROPY_PY_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_WIZNET5K)
ifeq ($(MICROPY_PY_LWIP),1)
# When using MACRAW mode (with lwIP), maximum buffer space must be used for the raw socket
CFLAGS_MOD += -DWIZCHIP_USE_MAX_BUFFER
endif
SRC_MOD += network_wiznet5k.c modnwwiznet5k.c
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
	ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).c \
	ethernet/wizchip_conf.c \
	ethernet/socket.c \
	internet/dns/dns.c \
	)
endif

```

This error is still occurring even when i have added the o files that have been compiled in the

```python
$(BUILD)/$(MICROPY_DIR)/drivers/

```

After added the relevant compiled libraries into the build in the /src/MakeFile

```python
ifneq ($(MICROPY_PY_WIZNET5K),0)
FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\
	wiznet5k/ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).o \
	wiznet5k/ethernet/wizchip_conf.o \
	wiznet5k/ethernet/socket.o \
	wiznet5k/internet/dns/dns.o \
	)
endif

```

This is still causing the original issue

```python
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:674: recipe for target 'firmware' failed
make: *** [firmware] Error 1

```

There is only one modnetwork.o so that doesnt need to be changed. all the relevant files are in place. I am unsure what ‘mod\_network\_nic\_type\_wiznet5k’ maybe its a parameter needed in the make file i have logged an issue with the micropython github hopefully they can give me the parameter i need to declare: [MICROPY\_PY\_WIZNET5K=5500: `mod\_network\_nic\_type\_wiznet5k' · Issue #6625 · micropython/micropython · GitHub](https://github.com/micropython/micropython/issues/6625)

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [November 16, 2020, 8:53pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/6 "2020-11-16T20:53:04Z")

</div>

You need to link the object file that has the object, grep is your friend:

```python
> grep -r mod_network_nic_type_wiznet5k *
ports/stm32/modnwwiznet5k.c: wiznet5k_obj.base.type = (mp_obj_type_t*)&mod_network_nic_type_wiznet5k;
ports/stm32/modnwwiznet5k.c:const mod_network_nic_type_t mod_network_nic_type_wiznet5k = {

```

In that file you’ll see that it also needs LWIP enabled:

```python
#if MICROPY_PY_WIZNET5K && !MICROPY_PY_LWIP

```

---

<div class="post-metadata">

**Author:** ![JackBonnell](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jackbonnell/32/67_2.png) [@JackBonnell](https://forums.openmv.io/u/JackBonnell)\
**Post date:** [November 17, 2020, 12:18am UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/7 "2020-11-17T00:18:45Z")

</div>

Hi,  
Thank you for the response you’re a life saver, wish i knew about grep before! it has fixed all my issues! now on to testing 😮  
That a hardware engineer trying to learn firmware for you 😆  
I will make a pull request in the morning!  
All the Best,  
Jack

---

<div class="post-metadata">

**Author:** ![JackBonnell](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jackbonnell/32/67_2.png) [@JackBonnell](https://forums.openmv.io/u/JackBonnell)\
**Post date:** [November 17, 2020, 5:01pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/8 "2020-11-17T17:01:30Z")

</div>

Now Receiving this error:

```python
Warning: FROZEN_MPY_DIR is deprecated in favour of FROZEN_MANIFEST
CC modnetwork.c
In file included from /home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/py/objlist.h:29:0,
                 from modnetwork.c:31:
modnetwork.c:148:46: error: 'mod_network_nic_type_winc' undeclared here (not in a function); did you mean 'mod_network_nic_type_wiznet5k'?
     { MP_ROM_QSTR(MP_QSTR_WINC), MP_ROM_PTR(&mod_network_nic_type_winc) },
                                              ^
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/py/obj.h:249:24: note: in definition of macro 'MP_ROM_PTR'
 #define MP_ROM_PTR(p) (p)
                        ^
../../py/mkrules.mk:47: recipe for target '/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o' failed
make[1]: *** [/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o] Error 1
Makefile:643: recipe for target 'FIRMWARE_OBJS' failed
make: *** [FIRMWARE_OBJS] Error 2

```

when is use the grep command i get this:

```python
grep -r mod_network_nic_type_winc *
build/micropython/genhdr/qstr.i.last: { ((mp_obj_t)((((mp_uint_t)(MP_QSTR_WINC)) << 2) | 2)), (&mod_network_nic_type_winc) },
micropython/ports/stm32/modnetwork.h:extern const mod_network_nic_type_t mod_network_nic_type_winc;
micropython/ports/stm32/modnetwork.c: { MP_ROM_QSTR(MP_QSTR_WINC), MP_ROM_PTR(&mod_network_nic_type_winc) },
omv/py/py_winc.c:static const winc_obj_t winc_obj = {{(mp_obj_type_t*)&mod_network_nic_type_winc}};
omv/py/py_winc.c:const mod_network_nic_type_t mod_network_nic_type_winc = {

```

All of these files except for :  
build/micropython/genhdr/qstr.i.last

are accounted for in the make files, is there anything obvious im missing?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 17, 2020, 5:27pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/9 "2020-11-17T17:27:24Z")

</div>

You’ve disabled the winc1500, you need to re-enable it too or remove that line.

---

<div class="post-metadata">

**Author:** ![JackBonnell](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/jackbonnell/32/67_2.png) [@JackBonnell](https://forums.openmv.io/u/JackBonnell)\
**Post date:** [November 17, 2020, 8:43pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/10 "2020-11-17T20:43:36Z")

</div>

Forcing the compile flag has the same result with or without

```python
MICROPY_PY_WIZNET5K=5500

```

same error as above has been causing with:

```python
 make TARGET=OPENMV4 MICROPY_PY_LWIP=1 MICROPY_PY_WINC1500=1

```

when force disable MICROPY\_PY\_WINC1500 with:

```python
make TARGET=OPENMV4 MICROPY_PY_WIZNET5K=5500 MICROPY_PY_LWIP=1 MICROPY_PY_WINC1500=0

```

This is my error message:

```python
CC src/systick.c
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: /home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/bin/firmware.elf section `.text' will not fit in region `FLASH_TEXT'
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: /home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/bin/firmware.elf section `._heap' will not fit in region `SRAM1'
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `SRAM1' overflowed by 24012 bytes
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `FLASH_TEXT' overflowed by 16 bytes
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o: In function `pyb_lwip_poll':
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/ports/stm32/modnetwork.c:61: undefined reference to `wiznet5k_poll'
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o:(.rodata.mp_module_network_globals_table+0xc): undefined reference to `mod_network_nic_type_wiznet5k'
collect2: error: ld returned 1 exit status
Makefile:667: recipe for target 'firmware' failed
make: *** [firmware] Error 1

```

It looks likes LWIP is causing this somehow, any ideas?

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [November 18, 2020, 1:50pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/11 "2020-11-18T13:50:26Z")

</div>

I see multiple issues, first if you want to disable modules like WINC you need to edit this file:

```python
omv/boards/OPENMV4/omv_boardconfig.mk

```

Set WINC to 0.

I think this config will work for you:

```python
MICROPY_PY_ULAB = 0
MICROPY_PY_WINC1500 = 0
MICROPY_PY_IMU = 0
MICROPY_PY_LWIP = 1
MICROPY_PY_WIZNET5K = 1

```

> /usr/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: region `SRAM1' overflowed by 24012 bytes /usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: region `FLASH\_TEXT’ overflowed by 16 bytes

If you get this you need to disable things until the firmware fits, try to disable things in imlib\_config.h and you need to lower the heap in omv\_boardconfig.h

```python
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/build/micropython/modnetwork.o: In function `pyb_lwip_poll':
/home/jack/Development/OPENMV_FIRMWARE/openmv/src/micropython/ports/stm32/modnetwork.c:61: undefined reference to `wiznet5k_poll'

```

I think the above config will fix these.

Finally keep in mind that even if it builds it still may not work with our firmware, it may be missing a callback or something, so you’re on your own here.

---

<div class="post-metadata">

**Author:** ![TRMrNo](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@TRMrNo](https://forums.openmv.io/u/TRMrNo)\
**Post date:** [May 27, 2021, 1:55pm UTC](https://forums.openmv.io/t/w5500-ethernet-controller-on-openmv/1001/12 "2021-05-27T13:55:48Z")

</div>

Hello,

When the source file w5500 for micropython library, I see that there is a function wiznet5k\_poll. However it is in the network\_wiznet5k.c file.

May be you are working an old source files of the micropython.

I want to run w5500 with openmv. If you are able to run the driver. Let me know please
