When this happens everything freezes and no errors are reported in Thonny and a power cycle is required on the PICO
note that rp2_w5500_20221111_v2.0.0.uf2 will run just fine for usually weeks (my record with production code is 2-3 months with a minimum of a few days) while the W5500_EVB_PICO-20230426-v1.20.0.uf2 will run for maybe hours at most
This is all it takes:
from machine import Pin,SPI
from time import sleep,time
import network
import _thread
import dht # example hardware wiring: https://microcontrollerslab.com/wp-content/uploads/2022/02/Raspberry-Pi-Pico-with-DHT22-connection-diagram.jpg
def read_sensor():
dev=dht.DHT22(Pin(6))
dev.measure()
print("Temperature:",dev.temperature()," C; Humidity:",dev.humidity())
def enable_NIC():
spi=SPI(0,2_000_000, mosi=Pin(19),miso=Pin(16),sck=Pin(18))
nic = network.WIZNET5K(spi,Pin(17),Pin(20)) #spi,cs,reset pin
nic.active(True)
return nic
nic=enable_NIC()
_thread.start_new_thread(read_sensor,())
while True:
print('heartbeat',time())
sleep(3)
Even if you nic.active(False) before_thread is started then nic.active(True) it when _thread is completed it will still hard lock
At this time i am using W5500_EVB_PICO-20230426-v1.20.0.uf2 and have everything running using uasyncio on core 0, i would prefer to have my sensors read using core 1 but that make it unstable, this production code does not work on rp2_w5500_20221111_v2.0.0.uf2 due to issue #14 (this also affects using uasyncio urequests)
I have no issues doing this same thing using a PICO W having the second core deal with the sensors works all day every day
I suspect this is a clock de-sync issue
Hardware: W5500_EVB_PICO Firmware:
rp2_w5500_20221111_v2.0.0.uf2
When this happens everything freezes and no errors are reported in Thonny and a power cycle is required on the PICO note that
rp2_w5500_20221111_v2.0.0.uf2
will run just fine for usually weeks (my record with production code is 2-3 months with a minimum of a few days) while theW5500_EVB_PICO-20230426-v1.20.0.uf2
will run for maybe hours at mostThis is all it takes:
Even if you
nic.active(False)
before_thread
is started thennic.active(True)
it when_thread
is completed it will still hard lockHere is my upsteam report: https://github.com/micropython/micropython/issues/10448
At this time i am using
W5500_EVB_PICO-20230426-v1.20.0.uf2
and have everything running usinguasyncio
on core 0, i would prefer to have my sensors read using core 1 but that make it unstable, this production code does not work onrp2_w5500_20221111_v2.0.0.uf2
due to issue #14 (this also affects using uasyncio urequests)I have no issues doing this same thing using a PICO W having the second core deal with the sensors works all day every day