> > On Tue, Aug 30, 2022 at 6:39 PM Thomas Jarosch < > thomas.jaro...@intra2net.com> wrote: > >> Hi Parker, >> >> You wrote on Fri, Apr 22, 2022 at 05:22:41PM +0000: >> > 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? >> >> It's been a while since I last used FTDI but from what I understand > libftdi_write_data initiates the transfer and returns, it does not block > until all bytes are written. > You have to check if all bytes are written or wait for the time it takes > to transfer, the time will be at least size / (baud / 10) seconds. > I don't think there is a function to check if a transfer is completed (at > least I did not find such a function.) > > -- > Ori Idan CEO Helicon Books > http://www.heliconbooks.com > > >
-- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to libftdi+unsubscr...@developer.intra2net.com