libftdi Archives

Subject: Synchronous Baud Rate Change

From: "Owen, Parker (US)" <John.Owen@xxxxxxxxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Apr 2022 17:22:41 +0000

Hi, 

I am trying to synchronously change the baud rate of one of the ports on the FT4232 chip. What I am trying to do is send out a string of bytes over the UART at baud rate 115200 and then immediately after the string has finished sending change the baud rate to 921600 and start listening. However, the first string of bytes isn't getting sent all the way... What it seems like is happening is the baud rate is changing before the first string is sent all of the way. How do I guarantee the string has been sent fully before the baud rate changes? 

Here is some sample code of what I am trying to do:

ftdi_set_baudrate(ftdi, 115200);
ftdi_write_data(ftdi, outBuf, size); // fails to send fully before baud rate changes to 921600.
ftdi_set_baudrate(ftdi, 921600);
numBytesRead = ftdi_read_data(ftdi, inBuf, size);

Any ideas on how to fix this?





Notice to recipient: This email is meant for only the intended recipient of the transmission, and may be a communication privileged by law, subject to export control restrictions or that otherwise contains proprietary information. If you receive this email by mistake, please notify us immediately by replying to this message and then destroy it and do not review, disclose, copy or distribute it. Thank you in advance for your cooperation.


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Current Thread