Use a second uart or swap uart

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
guillaume55
Posts: 2
Joined: Fri Oct 28, 2016 5:46 pm

Use a second uart or swap uart

Post by guillaume55 » Sat Oct 29, 2016 7:47 am

Hi,
I have a nodeMCU and I need a second uart (one at 115200 for the communication with the PC and the second for the communication with a GPS at 9600 baud). I don't know if I can connect the PC (with CP2102) and the GPS on the same bus (If I change the baudrate).

I can't find how to swap the uart 0 pins in micropython and If I can change the baudrate when I swap (and quickly) or If I can use a software uart (bit bang?) like in Lua or arduino.
Thanks
Guillaume

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Use a second uart or swap uart

Post by pythoncoder » Sun Oct 30, 2016 7:30 am

You can't connect three devices to one UART. In normal 8 bit mode UARTS are strictly point-to-point devices. Worse, the ESP8266 has only one proper UART. The second is transmit only. Both are subject to transmitting junk when the ESP starts up. Also debug messages although these can be suppressed. As you suggest the answer is a software UART but as far as I know nobody has written or ported one to the ESP8266. It's a moot point whether a software UART could achieve 115200 baud on the ESP, given that it has an underlying RTOS. I don't think high performance is achievable in Python, it would need to be written in C but in any case we won't know what's achievable until someone does it.
Peter Hinch
Index to my micropython libraries.

guillaume55
Posts: 2
Joined: Fri Oct 28, 2016 5:46 pm

Re: Use a second uart or swap uart

Post by guillaume55 » Sun Oct 30, 2016 7:49 am

Thank you for your answer

Post Reply