Help needed: UART to SPI mirror?

Thread Starter

Dowapa

Joined Sep 3, 2021
13
Hello all, I'm in desperate need of consultation for a design problem I'm currently workshopping.

I have a circuit with a microcontroller (ATMega328p) that is recording/crunching data and sending a constant data stream over the UART connection to a USB-UART bridge (currently an FT232RN). I'm in a situation where clock cycles on my microcontroller are extremely valuable (using clock cycles on other functions means less clock cycles crunching and sending data, decreasing my data density) so I want to avoid sending the same data twice to two locations. I had the idea that I could maybe "skim" or "mirror" the data already being send over the TX line and convert it to a usable format before sending it to it's desired recipient (in this case, a sequential write non-volatile memory IC of some kind). Choosing a memory IC with an SPI interface has the added benefit of a built in enable pin allowing for the primary microcontroller to select when data gets written and read.

So to summarize briefly, I'm attempting to read a data stream from a single UART data line, convert it to an SPI output, and send it to another IC (see attached image).

I've looked at the possibility of using the GPIO pins of the FT232RN somehow to "mirror" the data out, but this does not appear to be practical. I've considered that the only possibility may be to add a small microcontroller dedicated to this task... but my board space is limited, this is a battery operated device, and adding programming steps to the manufacturing process is discouraging. I'm not tied to the FT232RN and could consider some other IC configuration for the USB adapter... but I haven't found one that would do me any more good than the FT232.

Am I barking up the wrong tree trying to do this? Hoping someone with more experience could give me an idea.dataDiagram.png
 
Last edited by a moderator:

nsaspook

Joined Aug 27, 2009
13,426
Hello all, I'm in desperate need of consultation for a design problem I'm currently workshopping.

I have a circuit with a microcontroller (ATMega328p) that is recording/crunching data and sending a constant data stream over the UART connection to a USB-UART bridge (currently an FT232RN). I'm in a situation where clock cycles on my microcontroller are extremely valuable (using clock cycles on other functions means less clock cycles crunching and sending data, decreasing my data density) so I want to avoid sending the same data twice to two locations. I had the idea that I could maybe "skim" or "mirror" the data already being send over the TX line and convert it to a usable format before sending it to it's desired recipient (in this case, a sequential write non-volatile memory IC of some kind). Choosing a memory IC with an SPI interface has the added benefit of a built in enable pin allowing for the primary microcontroller to select when data gets written and read.

So to summarize briefly, I'm attempting to read a data stream from a single UART data line, convert it to an SPI output, and send it to another IC (see attached image).

I've looked at the possibility of using the GPIO pins of the FT232RN somehow to "mirror" the data out, but this does not appear to be practical. I've considered that the only possibility may be to add a small microcontroller dedicated to this task... but my board space is limited, this is a battery operated device, and adding programming steps to the manufacturing process is discouraging. I'm not tied to the FT232RN and could consider some other IC configuration for the USB adapter... but I haven't found one that would do me any more good than the FT232.

Am I barking up the wrong tree trying to do this? Hoping someone with more experience could give me an idea.View attachment 317299
I hope you're using hardware modules instead of bit-banging.
If you're just transmitting the data on the SPI hardware module, it takes only microseconds extra to also send the UART module TX buffer data to the SPI module TX buffer.
 
Top