cancel
Showing results for 
Search instead for 
Did you mean: 

Where is the documentation about micro Python methods located?

Konstantinos Ifantidis
Associate II

Posted on January 31, 2018 at 13:59

Hello,

I'm trying create a script in uPython in order to get control of the wifi module SPWF04SA/SC. I have successfully updated FW and FS via UART and right now I'm using RELP via UART to test out some code. 

Can someone tell me where i can find the syntax of methods/commands/libraries/etc gathered?! I have been to

http://docs.micropython.org

 and also at the

https://github.com/micropython/micropython-lib

 but i can't find any details for uPython commands. 

Request: Is it possible someone to provide me with a mini script example with these:

1.Turn on Wifi radio

2. Scan for networks

3. Connect to a network with WPA2

Regards, Kostas.

3 REPLIES 3
Elio Cometti
Senior II
Posted on February 06, 2018 at 11:31

WLAN.STA.py script from SPWF04's filesystem can be taken as an example.

The file is also available from FW 1.1.0 package

http://www.st.com/content/st_com/en/products/embedded-software/wireless-connectivity-software/stsw-wifi004.html

Konstantinos Ifantidis
Associate II
Posted on February 13, 2018 at 16:13

Thank you mr.Cometti for your reply. I have already read example WLAN.STA.py but i would like to have some more details. I'm new in Python and i am not familiar with it. So i need some details.

>>> import network

>>> w= network.WLAN()

>>> help(w)

object <WLAN> is of type WLAN

init -- <function>

connect -- <function>

disconnect -- <function>

isconnected -- <function>

ifconfig -- <function>

mode -- <function>

ssid -- <function>

auth -- <function>

channel -- <function>

scan -- <function>

start_wps -- <function>

peers -- <function>

idle -- 0

STA -- 1

AP -- 3

IBSS -- 2

WEP -- 1

WPA -- 2

WPA2 -- 2

How am i supposed to use connect function (and every other function) ?

Where is the documentation for using it (and every other function/ method)??

I can not understand the help() function and its returns/answers at all. I have searched through the web, micropython.org and of course the AN4964 but still I can't figure this out. Also i have problem setting on and off the wifi radio as i please with uPython. Is it possible to use all AT+... commands via the uPython ? and if there is... how can someone achieve this? 

Next:

I have used w.ssid('popo') and i get that w.ssid get's a string for input but when i'm trying to add the w.auth() i get an error. 

w.auth(WLAN.WPA2,'1234asdf')

i get this as an answer: 

>>> w.auth(WLAN.WPA2,'1234asdf')

Traceback (most recent call last):

File '<stdin>', line 1, in <module>

TypeError: object 'int' is not a tuple or list

I've tried to add a tuple or list but i had no luck. Is it possible to explain in more detail? 

Best Regards, Kostas.

Nick Thodey
Associate
Posted on June 07, 2018 at 08:01

While I appreciate the examples provided, there seems to be a complete lack of python documentation for this module. Or at least, I can't find it.

How do I turn off wifi from my python script? How do I control the various low-power modes? How do I perform a firmware update? Why is there a big lab demo document that shows all this from AT commands only? What's the point of the python mode if not to be able to use this module without an external uC sending AT commands? Why is the micropython version in the closed firmware SO old?

A nice piece of hardware but I fear it's going in the big box of other nice pieces of hardware that I just can't use.