A full duplex software UART is quite hard to do, especially if all the features of a hardware UART are to be emulated. Further the Pyboard has five user-accessible hardware UARTs so use-cases on that platform will be few.

The main use-cases are on Espressif devices, especially the ESP8266 which has only 1.5 UARTs, one of which is used for debugging. Alas the interrupt latency of ESPx chips will limit the baudrate of any soft UART.

I think the useful user-contributed half-duplex solution discussed in this thread may be the best we'll get.

Hi cversec,
I saw your evaluable job in SoftUART. Great !
I think that after 2 year there were some adjustments and experience. Below some questions:
a) I need to set the Parity (ODD) and StopBit (1). May I modify directly on the code (machine_softuart.c) ?
b) Along the code I've seen some sentences like _pyb_softuart_obj_t. Because I'm not using a PYB but another module based on ESP8266, do i need to modify something ?
c) For flashing on a ESP8266 chip, I prefer use the latest micropython code (a lot of water is passed under the bridges...), which files I need to import and modify in order to include the SoftUART in the flashing code ?
d) Do you have a some suggestions on PyCharm to manage correctly the new SoftUART (interpreter related)?

Hi All,
I'm new to micropython and the esp8266, but I've been a long time Python and Arduino user. On my first IoT data logger project I was finding micropython a joy to develop in and the software machine.I2C library quite easy to adapt for an AM2315 (http://www.adafruit.com/products/1293) humidity and temperature sensor. However, I hit a wall when I needed to integrate a UART communicating carbon dioxide sensor and found that the hardware UARTs were tied up and there was no built-in software serial module.

I actually found deshipu 's original suggestion to be quite helpful. After learning the basics of writing C extension modules (and a lot of trial-and-error hacking) I was able to successfully adapt a `softuart` C code library (http://github.com/plieningerweb/esp8266-software-uart) and wrap it in a micropython extension class `machine.SoftUART` that is based very closely on `machine.UART`.

The baudrate and timeouts are configurable; however, the data bits, stop bits, and parity are fixed. The softuart.c library uses a statically allocated receive buffer with a default size of 64 bytes (https://github.com/p-v-o-s/micropython/ ... tuart.h#L4). The new `flush` method resets the receive buffer to empty state. One major shortcoming of the `machine.SoftUART` implementation is that only one instance of a SoftUART class can function in overlapping code since it uses a global Softuart struct instance `softuartDevice` - I was unable to get multiple instances working properly using dynamic allocation.

Please let me know if you find this useful or need help to get it working.

I have been looking at the SoftUART support for Micropython (for integrating with RS485 adapters), and therefore have pulled in the code changes and adapted the patches for the current micropython code base. You can see on https://github.com/dmascord/micropython.

In any case, in terms of your questions:
a) I am not sure that you will get away from just modifying the parity and stop bit, because parity and stop bit isn't implemented in softuart.c (you can see alternative softuart implementations that do implement parity, such as https://github.com/kirtikaran3/TM4C/blo ... softuart.c)
b) This doesn't look specific to PYB and should be generic across all ESP8266.
c) As per above comment, you are welcome to try out my fork (I have only compile tested it so far)
d) What do you mean about manage correctly ?

Do you know how to turn off an external interrupt setting?I want to write softuart, but I want external interrupt mode to detect the start bit, and turn off the interrupt after data transmission starts, but how to turn off the interrupt?

Do you know how to turn off an external interrupt setting?I want to write softuart, but I want external interrupt mode to detect the start bit, and turn off the interrupt after data transmission starts, but how to turn off the interrupt?