Question: Ok, I have one uart interface (TXD GPIO 14, RXD GPIO 15). I want at least one more uart interface.

Possible solutions:

* Bit banging:
Use two unrelated spare GPIOs. I understand that timing is a problem on a standard linux. Would it be reliable with very low baudrate?
* Switching:
RPI decides when to talk to which device. Using e.g. [CD4066BC](http://www.fairchildsemi.com/ds/CD/CD4066BC.pdf).
* spi to 2 x uart bridge:
Didn't find a suitable part (availability, price, dil package)
* usb to uart:
Expensive

Are there other options? I'm inclined to switching, if it can be done. What would you advise?

Answer: 
If you decide to skip adding extra hardware and just go the bit-banging route, this isn't as difficult as some picture it.

First off, your communication thread must go realtime:

```
#include<sched.h>

struct sched_param param;               
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
if( sched_setscheduler( 0, SCHED_FIFO, &param ) == -1 )
{
        perror("sched_setscheduler");
        return -1;
}

```

From now on, your thread will not be pre-empted for 950ms out of each second[\*](https://raspberrypi.stackexchange.com/a/8855/6406), unless it returns control willingly (through `sched_yield()`, or `usleep()`) in timely manner, which will not make it pre-empted ever. With 850MHz CPU your bit-banging loop will be running idle most of the time even at fastest speeds.

Now unfortunately the requirement to return control from time to time means while your thread is sleeping, whatever your "opposing party" sends, would be lost forever. But for that purpose you could use transmission control. Either allocate some more GPIO for CTS line which you pull down before yielding and back up upon restoring control:

```
  bcm2835_gpio_write(CTS_PIN, LOW);
  usleep(10);
  bcm2835_gpio_write(CTS_PIN, HIGH);

```

or (IMHO preferably) use XON/XOFF transmission control - send the XOFF character over RS232 before sleeping, XON after you resume operation. The default ASCII codes for these are `'\x13'` for XOFF/"stop sending" and `'\x11'` for XON/"resume sending".

Of course your remote device must obey these. If it doesn't, some data will be lost.
I'm using SC16IS752 IC which is SPI to 2xUART converter. It works well with Raspbian Stretch.

It is a bit more expensive than FTDI chip, but there are two uarts and I don't have to use precious USB port.