Open peterhinch opened 9 years ago
I believe that pyboard.py has an issue trying to enter the raw-repl if your boot.py script prints anything. https://github.com/micropython/micropython/issues/1491
So I guess the first thing to do would be to verify that you can use pyboard.py with your WiPy. If pyboard.py doesn't work, then rshell won't work. I should mention that in the docs.
I should probably see if pyboard.py can be fixed properly.
Hmm. I added support in rshell for connecting to multiple pyboards. As a consequence if you run rshell with no arguments, it will autoconnect to pyboards. I think I may have forgotten to add a connect command for telnet (should be easy to fix though).
Can you try pass -p IP-address when you invoke rshell?
I'll see about printing a better error message if no boards are connected. There is a boards command which lists all of the connected boards.
I'm short of time until tomorrow when I'll test the USB and pyboard.py. This was the outcome of a brief test using telnet. I modified boot.py by commenting out all the print statements and did a reset via telnet.
[adminpete@axolotl]: ~/qnap/python/rshell
$ telnet 192.168.0.100
Trying 192.168.0.100...
Connected to 192.168.0.100.
Escape character is '^]'.
MicroPython v1.5-1-ge954604 on 2015-10-21; WiPy with CC3200
Login as: micro
Password:
Login succeeded!
Type "help()" for more information.
>>> import machine
>>> machine.reset()
Connection closed by foreign host.
[adminpete@axolotl]: ~/qnap/python/rshell
$ ./rshell.py -p 192.168.0.100
Connecting to ip 192.168.0.100
Connecting to (192.168.0.100) ...
Welcome to rshell. Use Control-D to exit.
/mnt/qnap2/python/rshell> boards
pyboard @ 192.168.0.100 connected
/mnt/qnap2/python/rshell> repl
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "./rshell.py", line 1533, in repl_serial_to_stdout
save_timeout = dev.timeout()
File "./rshell.py", line 1009, in timeout
return self.pyb.serial.timeout
AttributeError: 'TelnetToSerial' object has no attribute 'timeout'
So it connects if I specify the IP, but I can't get a working REPL.
Bah - figures - I tested lots of other things and forgot repl!
I also just pushed a bunch of other changes. I'll fix the repl issue today.
ok - the repl on the wipy should work properly now. You can also connect over telnet after starting rshell by using 'connect telnet hostname' or 'connect telnet ip-address'.
The boards command will show whatever boards are currently connected. If you're connected to multiple boards you can copy files from one board to the other.
USB serial to the wipy still doesn't work (at least copying files to the wipy doesn't work). i think I have an idea how to fix it, but it will need some more investigation.
REPL on the wipy is now fine, and file copy works in both directions. I got no joy from 'connect telnet ip-address' but I'm unclear why you'd want to do this, given the options of running the REPL or running a Telnet session direct from the terminal. For the sake of completeness this is the outcome when I try it
[adminpete@axolotl]: ~/qnap/python/rshell
$ ./rshell.py -p 192.168.0.100
Connecting to (192.168.0.100) ...
Welcome to rshell. Use Control-D to exit.
/mnt/qnap2/python/rshell> connect telnet 192.168.0.100
Connecting to (192.168.0.100) ...
No response from 192.168.0.100
/mnt/qnap2/python/rshell>
You can use the connect command to connect to multiple wipy's or pyboards at the same time.
For the following example, I'll start rshell which will auto-connect to the pyboard. Then I'll use the connect telnet command to connect to the wipy, and finally copy a file from the pyboard to the wipy.
2881 >rshell.py
Connecting to /dev/ttyACM0 ...
Welcome to rshell. Use Control-D to exit.
/home/dhylands> boards
pyboard @ /dev/ttyACM0 connected
/home/dhylands> connect telnet wipy
Connecting to wipy (192.168.0.63) ...
/home/dhylands> boards
pyboard @ /dev/ttyACM0 connected
wipy @ wipy (192.168.0.63) connected
/home/dhylands> ls /pyboard/flash
atomic.py bioloid.py boot.py chess.py main.py receiver.py README.txt pybcdc.inf
/home/dhylands> ls /wipy/flash
cert/ lib/ sys/ boot.py main.py wlan.py wlan_dhcp.py wlan_static.py test.txt upy-cdc.txt
/home/dhylands> cp /pyboard/flash/atomic.py /wipy/flash
/home/dhylands> ls /wipy/flash
cert/ lib/ sys/ atomic.py boot.py main.py wlan.py wlan_dhcp.py wlan_static.py test.txt upy-cdc.txt
/home/dhylands> repl pyboard
Entering REPL. Use Control-X to exit.
>
MicroPython v1.5-164-gb030871-dirty on 2015-11-20; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>>
>>>
/home/dhylands> repl wipy
Entering REPL. Use Control-X to exit.
>
MicroPython v1.5-2-g126373a on 2015-11-16; WiPy with CC3200
Type "help()" for more information.
>>>
>>>
/home/dhylands>
You can put a board.py file in the boards filesystem and put a line like this in it:
name = 'foo'
and then when you use the boards command it will show as that name instead of wipy or pyboard. rshell just does an import board, so board.py can be anywhere in the seach path.
When you use /flash or /sd it refers to the filesystem on the first board. You can use /board-name/flash or /board-name/sd to get to an arbitrary board.
repl with no arguments connects to the first board. repl board-name connects to the indicated board.
Trying to connect to a Wipy while you're already connected will fail (since the wipy only supports one connection) which is what you were seeing above.
It works well with the Pyboard but I can't connect to the WiPy either wirelessly or via the expansion board USB. My main.py is just a single line comment. boot.py is
Firstly, wired connection. Demo that hardware is OK - successive connections using Miniterm:
Now trying using rshell: evidently some connectivity is occurring, then it falls over. alias wipy='/mnt/qnap2/python/rshell/rshell.py -p /dev/wipy'
Wireless connectivity: successive telnet sessions
Now trying rshell