Am 04.07.2013 00:52, schrieb Reinhard Max: > On Wed, 3 Jul 2013 at 23:35, Frank Schäfer wrote: > >> When I wrote the patch in 2009, only the first baud rate programming >> method was in place. >> The second method has been added later with commit 8d48fdf6. > > Hmm - it would be interesting to know what device and tests that > change was based on. Even more interesting would be the Windows driver that has been used for reverse-engineering. ;) AFAIK, the standard Windows driver doesn't use the second method (last checked 2-3 years ago)... I assume Prolific discloses this extra method/information only to customers that are asking for what they call "driver customization" in the datasheet. > >> Hmm... the comment says that >> >> 12MHz*32 / baud = divisor = (2^buf[1]) * buf[0] >> >> But the code below does something different... > > According to my tests the comment is true for bits 1..3 of buf[1] and > the current code seems to work by chance, because it doesn't get used > for baud rates below 115200. Yes, I can confirm that. :) And I'm pretty sure bit 0 of buf[1] belongs to buf[0] ! To summarize our current knowledge: divisor = 2^A * B with A = buf[1] & 0x0E B = buf[0] + (buf[1] & 0x01) << 8 Example: buf[1] = 0x03, buf[0] = 0x80=128 => divisor = 2^2 * 0x180 = 4 * 384 = 1536 I've tested this formula and it works from 46 baud to ~1.5MBps. I'm not sure what happens at higher baud rates - could be a cable problem. The FTDI-device I'm using as communication partner is also limited to 3.0Mbps. TODO: - more validation tests - B=0 case ? b=value+1 ? - best method for buf[0], buf[1] determination ? (multiple possibilites to encode the divisior !) - ... > >> I hope I'll get a FTDI-device for testing tomorrow. > > I'll try to hook mine up to a logic analyzer tomorrow, so that I get > better timing results than from the "estimate the baud rate from the > time it takes to send and receive a few thousand bytes" method I used > so far. Hmmm... would be nice if you could verify the formula with high baud rates (> 1.5Mbps). Regards, Frank > > > cu > Reinhard -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html