Wi-Fi functions
-
Hi all,
I am a Ph.D. student in telecommunications and for my research, I am planning to use the FiPy.
Until now, I used to work with an ESP8266 programmed in C. The cool thing of the FiPy, is that I can use Micro Python and that it has all the wireless interfaces I need in a very compact package.
The problem is that I need to access the following functions from the ESP32 API:esp_err_t esp_wifi_80211_tx(wifi_interface_tifx, const void *buffer, int len, bool en_sys_seq)
esp_err_t esp_wifi_scan_start(constwifi_scan_config_t *config, bool block)
I am willing to rebuild Micro Python myself, but I need some guidance on how to do it without breaking the current release, so that I don't lose access to the other modules.
What I need to do is:
-
Modify the WLAN.scan() function to accept a few parameters (the channel that I need to scan and the time to be spent per channel).
-
Add a function to send "free" beacons (I need it for my custom MAC protocol).
Can anyone help me with this?
The scan function is this one, STATIC mp_obj_t wlan_scan(mp_obj_t self_in) , at line 743 of modwlan.c.
The other one is not used anywhere (or at least I cannot find it), so I may very well write my own.- What I do not understand is, once I modify the C code, how do I link it to Micro Python?
- Where is the Micro Python source code? (except on the website of Micro Python).
- (as an alternative) Can I build a "standard" Micro Python with my custom C code and then add the missing libraries to make the FiPy work?
- Is anyone interested in having the final result (or cooperate with me)? My code will be open source anyway when it will be complete.
-
-
@ingframin Did you manage to modify the firmware? I would like to have a Wi-Fi advertising per 100 milliseconds; default LoPy-4 seem to send an advertising only if requested by a station.
-
@jcaron Yes, and it works!
Now I am trying to figure out where to put my module.
In the ESP8266 version there is a file called ESP8266.ld which contains the list of C files.
Where is the equivalent for ESP32? If there is no equivalent, what shall I look for?
-
@ingframin Good luck. Feel free to post any querys here and ill get them answered ASAP.
-
Thanks for pointing me in the right direction. I am looking at the documentation of MicroPython at the moment and trying to build the environment without adding anything.
I have some troubles with the xtensa kit, but I can figure out myself what's missing.
I decided however, not to modify the standard library but to add my own module.
It seems simpler and does not disrupt what is already there.
Also, I don't want to risk to brick the modules.
I'll post updates here when I am through with the build process.
-
@ingframin The source code is here https://github.com/pycom/pycom-micropython-sigfox
Including instructions to set up the build environment. Follow the instructions carefully.
-
@ingframin Have you already tried rebuilding the firmware from source, without any modifications, and flashing that new firmware to the board?