libftdi Archives

Subject: Re: libftdi-1.0: More patches

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 5 Sep 2011 18:07:20 +0200
On Monday, 5. September 2011 14:22:06 Uwe Bonnes wrote:
>     Thomas> Some (lower) baud rates get rounded and I can easily adjust
> the Thomas> unit test for that.
> 
> Where are your reference values from?

I generated the reference values with the old code.

>     Thomas> For some chips the data written to "value" and "index"
> changes a Thomas> lot.  I'll come up with examples in the afternoon.
> 
> One fractional bit is at 0x100 of index. The other fractional bits are
> 0x8000 and 0x4000 of value. So a small change in baudrate might cause
> huge changes in index/value

Alright, that explains it. Like I wrote before, I'm unfortunately
not really into the dirty details of the baudrate calculation code.
Thanks for persisting with this.

> If you can aknowledge me that the written USB data looks
> sane, Thomas> I'm willing to accept the patch even though I can't verify
> it Thomas> myself.
> 
> Perhaps the unit test should look at devisor, fractional bit and clock
> pre-divider separate.
> Divisor = value & 0x3ff
> Encoded Fractional bits = (index & 0x100)?4:0 + value >>12
> clk = (index & 0x100)? 120 MHz: 48 MHz
> 
> Then difference get more readable.

That's a good idea. I'll create a branch for the new code
and will update the unit test. My plan is to merge this
the next days once the unit test is adapted, too.

Cheers,
Thomas

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

Current Thread