-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Ninaw10 driver fixes #8138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ninaw10 driver fixes #8138
Conversation
c179ff3
to
27951a0
Compare
Hi @iabdalkader Thank you for making the changes. I can confirm, that
What still is strange from our discussion:
|
For some reason TCP/UDP sockets must be connected/bound first before setting a timeout on the socket. That's an issue in modusocket.c here: https://github.com/micropython/micropython/blob/master/extmod/modusocket.c#L320 I'm not sure why it's like that. Can you comment on this @dpgeorge ?
How to reproduce this ? |
a) run a script from REPL which connects the device to a AP.
At my build of the nano-connect, that raises: Traceback (most recent call last): |
It doesn't fail.
|
Try putting the AP connection in a separate file (not pasting from REPL) and import that file. Then try getaddrinfo() from REPL. |
I did, I put the connect code in MPY: soft reboot
MicroPython v1.17-287-g27951a02a-dirty on 2022-01-04; Arduino Nano RP2040 Connect with RP2040
Type "help()" for more information.
>>> wlan.active()
True
>>> import socket
>>> socket.getaddrinfo("pool.ntp.org", 123)
[(2, 1, 0, '', ('162.159.200.1', 123))]
>>> |
What id you to that into a separate script, which you manuallly importd from REPL or import from main.py? I typically use such a script, which is called from main.py. e.g.
|
The difference: edit: using wlan.ifconfig() after the wlan.connect() also causes the fail. |
Okay so the actual issue is in ifconfig not where WLAN is called, I'll look into it, it could be a firmware bug. |
Confirmed it's a bug in the firmware, setting DNS breaks name resolution, I have an Arduino sketch that reproduces the issue if you want it. I can't fix this bug but I'll report it upstream. |
* The wrong ACK is returned and checked. * Send secondary DNS to google.
@robert-hh Found a bug in my code, which breaks DNS, it's fixed and a secondary DNS is set too.. See latest commit. There's still an issue with the firmware, but it does Not affect my driver. |
So you say that the issue with ifconfig() is still present. The code builds fine. Which changed behavior should I see? |
No I'm saying it's fixed. |
Confirmed. Somehow building did not work the first time. So I started over from scratch by pulling the PR again. |
That's because it doesn't have a NIC bound yet to the socket. If If there are multiple NICs (eg WiFi and ETH) then how can it set the timeout before knowing which NIC to bind to? The NIC to bind to is determined when the IP address of the destination is known. This is the main drawback of using this Possible solutions:
Option 1 is easier. If you work on this, please do it separate to this PR. |
How about if NIC is NULL store the timeout in socket object ?
Understood, this PR is done anyway. |
That would mean that when the NIC is created/bound it would need to configure the socket with the timeout value stored in the socket object, right? As well as implementing its own settimeout slot. That sounds ok. |
It's possible, in |
Yes that sounds like a good approach. |
Following a discussion in #7668 a few small fixes and improvements: