How to update code files after connecting to WLAN ?

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
rodrigob
Posts: 15
Joined: Sun Aug 30, 2015 7:41 am

How to update code files after connecting to WLAN ?

Post by rodrigob » Thu May 19, 2016 3:34 pm

Just received my wipy board, and trying to setup the code inside.

The micropython board behaves as a disk when connected. Updating its code is as simple as drag and drop.
The default wipy behaviour also makes it easy to drag and drop files, via ftp this time.

According to
https://docs.pycom.io/wipy/wipy/tutorial/wlan.html

when configuring boot.py to instead connect to a wifi network (instead of serving an access point) the only way to communicate to the wipy board is via an USB repl.

What is supposed to be the code update cycle then ?
I should every time connect USB, connect via USB, use repl to change WLAN configuration, and only then being able to update the code ?!
This seems very cumbersome. How do I test and debug an application that requires the wipy to connect to a WLAN network ?

Seems like the static IP is the only way to go, what if I need the wipy to connect to different networks ?
(so I cannot have a static IP / dns configuration)

Why does the board does not support the same "looks like a disk when connected", like the micropython board does ?

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: How to update code files after connecting to WLAN ?

Post by deshipu » Thu May 19, 2016 4:39 pm

rodrigob wrote:Why does the board does not support the same "looks like a disk when connected", like the micropython board does ?
Because the board itself has no USB port, because that microcontroller doesn't support it. The USB connection you have there is done through a separate chip in the dock, that translates the USB signal into UART signal to talk with the board.

However, you should be perfectly fine upgrading the code over FTP, no matter if the board is acting as an access point or connected to your home WiFi. If you want it to try to connect to several different networks, I guess you need to write code that tries them all.

Finally, you can simply define a function in boot.py that takes the name and password of the network as the argument, and call that while connected in the AP mode. Since it's just a single line, it will get executed while you are disconnected, and then you can reconnect when the board comes online.

rodrigob
Posts: 15
Joined: Sun Aug 30, 2015 7:41 am

Re: How to update code files after connecting to WLAN ?

Post by rodrigob » Thu May 19, 2016 5:44 pm

But what worries me, is that if, for any reason, the wifi connection fails or get stuck; I cannot fix/update the code anymore.
Seems like an easy path to have a "bricked wipy".

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: How to update code files after connecting to WLAN ?

Post by deshipu » Thu May 19, 2016 6:21 pm

rodrigob wrote:But what worries me, is that if, for any reason, the wifi connection fails or get stuck; I cannot fix/update the code anymore.
Seems like an easy path to have a "bricked wipy".
No, you can always boot it in recovery mode, then it acts as an access point again, because it ignores boot.py.

rodrigob
Posts: 15
Joined: Sun Aug 30, 2015 7:41 am

Re: How to update code files after connecting to WLAN ?

Post by rodrigob » Thu May 19, 2016 7:13 pm

I see
https://micropython.org/resources/docs/ ... neral.html

not super convient, but at least it avoids disaster.

Post Reply