>>>>> "John" == John Oyler <john.oyler@xxxxxxxxxxxxxx> writes:
John> I know this sets the clock rate, but I have no idea what my ideal
John> clock rate is. Having hooked up to the digital oscilloscope, I
John> don't know why it never occurred to me to run the windows software
John> for this device. Compared against the (minimal) software of my
John> own, the clock rate is definitely slower. I don't know how to use
John> the scope, but eyeballing it each high half of a clock was about
John> 4-5 times as long.
John> Here is my code (irrelevant portions omitted):
John> #define DIVIDE_BY 3
John> buf = 0x86; /* command "set divisor" */ /*
John> valueL/valueH are (desired_divisor - 1) */ buf = (DIVIDE_BY -
John> 1) & 0xff; buf = ((DIVIDE_BY - 1) >> 8) & 0xff; if
John> (send_buf(ftdic, buf, 3)) return -1;
John> Now, this is with a FT2232D that has a 6Mhz crystal wired up to
John> it. Can anyone help me interpret what I'm currently setting the
John> clock to?
The code looks good. Maybe you got the scope wrong. perhaps redo the test
in a calm moment.
John> The source code for the windows software is some sort of C#.NET
John> abomination, and I'm having trouble understanding what it's really
John> setting this to. It has a similar constant, and it does the
John> bitwise stuff in the same manner. But it looks as if it's setting
John> the divide-by to 60.
John> As most of the rest of my code is working as I should expect it
John> to, I'm half convinced this is the answer. Or if not *the* answer,
John> then at least a big piece of the puzzle.
John> And secondly, I'm still trying to understand how best to sync
John> things up when reading the registers out of this. If I pump 0xaa's
John> at the thing, I can do this in a while loop expecting a 2 byte
John> reply that will eventually be non-0x00. But what happens if I get
John> a 0x00fa back? At that point I should immediately try to read
John> (with no command) 1 byte (should be 0xaa), and then jump into my
John> "read registers" block, right?
Don't you know, what to expect? Read that many words from the device. This
is how xc3sprog works.
John> <br><hr><p><b>libftdi</b> - see <a
Please, no HTML in mail (at least to mailing lists)
Uwe Bonnes bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx