So I realize this is a case of swatting a fly with a sledgehammer, but sometimes you only have a sledgehammer lying around. In this case the sledgehammer is a STM Nucleo F303K8, an impressive little board for the price.


This implementation does not support flow control, but it was not necessary for my application. It is however interrupt driven, so the processor is free to also take on other tasks if desired. I’ve attempted to comment the code to make it clear what would need to be changed for a different application or board.

#include "mbed.h"

// Serial connection to pc
RawSerial pc(USBTX, USBRX);

// Serial connection to ftdi

// On the F303K8 PA_9 is Serial1_TX and PA_10 is Serial1_RX, if using
// a different board or serial change to corresponding pins, making
// sure not to conflict with any other pins in use
RawSerial dev(PA_9, PA_10);

// LED to display status
DigitalOut led1(LED1);

// Interrupt on character(s) in buffer from ftdi connection
void dev_recv()
    // Turn on LED
    led1 = 1;
    // Read all characters from ftdi and send to pc
    while(dev.readable()) {
    // Turn off LED
    led1 = 0;

// Interrupt on character(s) in buffer from pc connection
void pc_recv()
    // Turn on LED
    led1 = 1;
    // Read all characters from pc and send to ftdi
    while(pc.readable()) {
    // Turn off LED
    led1 = 0;

// Main routine
int main()

    // Set baud rates on pc and ftdi, change these to fit your use
    // case

    // Turn on LED
    // Print message to pc to check correct setup
    pc.puts("Welcome to ftdi\n\r");
    // Wait 1 second
    // Turn off LED

    // Attach interrupt routines to RawSerial devices
    pc.attach(&pc_recv, Serial::RxIrq);
    dev.attach(&dev_recv, Serial::RxIrq);

    // Sleep forever, interrupts will take care of data
    while(1) {

Use the mbed online compiler to build the code and download the bin file to the block device the board shows up as (or whatever method is required for your board). With the board connected to your computer, a tty device should be created, in my case /dev/ttyACM0. To get a serial console to view output and send input over the ftdi, run screen with the device and the baud rate set for pc in the code like so:

screen /dev/ttyACM0 115200

At your preference, you could also use minicom or a similiar application.

Remember of course to hook up wires from the chosen device pins to the ftdi you’re connecting to, making sure to cross connect, rx on the stm to tx on the ftdi and vice versa.