# Is it possible to convert SPI to UART without a microcontroller?

I was wondering about converting SPI to UART only in that direction, not the other way around, without using any microcontroller or bridge.

If synchronous can be seen as a particular case of asynchronous communication, wouldn't be somehow possible to make the Rx just read the input? (At least in the case it was an uninterrupted flow of bits.)

Of course, the baudrate should be matched... but are there any other limitations I'm missing?

Cheers!

• Provided the goal is a simple bytewise conversion, this is actually a better fit for a state machine than for a stored program computer. However, MCU's are more readily available in small units of functionality than programmable logic fabric, and more people are familiar with efficiently developing for them. Things may be simplest if the output baud rate is faster than the input by more than the factor of transmitted word length over payload bits. – Chris Stratton Feb 10 '15 at 14:14

Yes, if the SPI bit rate matches the UART bit rate you want to generate, it can be done.

The SPI data stream needs to be carefully constructed:

• SPI data is normally MSB-first, but UART data is normally LSB-first, so you'll need to reverse the bit order in each of the data bytes.
• UART data contains a start bit and a stop bit bracketing each byte, so for each 8-bit data byte you want to transmit, you need to put (at least) 10 bits into the SPI data stream. One easy (but inefficient) way to do this would be to alternate data bytes with bytes of 11111110.
• Nice! What if I cannot change the way the SPI data stream is constructed? Would it still be possible to reconstruct the information after UART? – Fran Feb 10 '15 at 13:07
• No. If you can't change the SPI data stream, then you need to construct a SPI slave device that can interpret it as-is. By far, the easiest way to do this is to use a small microcontroller. Why are you ruling this out? – Dave Tweed Feb 10 '15 at 13:20
• I am not allowed to modify the device that generates the SPI data stream. I was hoping to avoid the need of an additional microcontroller because of space and simplicity... but I cannot imagine other alternatives! Looks like it's gonna be a micro then! Any suggestions? It would be nice to avoid designing a board and soldering stuff, but also without using Arduino-like boards. – Fran Feb 10 '15 at 13:32
• "I was hoping to avoid the need of an additional microcontroller because of space and simplicity.." are you saying you don't want things small and simple? Because that is what a microcontroller solution would look like. Arduino is not a microcontroller, it is a development board that contains, amongst other things, a microcontroller (and headers and connectors and voltage regulator supply and USB interface and ... . @Fran Probably an 8-pin ATtiny would be perfect for the job. – jippie Feb 10 '15 at 13:56
• Additional constraint: the SPI data must be clocked out at exactly the right moments. For 'normal' SPI this is not a requirement, so probably a normal SPI source does not pay any attention to this. – Wouter van Ooijen Feb 10 '15 at 14:19

There are custom ICs for example this one from NXP: http://www.nxp.com/products/interface_and_connectivity/bridges/i2c_spi_slave_to_uart_irda_gpio_bridges/series/SC16IS740_750_760.html

They probably have an MCU hidden inside, for buffering and arbitration.

• Thanks! I have one of those, but the device is configured using SPI and my main limitation is that the SPI is generated by a system which I cannot modify in any way. – Fran Feb 10 '15 at 13:10
• By the way! Do you know if it would be possible to setup one of those via UART? That would solve my problem :-) – Fran Feb 10 '15 at 13:10