Getting a REPL prompt via UART instead of via USB
Getting a REPL prompt via UART instead of via USB
I am trying to untether from my laptop and run the pboard over a serial UART signal. I am building an embedded data acquisition system, using the pboard. I have created a serial to VGA board and I will use that to display data, just need access to the REPL prompt. Can't find any information on the micro python.org site. Please help me. I think I should be able to redirect the REPL to one of the UARTs. I am currently using UART(3,9600) to connect to my terminal.
Re: Getting a REPL prompt via UART instead of via USB
For PyBoard, use pyb.repl_uart. An example is here: http://docs.micropython.org/en/latest/p ... =repl_uart
or os.dupterm()
or os.dupterm()
Code: Select all
from pyb import UART
import os
uart = UART(0, baudrate=115200)
os.dupterm(uart)
Re: Getting a REPL prompt via UART instead of via USB
Thank you. I can get it to work from the USB REPL but when I put it into boot.py or main.py it doesn't work. What am I missing?
Re: Getting a REPL prompt via UART instead of via USB
You probably have an error in the script someplace.
Try renaming the script to foo.py and then from the REPL do: that will typically show you your error.
Try renaming the script to foo.py and then from the REPL do:
Code: Select all
import foo
Re: Getting a REPL prompt via UART instead of via USB
"bar" might also workdhylands wrote:...
Try renaming the script to foo.py and...
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Getting a REPL prompt via UART instead of via USB
I use the following boot.py (which disables USB). Adapt for your UART and baudrate:
Code: Select all
import pyb
pyb.usb_mode(None)
uart = pyb.UART(2, 115200)
pyb.repl_uart(uart)
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.