Using the tx/rx pins not for UART

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Using the tx/rx pins not for UART

Post by deshipu » Tue Apr 19, 2016 9:22 pm

As usual, I'm getting ahead of what is available right now, but that's mostly due to excitement -- I'm planning my future projects using Micropython. And I'm wondering whether it's reasonable to assume that I will be able to use the rx and tx pins as normal gpio pins, or, say, i2c or spi pins.

The eight "regular" pins on the ESP8266 is quite a lot for most uses, but it's still much fewer then 20-something on the arduino or similar boards. So it becomes important to conserve the pins. With webrepl available, the hardware serial console, while still useful and needed in most projects, could be probably disabled, freeing two additional pins.

Now, the way things work right now, it doesn't seem like it's possible to just disable the uart. Not only the console doesn't stop when webrepl is started, but also there is a lot of debugging and system stuff being output there. So my question is more about the future -- is the ability to disable the uart and reclaim the two pins for other purposes planned?

The answer would let me plan accordingly and already order the PCBs.

Photon Peddler
Posts: 7
Joined: Tue Jul 08, 2014 5:30 pm
Location: Connecticut, USA

Re: Using the tx/rx pins not for UART

Post by Photon Peddler » Sat Apr 23, 2016 11:02 pm

Hear hear! Except, I would like to use the UART pins as UART pins, but without the REPL.

I'm going to connect an ESP-01 module to a serial camera module. Problem right now is, there are Control-C characters (0x03) in the binary data returned by the module. This is interpreted as a KeyboardInterrupt by the REPL, causing the program to stop.

(Thank you to whoever enabled BBCode for my account!)

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Using the tx/rx pins not for UART

Post by deshipu » Sat May 07, 2016 12:54 pm

By the way, related to this, if those pins can be used for something else than UART in the future, would there also be a chance to enable PWM for them?

Almoturg
Posts: 10
Joined: Sat May 07, 2016 6:06 pm

Re: Using the tx/rx pins not for UART

Post by Almoturg » Sat May 07, 2016 6:11 pm

I am also interested in disabling the REPL over UART. I would like to use a serial controlled e-Paper display.

haemish
Posts: 1
Joined: Thu May 12, 2016 8:53 am

Re: Using the tx/rx pins not for UART

Post by haemish » Thu May 12, 2016 9:05 am

Hi,

I am very excited about this whole development and I realise it is very early days but I would agree with this entire thread. I need to be able to disable the REPL and use the UART as a true UART.
When interfacing to any other board (or in my instance to a camera) I need to be able to communicate over the UART.

Any development on this?

EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

Re: Using the tx/rx pins not for UART

Post by EasyRider » Tue Jul 12, 2016 2:15 pm

BUMP.
I am also interested in disabling the REPL over UART
Need to free UART for other application.
Any development on this?
Regards

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Using the tx/rx pins not for UART

Post by deshipu » Tue Jul 12, 2016 2:20 pm


EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

Re: Using the tx/rx pins not for UART

Post by EasyRider » Wed Jul 13, 2016 2:17 am

Thanks Deshipu,

Hardware mod is a temporary band-aid fix.

Uart is a prime communication interface for many applications requiring reliable functionality.

I don't know what complexities are involved in finalizing Uart functionality in firmware and hopefully to include an option to turn uart Repl off and/or redirect.

Regards

jms
Posts: 108
Joined: Thu May 05, 2016 8:29 pm
Contact:

Re: Using the tx/rx pins not for UART

Post by jms » Wed Jul 13, 2016 6:27 am

It's not just the REPL but also the manufacturer's stuff that comes out at 75k baud at startup. Later messages like "ip=..." do seem to go away with esp.osdebug(None)

brad
Posts: 7
Joined: Sun Jul 17, 2016 12:36 pm

Re: Using the tx/rx pins not for UART

Post by brad » Sun Jul 17, 2016 2:11 pm

Definitely would be useful to be able to "disconnect" the REPL from UART0, and use it independently. Yes, you still have to tolerate the startup garbage, but after that the UART could be fully under application control - while still using WebREPL for example. @deshipu's recent change gets one step closer (thanks!) but would be really nice to have something like the inverse of os.dupterm() or pyb.repl_uart() function.

Update:
I made a patch to do this which works nicely, but I'm not sure what the "proper" API should be to disconnect REPL from UART0. For my purposes I just overloaded the meaning of esp.osdebug(None) to also disconnect the REPL from that UART. It's a small change to uart.c and esp_mphal.c to give the dupterm its own ringbuf independent of the UART, and skip the CTRL-C processing when receiving bytes in non-stdio mode.
So - what's the right API to have this feature accepted into Micropython?

Post Reply