---
title: "W5100S-EVB-Pico hangs after consecutive requests (MicroPython)"
url: "https://maker.wiznet.io/forum/14676"
markdown_url: "https://maker.wiznet.io/forum/14676/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Rogier"
created: "2022-10-10T13:15:39+09:00"
last_activity: "2022-10-21T13:23:17+09:00"
language: "en"
views: 689
replies: 3
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W5100S-EVB-Pico hangs after consecutive requests (MicroPython)

## Question

Asked by Rogier on 2022-10-10 in Ethernet Chips.

Hello,

I’m trying to send a simple HTTP GET request every 5 seconds, but after 4 requests, the board hangs/crashes without giving an error. I have to reboot the board before I can work with it again. Am I creating a stack overflow or something?

I’m using the example including *urequests.py* from:

![](https://github.githubassets.com/favicons/favicon.svg) [github.com](https://github.com/Wiznet/RP2040-HAT-MicroPython/tree/main/examples/HTTP/HTTP_Client)

### [RP2040-HAT-MicroPython/examples/HTTP/HTTP_Client at main ·...](https://github.com/Wiznet/RP2040-HAT-MicroPython/tree/main/examples/HTTP/HTTP_Client)

[main/examples/HTTP/HTTP_Client](https://github.com/Wiznet/RP2040-HAT-MicroPython/tree/main/examples/HTTP/HTTP_Client)

Contribute to Wiznet/RP2040-HAT-MicroPython development by creating an account on GitHub.

```
import network
import urequests
import time
from machine import Pin, Timer

timer = Timer()

def w5x00_init():
    nic = network.WIZNET5K(machine.SPI(0), machine.Pin(17), machine.Pin(20))
    nic.active(True) # DHCP
    
    while not nic.isconnected():
        time.sleep(1)
        print('Connecting...')
    
def request(timer):
    r = urequests.get("http://192.168.178.110:8000/controllers/status/test-1")

    print('Status: ' + str(r.status_code))
    
    r.close

def main():
    w5x00_init()
    timer.init(period=5000, callback=request)

if __name__ == "__main__":
    main()
```

## Replies

### Reply 1 by Rogier, 2022-10-14

If I execute `w5x00_init()` every time before the request, the requests will continue to be executed. But we don’t want to send a DHCP request at every HTTP request to the gateway :). Static IP-addresses is a no-go too since this has to become a plug-and-play device.

### Reply 2 by Rogier, 2022-10-14

I’ve found a solution! Do a `gc.collect()` right after each request to free up some memory. Don’t forget to `import gc` at the top of your script.

### Reply 3 by jweng, 2022-10-21 (in reply to reply 2)

Thank you for replying to your own issue with a solution. This saved my bacon!

---

Source: https://maker.wiznet.io/forum/14676
