earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 boards
GNU Lesser General Public License v2.1
1.92k stars 402 forks source link

Hang with Pico W when using a W5500 and WiFi at the same time. #2156

Closed earlephilhower closed 3 months ago

earlephilhower commented 3 months ago

Discussed in https://github.com/earlephilhower/arduino-pico/discussions/2149

Originally posted by **rpineau** May 7, 2024 Fisrt some background : I have a system where a "rotator" Arduino Due controls an observatory dome and a "shutter" Arduino Due which control said dome shutter. The "rotator" arduino due use a W5500 to connect to the local network and both Due communicate with each other using XBee modules: Local network <----> [W5500/Rotator Due/XBee] <-----> [Xbee/Shutter Due] I'm now working on replacing these with Raspberry Pi Pico W and want to use the WiFi connection to replace the XBees. I ported the code to the Pico W. Core 0 is for communications (Ethernet, WiFi and serial) and Core 1 takes care of the motion (it drives stepper motor using the AccelStepper library) : Local network <----> [W5500/Pico W/WiFi] <-----> [WiFi/Pico W] The problem(s): When disabling WiFi on the "rotator", Ethernet works fine and all is good. But as soon as I want to add WiFi problems starts and the WiFi connections between the 2 Pico W keeps failing. It also seems to create some timeout on the W5500 side (pinging the "rotator" Pico W from a machine starts failing). To try to figure out the issue I made 2 small test firmware that only use the ping function. As far as I can tell the issue comes from the Pico W that also has the W5500 . After a bit of time it locks up in the wifi ping function. I also try with just WiFi between the 2 Pico W. This is more stable but I see a lot of drops at the beginning and then latter on (not repeatable timing as far as I can see). So the question is .. Am I doing something wrong or is this a "bug" and the Pico W can't do Ethernet and WiFi at the same time ? The test code can be found there : https://rti-zone-files.s3.amazonaws.com/test-rp2040.tgz Thanks for any insight. Rodolphe