I did similar but not exactly the same. I Have a Pi 3B with a Pico W attached via USB which acts as server, a Pi 4B with Pico W attached via USB which acts as client. Both Pi are on a wired network to the router, as is my desktop PC. Both Pico W connect to the same router when running.To me what is interesting is that you said you copied my code and ran it yourself with no problems. Can you confirm you set up the testing in a similar manner to what I did?
I use Telnet to connect to my two Pi over the network. I thus have command line access to both Pi from my desktop PC. I launch and monitor the Pico W code using 'mpremote run simple_client.py/simple_server.py'. That starts MicroPython running the code and also shows what it prints; it's a sort of 'command line Thonny'.
In essence my two Pi are your two laptops / PC.
Code:
\|/ ........................ \|/ .|. .------. ____ | .---------. | | .---| Pi 3 |---|____|---' Server | Desktop |___| |---' `------' Pico W | PC | | |---. .------. ____ \|/ `---------' | | `---| Pi 4 |---|____|---' Client |_| `------' Pico W Wired / Telnet USB Wi-Fi
Me too. There are 12 potential combinations I can see -I am scratching my head some more, and yes it is starting to hurt.
Code:
.----------.----------.| Server | Client ||----------|----------|| Pi 3 | Pi 4 || Pi 3 | Pico W 1 || Pi 3 | Pico W 2 ||----------|----------|| Pi 4 | Pi 3 || Pi 4 | Pico W 1 || Pi 4 | Pico W 2 |`----------^----------'
Code:
.----------.----------.| Pico W 1 | Pi 3 || Pico W 1 | Pi 4 || Pico W 1 | Pico W 2 ||----------|----------|| Pico W 2 | Pi 3 || Pico W 2 | Pi 4 || Pico W 2 | Pico W 1 |`----------^----------'
If it wasn't for it working for me I might entertain the idea that MicroPython networking doesn't work where Python 3 networking does. But it does work for me. If we assume MicroPython and Python both work equally well that leaves us with the other notable differences -
Using Windows laptops versus using Raspberry Pi OS Pi.
Laptops on Wi-Fi versus Pi on wired.
Running through Thonny versus running through 'mpremote'.
Different routers.
Different network sub-nets.
I would discount the last two as it all works when the laptop is the client, only not when the Pico W is. But I can't easily change my sub-net to test that.
I would also discount the router blocking stuff because if it did it should be blocking 'Pico W server + Laptop client' and that wouldn't work, and I can't think of a reason it would block in one case but not another, maybe fixed-IP or pre-allocated IP versus DHCP ?
Windows versus Raspberry Pi OS ? There are differences in under-the-hood networking and the network packages but I can't see they would be that functionally different for what we are using. It would be more understandable to me if Pico W worked but Windows didn't because of some fire-walling or blocking.
Could it be Thonny ? Possible, it's presented problems in the past, but I can't see how it would in this case.
Laptops on wireless, my Pi wired ? Maybe. Could simultaneous or overlapping transmission be leading to some packets being dropped ? Are we in a situation where every retry also fails ?
I don't see there's much in your set-up which can easily be changed, except using 'mpremote' rather than Thonny to run the code. I think I can test what happens using Thonny.
Statistics: Posted by hippy — Wed Mar 13, 2024 10:29 am