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
Update Nina-W10 driver to support firmware 1.5.0 #8654
Conversation
Standard tests results: ./run-multitests.py -i pyb:a0 multi_net/*
multi_net/ssl_data.py on ttyACM0|micropython: pass
multi_net/ssl_data.py.exp on : pass
multi_net/tcp_accept_recv.py on ttyACM0|micropython: pass
multi_net/tcp_client_rst.py on ttyACM0|micropython: FAIL
multi_net/tcp_data.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_client_rst.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_client_rst.py.exp on : pass
multi_net/uasyncio_tcp_close_write.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_close_write.py.exp on : pass
multi_net/uasyncio_tcp_readexactly.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_readexactly.py.exp on : pass
multi_net/uasyncio_tcp_readinto.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_readinto.py.exp on : pass
multi_net/uasyncio_tcp_server_client.py on ttyACM0|micropython: pass
multi_net/uasyncio_tcp_server_client.py.exp on : pass
multi_net/udp_data.py on ttyACM0|micropython: pass
16 tests performed
15 tests passed
1 tests failed: multi_net/tcp_client_rst.py ./run-multitests.py -i micropython -i pyb:a0 multi_net/*
multi_net/ssl_data.py on micropython|ttyACM0: pass
multi_net/ssl_data.py.exp on : pass
multi_net/tcp_accept_recv.py on micropython|ttyACM0: pass
multi_net/tcp_client_rst.py on micropython|ttyACM0: skip
multi_net/tcp_data.py on micropython|ttyACM0: pass
multi_net/uasyncio_tcp_client_rst.py on micropython|ttyACM0: skip
multi_net/uasyncio_tcp_client_rst.py.exp on : pass
multi_net/uasyncio_tcp_close_write.py on micropython|ttyACM0: FAIL
multi_net/uasyncio_tcp_close_write.py.exp on : pass
multi_net/uasyncio_tcp_readexactly.py on micropython|ttyACM0: pass
multi_net/uasyncio_tcp_readexactly.py.exp on : pass
multi_net/uasyncio_tcp_readinto.py on micropython|ttyACM0: pass
multi_net/uasyncio_tcp_readinto.py.exp on : pass
multi_net/uasyncio_tcp_server_client.py on micropython|ttyACM0: pass
multi_net/uasyncio_tcp_server_client.py.exp on : pass
multi_net/udp_data.py on micropython|ttyACM0: FAIL
16 tests performed
12 tests passed
2 tests skipped: multi_net/tcp_client_rst.py multi_net/uasyncio_tcp_client_rst.py
2 tests failed: multi_net/uasyncio_tcp_close_write.py multi_net/udp_data.py python run-tests.py --target pyboard net_inet/*.py net_hosted/*.py
pass net_inet/getaddrinfo.py
pass net_inet/ssl_errors.py
FAIL net_inet/test_tls_nonblock.py
FAIL net_inet/test_tls_sites.py
pass net_inet/tls_num_errors.py
pass net_inet/tls_text_errors.py
pass net_inet/uasyncio_cancel_stream.py
pass net_inet/uasyncio_open_connection.py
pass net_inet/uasyncio_tcp_read_headers.py
pass net_hosted/accept_nonblock.py
pass net_hosted/accept_timeout.py
pass net_hosted/connect_nonblock.py
FAIL net_hosted/connect_nonblock_xfer.py
pass net_hosted/connect_poll.py
pass net_hosted/ssl_getpeercert.py
pass net_hosted/uasyncio_start_server.py
16 tests performed (130 individual testcases)
13 tests passed
3 tests failed: connect_nonblock_xfer test_tls_nonblock test_tls_sites
multi_net/tcp_client_rst.py
net_hosted/connect_nonblock_xfer
net_inet/test_tls_nonblock
net_inet/test_tls_sites.py |
fe3c7c5
to
e3178fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #8654 +/- ##
=======================================
Coverage 98.22% 98.22%
=======================================
Files 154 154
Lines 20331 20331
=======================================
Hits 19970 19970
Misses 361 361 Continue to review full report at Codecov.
|
@iabdalkader I did not find information about the driver 1.5.0. Was was changed since 1.4.8, and where is the link? |
It's still a work in progress, not committed or released yet (because it may change). It's basically the same firmware but adds a proper BSD-like sockets API. let me know if you want to test it. |
Sure. I's like to test that. Your effort is very in interesting for other ports, which have already LWIP in use but no WiFi. I had a short look into the NINA code about whether it is possible (or easy possible) to implement a raw packet transport interface. But did not follow that further. |
python ~/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 115200 --before no_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0xf000 phy_init_data.bin 0x30000 nina-fw.bin 0x8000 partitions.bin
firmware: |
Thanks. I'll try to make the set-up tomorrow. |
e3178fa
to
8e50bea
Compare
The upload of the NINA firmware failed. Do I have to change the passthru script. I noticed that the default version sets a baud rate of 9600, which looks wrong. For the PC side, 115200 seems appropriate, but what about the ESP32 side? |
Try this command, note the
|
OK. There was a problem with creating SerialNinaPassthrough, but now I could upload the NINA fw. |
Great, I force pushed some more fixes here to improve timeout handling. |
So I have compiled the firmware, uploaded it and got a version v1.18-425. On boot it tells that the NINA FW is 1.5.0.
|
That's not likely because most of the tests pass. Try running the unit tests above, if all is good with the firmware and driver, you should see the exact same results. |
If you build the firmware from source, this patch in git diff components/lwip/port/esp32/include/arch/cc.h
diff --git a/components/lwip/port/esp32/include/arch/cc.h b/components/lwip/port/esp32/include/arch/cc.h
index cba0b365ea..74bf26c884 100644
--- a/components/lwip/port/esp32/include/arch/cc.h
+++ b/components/lwip/port/esp32/include/arch/cc.h
@@ -35,7 +35,9 @@
#define __ARCH_CC_H__
#include <stdint.h>
+#ifndef LWIP_PROVIDE_ERRNO
#include <errno.h>
+#endif
#include <assert.h>
#include <stdio.h>
`` |
I just can show you what's happening. If fails at socket connect, in that it immediately closes the socket again. See the Wireshark log below. I used the NINA firmware which you have sent. The RP2040 firmware is based on your PR8654 state. Maybe you are using a different RP2040 firmware. In contrast the packet sequence for a socket connect with an ESP32: |
I'm using the changes in this PR with all of the fixes to modusocket which I mentioned and SSL enabled. Does the unit tests work ? btw in #define debug_printf(...) // mp_printf(&mp_plat_print, __VA_ARGS__) |
Most of the unittests fail. So most likely the RP2040 binaries are different. Do you build your binary from your nina_fw_1.5.0 branch? |
I build the firmware in branch that cherry-picks the nina_fw_1.5.0, and all of the fixes in #8658 and SSL support in #8651 Are you connected on boot ? I have this in import network
SSID=''
KEY=''
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, KEY) |
OK. I did not add the modusocket changes (yet). |
Adding the commits from #8658 changed the picture. Now my little script only complains about missing the method sendall(). But using send instead works. Speed is about 60 kb/s. A simple ftp server works. The uftpd misses the option 20 for SOL_SOCKET, where a handler can be registered for socket connect events. That one is used for webrepl. |
Yeah I know, I mentioned that in my first comment. I'm working on something might be able to support it for webrepl.
I run tests against micropython in |
I have a fix for the missing socket callback (sockopt 20) which fixes both |
So how do you set the test up? Do you simply run the test scripts from the command line? |
Sounds good. |
Build MicroPython in |
These commands work with CPython, but not with micropython. |
I did not add the SSL PR yet. With that, the result from the first test set is identical, for the second test I get:
For the last test I get a full fail:
|
@robert-hh I don't think you have all of the required changes for some reason, maybe something is out of sync, so it might be a good idea to just start over from scratch by pulling this PR (there should be 3 commits now), along with all the commits in modusocket fixes (which now include a needed fix for sockopt 20) and the SSL support PR (a lot of tests depend on SSL), and webrepl PR if you want to test it. Alternatively you can just try the attached firmware which I just built with everything enabled. If it helps, here's the list of commits I have cherry-picked in a local testing branch:
Note for your second test run, it looks like the board is Not connected. I usually have a With the firmware attached, I tested |
Looks fine now. I had the network connect in main.py, not boot.py Moving it to boot.py changed the picture.
|
I think raw repl doesn't run |
These work fine. The problem with the pye editor also disappeared magically. |
It was the same issue with sockets poll list getting collected. |
ecf64aa
to
c818d76
Compare
FYI I switched to system error numbers in nina-fw due to an issue with some of the |
c818d76
to
bf206ae
Compare
bf206ae
to
d680a3d
Compare
Rebased on latest changes. |
d680a3d
to
ffb61c4
Compare
7aaa377
to
f6346cd
Compare
* Internal errno can't be used with Nina module due to an issue with esp-idf config.
* Firmware 1.5.0 introduces a new BSD-like sockets ABI, which improves the integration with MicroPython.
f6346cd
to
448359c
Compare
Note the linked issues should be fixed, after updating the firmware. |
Depends on the following PR(s):
Fix the following issue(s):
Testing:
webrepl
(foreground and background modes).microdot
(sync and aysnc modes).uping
,ufptd
andutelnetserver
.