The branch, master has been updated
via 71030195f48bbf49b84de66a425ae10e5577774e (commit)
via 913ca54fbf3175575cb2f1e9780e18ee6f4b991a (commit)
from 6f3b2133e6de5a38502d93278bacd7a1759f703f (commit)
- Log -----------------------------------------------------------------
commit 71030195f48bbf49b84de66a425ae10e5577774e
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Tue Aug 16 14:55:33 2016 +0200
Add TYPE_230X to baudrate test code
commit 913ca54fbf3175575cb2f1e9780e18ee6f4b991a
Author: Joe Zbiciak <intvnut@xxxxxxxxx>
Date: Sat Aug 13 12:46:16 2016 -0700
Use BM/R series baud rate computation for FT230X.
The current code uses the AM series baud rate computation for FT230X,
and this results in incorrect divisor calculation for high baud rates.
Use the BM/R series logic instead.
This matches the corresponding code paths in the Linux kernel ftdi_sio
driver. See ftdi_sio.c:1323 here:
http://lxr.free-electrons.com/source/drivers/usb/serial/ftdi_sio.c#L1323
Specifically attempts to set 2000000 on an FT230X fail currently due to
the if-statement at ftdi.c:1106. The computed divisor (12) gets clamped
to 16, and thus the for-loop it's in doesn't converge on a usable divisor.
The if-statement at ftdi.c:1152 never fires, as the if-statement at
ftdi.c:1106 in the for-loop precludes a divisor of 12 (which is required
for *encoded_divisor to become 0x4001).
-----------------------------------------------------------------------
Summary of changes:
src/ftdi.c | 2 +-
test/baudrate.cpp | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/ftdi.c b/src/ftdi.c
index 3bfd72f..0b26a7a 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1253,7 +1253,7 @@ static int ftdi_convert_baudrate(int baudrate, struct
ftdi_context *ftdi,
else
best_baud = ftdi_to_clkbits(baudrate, C_CLK, 16, &encoded_divisor);
}
- else if ((ftdi->type == TYPE_BM) || (ftdi->type == TYPE_2232C) ||
(ftdi->type == TYPE_R ))
+ else if ((ftdi->type == TYPE_BM) || (ftdi->type == TYPE_2232C) ||
(ftdi->type == TYPE_R) || (ftdi->type == TYPE_230X))
{
best_baud = ftdi_to_clkbits(baudrate, C_CLK, 16, &encoded_divisor);
}
diff --git a/test/baudrate.cpp b/test/baudrate.cpp
index 29bbd20..fe6c63a 100644
--- a/test/baudrate.cpp
+++ b/test/baudrate.cpp
@@ -102,6 +102,7 @@ static void test_baudrates(ftdi_context *ftdi, const
map<int, calc_result> &baud
case TYPE_R:
case TYPE_2232C:
case TYPE_BM:
+ case TYPE_230X:
fractional_bits |= (calc_index & 0x001) ? 4 : 0;
break;
default:;
@@ -159,6 +160,7 @@ BOOST_AUTO_TEST_CASE(TypeBMFixedBaudrates)
test_types.push_back(TYPE_BM);
test_types.push_back(TYPE_2232C);
test_types.push_back(TYPE_R);
+ test_types.push_back(TYPE_230X);
map<int, calc_result> baudrates;
baudrates[183] = calc_result(183, 16383, 7, 48);
hooks/post-receive
--
A library to talk to FTDI chips
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|