FiPy, uart
-
Hello, I am using FiPy and tried to transfer some data from the FiPy to the PC via serial communications. In the Atom IDE I can see the output information (e.g., by print function), so I guess the serial communications is working properly. However, when I tried to use Putty to open the serial port, it failed to do so. I also tried to use Matlab to open and read the serial port but had no luck.
The relevant code that I used is
from machine import UART uart = UART(1, 115200) # init with given baudrate uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters uart.write('hello')
I followed instruction from the two links below.
https://docs.pycom.io/gettingstarted/programming/repl/serial.html
https://docs.pycom.io/firmwareapi/pycom/machine/uart.htmlCould anyone give me some help here? Many thanks.
-
@justin said in FiPy, uart:
@robert-hh Silly me. I wasn't aware that the port can only be opened by one software.
You can have a second REPL output by telnet over WiFi. The default account/password is micro/python. But you have to open a new connection after each deepsleep call.
And yes, as soon as you configure WiFi this default account exists. So don't forget to set other login credentials, if you deploy your stuff.
-
@robert-hh Silly me. I wasn't aware that the port can only be opened by one software.
-
@justin Yoo have to close Atom, to get access with Putty. And in Putty, you have to disable flow control.
-
@robert-hh Thanks for your instruction. I have changed the code as
uart = UART(0, baudrate=115200) # init with given baudrate uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters
I can see the information in the output window of Atom, but I still cannot use putty to access the port.
-
@justin The UART used for REPL (and thus for the serial connection to Atom) is UART0, connected to the pins P0 and P1. You skript uses UART1, which is connected by default to P3 and P4.
If you want to send data through UART0, use print() or sys.stdout.write()