Page 1 of 6

Software serial?

Posted: Tue Aug 02, 2016 1:55 pm
by mcauser
Is anyone working on a software serial library?

The ESP8266 has two hardware UARTs.
UART 0 - TX and RX is used by the REPL.
UART 1 - TX is free for use, however, RX is used by the onboard spi-flash.

I have a GPS module and I am not sure how I can connect it. I need a free RX pin.

Can I disable console REPL and use WebREPL to free up the UART 0 RX pin?

Re: Software serial?

Posted: Tue Aug 02, 2016 2:26 pm
by deshipu
I would be happy to help you if you want to start working on this. The easiest way is to use some existing code that provides software serial, and just write the MicroPython module to access it. Do you have a candidate for that? A quick google yields https://github.com/plieningerweb/esp8266-software-uart

Re: Software serial?

Posted: Tue Aug 02, 2016 7:48 pm
by mflmartin
mcauser wrote: Can I disable console REPL and use WebREPL to free up the UART 0 RX pin?
I am using and testing a bluetooth module connected to the ESP8266-01 via UART. I use the Webrepl for testing, as my module is wired to RX/TX. It is a bit annoying when you have to restart, reconnect, etc, but overall is "usable".

Re: Software serial?

Posted: Thu Aug 04, 2016 11:14 am
by jms
The REPL doesn't start if you put something in startup scripts (main.py) to do something else instead.

The problem is then dealing with the rubbish that comes out and I wrote about that at viewtopic.php?f=16&t=2078

Re: Software serial?

Posted: Wed Aug 10, 2016 12:19 am
by EasyRider
I need a working UART port on the ESP.

I don't care about the garbage that comes out at the start or whenever, I will be filtering all the data using specific packet protocol with CRC.

My issue is disabling REPL on UART. WebREPL is providing the replacement functionality that I need.
The REPL doesn't start if you put something in startup scripts (main.py) to do something else instead.
:?

What do you put in main.py to do something else to disable REPL??

I am an application end user still learning python, can someone please provide a step by step guide/workaround on how to implement some sort of usable UART functionality. If it requires a hardware mod and if and how to disable REPL?

UART port on ESP8266 is implemented for most of the other language ports, LUA, Arduino, javascript and even ESPBasic that also has a second software UART implementation. I still don't understand why no priority has been given to implementing formal UART functionality in ESPmicropython.

Re: Software serial?

Posted: Thu Aug 11, 2016 7:43 pm
by markxr
There is a second UART which is tx-only. It is on one of the gpio pins which varies from one module to another, but you can find it easily enough by attaching a scope of them in turn. (Curiously enough, on my modules it appears to have a blue led wired on the board too, I think it's gpio2)

You can use this uart through micropython, I assume you can't then use the same pin as gpio.

Re: Software serial?

Posted: Fri Aug 12, 2016 3:33 pm
by pythoncoder
One idea might be to use UART 0 for receive and UART 1 for transmit - that way the debug information goes out on U0 and the application data on U1.

Re: Software serial?

Posted: Sat Aug 13, 2016 8:08 am
by deshipu
pythoncoder wrote:One idea might be to use UART 0 for receive and UART 1 for transmit - that way the debug information goes out on U0 and the application data on U1.
The debug information from micropython can be easily disabled. The problem is the bootloader messages at startup, and they get spammed to both uarts.

Re: Software serial?

Posted: Wed Aug 31, 2016 4:57 am
by konst
Any luck with software serial? Bunch of sensors need uart, I hope we will figure out something

Re: Software serial?

Posted: Wed Aug 31, 2016 4:24 pm
by pythoncoder
Writing a software UART is a nontrivial task. There are many parameters to accommodate, and timing needs to be quite precise (+-5% or thereabouts) so receive and transmit would need to be interrupt driven. To add to the complexity it needs to be able concurrently to send and receive. The first step is probably to characterise the ESP to determine timing precision, bit-banging in response to an interrupt. This would give a pointer to the likely maximum baud rate.

An interesting project, but if anyone takes it on they won't have it done in a day...