0
\$\begingroup\$

I need to send synchronous serial data with control characters and 8b/10b encoding at about 5Mbaud - and I need to send that from a laptop; I do have UART ports which can keep up with these speeds, but they're not synchronous so I don't have a clock signal output.

I have thought of using an SPI transmitter and spread the encoded data myself bit by bit on the byte stream, but there is a +50% pause in-between bytes transmitted which would then occur in the middle of an encoded word (which I doubt makes for reliable transmission, if at all).

My only candidate right now is an FPGA to which I send the data via USB or UART, but that sounds like a lot of effort for something for which there should be a widespread solution.

Any idea is welcome...

\$\endgroup\$
14
  • 1
    \$\begingroup\$ why wouldn't they exist? ... what is your real question? \$\endgroup\$
    – jsotola
    Commented Jan 27, 2022 at 20:01
  • \$\begingroup\$ What are you connecting to what else? You say that one end of the connection is a laptop. OK, what application is running on the laptop, and what is at the other end of the connection? What protocol does it speak? How long will the cable need to be? What else constrains your solution? \$\endgroup\$ Commented Jan 27, 2022 at 20:05
  • 5
    \$\begingroup\$ Today a common peripheral is in fact USART rather than UART. Grab a microcontroller that has two of these and make yourself an adapter. \$\endgroup\$
    – Eugene Sh.
    Commented Jan 27, 2022 at 20:07
  • 1
    \$\begingroup\$ @EugeneSh.: now actually this is helpful, at least I don't have to program an FPGA to do that, I can just find a chip that has USB and a USART with the baudrate I want - that is capable enough to do on-the-fly forwarding? I think I'll be limited by the USART baudrates but I'll try to find one. \$\endgroup\$
    – user42875
    Commented Jan 27, 2022 at 20:25
  • 1
    \$\begingroup\$ 8b/10b encoding \$\endgroup\$
    – user42875
    Commented Jan 27, 2022 at 20:31

1 Answer 1

2
\$\begingroup\$

You don't detail your application or the target equipment, so I'll presume there's some confidentiality or secrecy that stops you doing so. I'll presume you're trying to put serial test data into existing equipment.

You say that your data is coming from a laptop, so you can only use USB or, if it has it, a COM port.

The COM port is UART over RS232C and the latter won't do anywhere near 5 Mbps, regardless of what you can get out of the UART.

That leaves you with USB. You can either take that into the hardware you want or connect an off-the-shelf communications IC or a USB-to-comms adaptor module.

For ICs, an example is the FTDI FT232HP USB 3.0 Bridge. This connects to USB 3.0 on one side and has two interfaces on the other side. One is a UART for up to 12 Mbaud. The second is a FIFO with 8-bit parallel bus and handshaking, which can handle up to 8 MB/s async or 40 MB/s sync. Both well exceed your 5 Mbps requirement.

If you haven't got a USB 3.0 port, another example is the FTDI FT245R USB FIFO IC. This connects to USB 2.0 on one side and has an 8-bit parallel port with handshaking on the other. It can handle up to 1 MB/s, same as 8 Mbps and exceeding your 5 Mbps requirement.

There are other USB-to-parallel bridge ICs on the market that you can look into.

For adaptors, you may be able to find a USB to RS485/etc. unit with a UART that can handle 5 Mbps. The RS485/etc bus standards can manage the bitrate, it's the USB-to-UART electronics that you'll have to be sure of. They'll also use these off-the-shelf USB bridge ICs.

In both cases, the communications path will present itself to Windows as a virtual COM port. Linux will have an equivalent, if that's what you'll be using.

You'd need to interface to the FT245R to something to (a) manage FIFO controls and (b) convert parallel data or UART communications to a serial stream with clock for your target equipment. That's a CPLD or FPGA (never an MCU) and some very short and simple firmware. If you're competent in VHDL, you can buy an FT245R board and a cheap CPLD/FPGA board and have that part built and going in a couple of days. Always prove your VHDL design in simulation before trying it on the board.

It is possible to implement the USB interface in the FPGA but a lot of work compared to the low cost of the USB bridge ICs. It depends on your constraints of cost, units to make, development schedule etc., none of which are stated in your question.

The harder part is getting the sustained transfer rate out of the laptop's USB drivers. The USB standard's speeds are one thing but Windows and its USB drivers are not great at maintaining high or flat-out communications speeds, from development experience. So you need to consider if your application can accept pauses and hiccups in communications and how it would be dealt with.

Another problem is how to throttle the PC's data transmission rate to match the rate of data consumption at the equipment. You would need some feedback over the virtual COM port to do transmission start/stop, which requires sufficient RAM at the CPLD/FPGA while the PC is receiving the start/stop and acting on them.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for the answer, I was looking for something like this. Kudos for the hiccups in the USB throughput, that's not necessarily an issue to me but it will decrease the average datarate since I'm transmitting continuously. I'm planning on using Linux. Thanks for suggesting a part number, I really apppreciate it - but since I need DAT/CLK out, how do you synchronise a USART and the USB FIFO such that the USB FIFO only updates the parallel output to the new byte AFTER the USART is done transmitting the previous byte? \$\endgroup\$
    – user42875
    Commented Jan 27, 2022 at 21:28
  • \$\begingroup\$ Sounds like the easiest would actually be to program a CPLD to take in UART data, assert the hardware flow control CTS line when the programmed internal buffer is not full, and shift out the contents of the internal buffer at the desired baudrate (so 1 UART core, 1 buffer core, and 1 USART/synchronous shift register core) - woudn't it? \$\endgroup\$
    – user42875
    Commented Jan 27, 2022 at 23:50
  • \$\begingroup\$ @user42875, dunno, depends what you're trying to do, what resources you have and what you're capable of - none of which are in your question. I've revised my answer and it should cover you. As it's a Q&A site, not a discussion forum, let's not have a long comment exchange with you slowly giving out details. Edit your question, explain in long detail what you're working on, why you're doing this and what your capabilities and constraints are. \$\endgroup\$
    – TonyM
    Commented Jan 28, 2022 at 0:31
  • \$\begingroup\$ Great answer, TonyM. I have enough information to research and develop. I may be wrong but I think I do not need to update my question for the Q/A to be complete. Thanks a lot! \$\endgroup\$
    – user42875
    Commented Jan 28, 2022 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.