Page 1 of 1

Use a second uart or swap uart

Posted: Sat Oct 29, 2016 7:47 am
by guillaume55
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

Re: Use a second uart or swap uart

Posted: Sun Oct 30, 2016 7:30 am
by pythoncoder
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.

Re: Use a second uart or swap uart

Posted: Sun Oct 30, 2016 7:49 am
by guillaume55
Thank you for your answer