0
\$\begingroup\$

I have an issue using FT232R to communicate with my PC.

I have two bytes of data that I need to transfer every 50 us. The frame size is 20 bits, including two start and stop bits for each byte. I've configured the UART module to operate at 1.5 Mbaud (0% clock error), and the message duration at that speed is around 13.5 us. FT232R can operate at 1.5 MBaud with 0% clock error.

I also use CoolTerm to receive data from MCU. I can send and receive data at slower rates, but at 50 us it seems that some bytes are lost.

What could be an issue here? I'm 100% sure that MCU transmits all bytes, but somehow I don't receive all of them.

EDIT: I did another test by sending a 16-bit counter value from MCU to PC every 50 us over 1 second. This means that I send 2*20000 bytes in total, and the received bytes when merged together should give a sequence 0,1,2,3,...,19999. It seems that I always receive a sequence 0,1,2,3,...,10048, and some garbage after that, which means that I always receive first 20098 bytes correctly.

I use Windows 10 operating system.

\$\endgroup\$
  • \$\begingroup\$ Long cables from board to PC? \$\endgroup\$ – Rohat Kılıç Jun 13 '17 at 11:55
  • \$\begingroup\$ Which one - UART to FT232R, or FT232R to PC? The latter is 1-2 m long. \$\endgroup\$ – Marko Gulin Jun 13 '17 at 11:59
  • 1
    \$\begingroup\$ Regarding your edit: That is a good test. The consistent results strongly suggest to me that it might be an I/O buffering issue in the PC operating system (which you haven't specified). \$\endgroup\$ – Dave Tweed Jun 13 '17 at 12:36
  • 1
    \$\begingroup\$ Like I said, if you don't tell us what OS you're using, it's difficult to provide specific advice. Windows? Mac? Linux? What version? \$\endgroup\$ – Dave Tweed Jun 13 '17 at 13:08
  • 1
    \$\begingroup\$ The PC would be in a time crunch to keep up indefinitely with individuals calls through an I/O driver every 50 uSec. You may be able to do it if you are somehow able to read blocks of bytes into the PC on each call, rather than 1 or 2 bytes. I think the problem is on the PC end. You are having success until your buffer overflows. You can test this theory by reducing your buffer bytes in the FT232 driver and run the test to verify that the test crashes earlier with a smaller buffer. \$\endgroup\$ – Entrepreneur Jun 13 '17 at 13:22
2
\$\begingroup\$

Your CoolTerm program is not able to display data fast enough to keep up with the received data rate. Your PC is buffering the received data but eventually the buffer overflows which corrupts your received data.

\$\endgroup\$
0
\$\begingroup\$

As some of you have already indicated, CoolTerm is not able to fetch data fast enough to empty the PC COM port buffer.

I did a trick with priorities in the task manager, where I've set the Realtime priority for the CoolTerm. Now everything works just fine! :)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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