"Place this piece of code inside your boot.py"

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
mnelsoneorm
Posts: 14
Joined: Wed Jul 20, 2016 4:53 am

"Place this piece of code inside your boot.py"

Post by mnelsoneorm » Wed Jul 20, 2016 5:14 am

Docs seem to be lacking a very basic instruction that noobs really need in order to get this board going: "Place this piece of code inside your boot.py" - HOW????? This seems insane to me that this very important step doesn't seem to be documented anywhere.

I am beyond frustrated with this board and the number of times I have had it get stuck and I have to start all over again at connect to the 192 network, then telnet, then get serial over USB going, then get on the correct wireless network.......so is the only way to change the boot.py to upload it via FTP? I saw someone else asked the same question and got no answer. Sorry if I'm being impatient here but I've been banging away on this for 4 hours now and am no further along. I haven't had this much trouble getting other boards going (many Adafruit boards, raspberry pi, arduino....).

torwag
Posts: 217
Joined: Fri Dec 13, 2013 9:25 am

Re: "Place this piece of code inside your boot.py"

Post by torwag » Wed Jul 20, 2016 4:22 pm

Hi,

I know it can be frustrating sometimes, but hey therefore, we have forums ;)
If I understand you right, you reconfigured your wipy board and thus, if you need to change something in the boot.py you have first to reconfigure it back to the standard settings to enable FTP access? Right?

And know you are looking for a way to access boot.py without having FTP access? Can you still access the board via serial connection?

mnelsoneorm
Posts: 14
Joined: Wed Jul 20, 2016 4:53 am

Re: "Place this piece of code inside your boot.py"

Post by mnelsoneorm » Wed Jul 20, 2016 5:37 pm

I can get to the board either thru the uart or telnet. I really just want to add the uart setup commands to the boot.py (or better yet, wifi setup and UART) but I'm not finding any documentation on editing that file. It seems like this should be a simple task....maybe too simple so nobody's bothered to document it. I see no instructions for how to "Place this piece of code inside your boot.py". It's not that FTP cannot be used here. I'm wondering if that's the only way to go about it? Things like this: https://github.com/wendlers/mpfshell give me hope that the board may be more useful once set up. What I mean by "set up" or to "get it going" is that it should be possible to set up the board so that it can be rebooted and then immediately be available to reconnect to it without re-configuring via telnet to the 192.168 address. The repl is great for testing some stuff but there's too many steps involved in getting the board on my network every time I start it up. It seems like most of the documentation revolves around continuing to use the default 192.168 network.

Anyway, it all comes down to how do I "Place this piece of code inside your boot.py".? What are the options for making changes to that file?

User avatar
dhylands
Posts: 3301
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: "Place this piece of code inside your boot.py"

Post by dhylands » Wed Jul 20, 2016 8:01 pm

You can use ftp to grab the file, edit it on your local computer and use ftp to put it back.

You can use rshell https://github.com/dhylands/rshell, and probably (mfpshell - I haven't personally tried mfpshell so I don't know if it works with WiPy or not).

If you're going to use rshell over the uart, then I'd recommend using the --buffer-size=32 argument. You can also use rshell over telnet. You can specify the ip address to telnet to by using

Code: Select all

rshell -p ip-address
My WiPy has the following in boot.py (for setting up the uart):

Code: Select all

import machine

from machine import UART
import os
uart = UART(0, baudrate=115200)
os.dupterm(uart)

def cat(filename):
    with open(filename, 'rt') as f:
        for line in f.readlines():
            print(line, end='')
            
if machine.reset_cause() != machine.SOFT_RESET:
    import wlan_static as wlan
    wlan.set()
I use the cat function as a convenience for verifying file contents when not using rshell.

I posted my setup for Wifi connection over here: http://forum.micropython.org/viewtopic. ... 7384#p7384

mnelsoneorm
Posts: 14
Joined: Wed Jul 20, 2016 4:53 am

Re: "Place this piece of code inside your boot.py"

Post by mnelsoneorm » Wed Jul 20, 2016 8:47 pm

Ah, thank you, and thank you for your patience with my impatience :) . Will try tonight when I get home from work.

mnelsoneorm
Posts: 14
Joined: Wed Jul 20, 2016 4:53 am

Re: "Place this piece of code inside your boot.py"

Post by mnelsoneorm » Thu Jul 21, 2016 5:39 am

@dhylands - awesome! Works! UART and wifi on boot. I need to give that rshell a try as well.

Still found Win10 painful to use (no surprise haha) while getting started so I switched to using a pi3/Raspbian and that was much easier to use. FTP works directly from the filemanager and it has a python IDE built in so it's as easy as drag out, edit, drag in.

Thank you again sir!

Post Reply