I’m playing with a H7 and trying to stream around 5kbps over WiFi with the H7 setup as an AP.
I’m using the WiFi.h library and have set it all up according to the example.
Issues seem to be that the network throughput is extraordinarily slow compared to much older boards.
-Receiving 350kb of data to it takes ~35 seconds. This should be blisteringly fast.
-The first packet of only 33bytes I send when the client.connected is set, only arrives about 60% of the time at the other end. I also tried sending an 8byte array which shows no difference in speed or reliability. Weirdly, even after that packet mostly fails, subsequent packets all make it reliably.
The client is a mac with code that runs perfectly and reliably with other boards.
It seems that the buffer getting bytes in and out of the H7 WiFi is coated with syrup. Sometimes the bytes don’t even arrive until 5 or 10 seconds after sending from the board.
Specific question before diving into code level stuff:
-Has anyone else experienced this with the H7?
-Is the WiFi.h library the wrong one to be using and there’s a better/faster one that should be used?
-Is it better to try and use the mbed api to replace the WiFi library?
-Are there special/extra configurations and/or methods that should be used to grease up the buffer that are not detailed in the examples?
Thanks kindly for any input with experience or advice on how to deal with this.
I did find a previous report of something like that:
It turned out that there was a bug in a very old version of the library that had been fixed, but the user was still using the old version of the code from before the fix.
That was years ago, so I wouldn't expect that the old bad code is as likely to be in use in the wild now as then when the fix was still pretty recent and thus not propagated well through the Arduino ecosystem, but maybe it is worth checking anyway.
You can check which versions of the libraries are being used by your sketch by doing this:
Open your Wi-Fi sketch in Arduino IDE.
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
Click the "OK" button.
The "Preferences" dialog will close.
Select Sketch > Verify/Compile from the Arduino IDE menus.
Wait for the compilation to finish.
Now examine the contents of the black "Output" panel at the bottom of the Arduino IDE window. You might need to scroll it up to see all the relevant content. There you will see a summary of the libraries that were used when compiling your sketch. For example:
Using library WiFi at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\4.1.5\libraries\WiFi
Using library SocketWrapper at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\4.1.5\libraries\SocketWrapper
Here we can see that the "WiFi" library that was used is the one that is bundled with the installation of the "Arduino Mbed OS Portenta Boards" platform version 4.1.5. That is the latest available version of the "WiFi" library for the Portenta H7 board, and so is definitely not subject to the problem reported at the issue I mentioned above.
I'm arbitrarily focusing on the "WiFi" library here for the sake of keeping the example simple, but you should also examine the information about any other relevant libraries used by your sketch, since the origin of the problem might be in one of them instead of in "WiFi"
However, when you look at your compilation output you might see something different in your output, such as:
Outdated Platform Bundled Library
Maybe you have an older version of the boards platform installed, and the outdated "WiFi" library bundled with that older platform is being used.
In this case, you would see a different version number in the path of the library when you examine the verbose compilation output, such as:
Using library WiFi at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed\3.3.0\libraries\WiFi
(note the "3.3.0" instead of "4.1.5")
Outdated or Alternative Standalone Library
Maybe you have a standalone installation of the "WiFi" library, and that installation is being used instead of the library bundled with the "Arduino Mbed OS Portenta Boards" platform.
In this case, you would see that multiple candidate libraries were identified by the sketch build system, with the chosen one having a path not under the "Arduino Mbed OS Portenta Boards" platform. For example:
Multiple libraries were found for "WiFi.h"
Used: C:\Users\per\Documents\Arduino\libraries\WiFi
Not used: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\4.1.5\libraries\WiFi
Using library WiFi at version 0.2.3 in folder: C:\Users\per\Documents\Arduino\libraries\WiFi
Using library SocketWrapper at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\mbed_portenta\4.1.5\libraries\SocketWrapper
Here you can see that I have a standalone installation of the "WiFi" library and that was used when compiling the sketch instead of the latest version of the library bundled with the "Arduino Mbed OS Portenta Boards" platform.