libftdi Archives

Subject: Re: Could anyone spare a clue?

From: John Oyler <john.oyler@xxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 24 Aug 2010 15:54:53 -0500
On Aug 23, 2010, at 11:11 PM, Michael Plante wrote:
>>> Or is it something where I'll almost certainly see it sync
>>> after a dozen tries, so I don't have to worry about it?
> My experience was that it was a strong function of the latency timer.  I
> couldn't make anything less than 3 work properly, and 3 would occasionally
> fail after my maximum number of retries, but rarely (guessing <5% of the
> time I ran my program).  I know this isn't what you want to hear.  And I'd
> be happy to hear suggestions from anyone else who's used MPSSE.  But that's
> what I wound up doing and it generally worked for me.

I have a much clearer pictures of what is happening, now, though I'm not sure I 
would have had you not been patient in explaining.

I'm writing all 32 one-byte registers at once, which the SX1211 radio allows (5 
bit address (padded) and 8 bit value, one after the other). Though I can't 
confirm that this succeeds quite as strongly as I might like, it's the only 
thing that makes sense.

Then, because I'm too dumb to know how to actually listen on the incoming 
radio, I try to confirm it by reading back the register values one at a time, 
printing them out. I for-loop through 32 times, but the first 2-4 read attempts 
will fail, giving me 0x00. Then, as I attempt to read #3, it gives me back the 
value that I thought I put in #1, and for #4 I get #2's value, and so forth. 
Sometimes halfway through, it'll hiccup again giving me zeroes for awhile, 
until it picks up where it left off. So, just as you explained (but wasn't 
clicking for me), I may be asking a new question, but the SPI bus and the chip 
on the other side is desperately trying to catch up by giving me answers to the 
old questions.

Luckily, it's not important for me to be able to read the register values 
back... and having run it dozens of times, it does seem like the initial write 
always succeeds. I'll do more testing to confirm that that's always so, but if 
it's true 999 times out of 1000, it'll be good enough.

So now I have to figure out how to use bitbang mode... the two interrupts that 
I need to know if data is present will be there. Does anyone know of any good 
example code that makes use of bit-banging? I honestly try to read the libftdi 
source, but my head just swims. For those who think my a sissy... cut me some 
slack, today I wrote my very first makefile (until now I was compiling it from 
the command line with the flags I saw libftdi's examples use) and managed to 
get a two-source-file program to build. Those are both fairly big firsts for me.

Thanks Michael, thanks everyone
John O.

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread