Re: fx2lp out endpoint not arming (AUTOOUT mode)
- From: "Bill Davy" <Bill@xxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 11:00:18 -0000
<esterhui@xxxxxxxxx> wrote in message
news:1170184725.677057.15170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jan 30, 10:21 am, ester...@xxxxxxxxx wrote:
Thanks - I tried rearranging my code so it looks more like the 'Husky'
code but EP2CS still reports the FIFO is full after a FIFO reset
(which I assume means it didn't arm correctly). I noticed I forgot the
SYNCDELAY after my OUTPKTEND=0x82 statements in the original code, I
fixed that but still no luck. I'll keep digging...
OK, I figured out why it doesn't arm: The fx2 loads firmware from an
eeprom (firmware I didn't write), then I just nuke it by uploading my
own firmware directly to RAM. I overwrote the eeprom to do a simple C0
load (just vid/pid) then upload my own firmware on a 'fresh' fx2 via
USB. With this done the EP2CS comes up as 'empty' (which is correct,
recall in previous instances it came up as 'full' after a FIFO reset).
It appears that the problem still persists: when I tell my new
firmware to reset EP2 FIFO it resets and comes up with the FULL flag
set. Even uploading the exact same firmware again causes the EP2 full
flag to be set.
To summarize, when I set REVCTL=0x03 and do a FIFORESET of EP2 and arm
it using OUTPKTEND the _very first time_ after a powercycle it works.
Any 2nd attempt to reset the FIFO causes it to come up in the full
state.
Well spotted. I think I found something similar which is why I put off
doing this initialisation until the external clock has arrived, as doing it
twice (once when USB supplies power and once when the rest of the machine
gets power) did not work in some way. It was a major time-waster as I
recall, though the tech support folk did their best. When I was testing the
code on the SDK using software loop-back, there was never going to be any
external clock so it had different initialisation. I must put your note in
my code for next time (and any poor maintenance programmer who passes this
way again).
In fact, we still carry the overhead of optoisolating the Cypress from the
rest of the board as it really cannot do much without the rest of the
machine.
Incidentally, if you do softwaare loop-back the following neat wheeeze may
help. It's not something to be proud of (though I would be) but the Keil
compiler (at least) gets it right.
if ( Count )
{
//
// Use Tom Duff's (May 7, 1984) method for fast copying.
// Count > 0 assumed
// As the maximum bulk buffer size is 512 (even isochronous is only
1024),
// we can count cycles in a byte.
//
BYTE n = (Count + 7) / 8;
switch (Count % 8)
{
case 0: do { EXTAUTODAT2 = EXTAUTODAT1;
case 7: EXTAUTODAT2 = EXTAUTODAT1;
case 6: EXTAUTODAT2 = EXTAUTODAT1;
case 5: EXTAUTODAT2 = EXTAUTODAT1;
case 4: EXTAUTODAT2 = EXTAUTODAT1;
case 3: EXTAUTODAT2 = EXTAUTODAT1;
case 2: EXTAUTODAT2 = EXTAUTODAT1;
case 1: EXTAUTODAT2 = EXTAUTODAT1;
} while (--n > 0);
}
}
.
- References:
- fx2lp out endpoint not arming (AUTOOUT mode)
- From: esterhui
- Re: fx2lp out endpoint not arming (AUTOOUT mode)
- From: Bill Davy
- Re: fx2lp out endpoint not arming (AUTOOUT mode)
- From: esterhui
- Re: fx2lp out endpoint not arming (AUTOOUT mode)
- From: esterhui
- fx2lp out endpoint not arming (AUTOOUT mode)
- Prev by Date: Re: Internal headhunters?
- Next by Date: Re: RSA on 8bit micro
- Previous by thread: Re: fx2lp out endpoint not arming (AUTOOUT mode)
- Next by thread: Re: Problem using a mosfet to switch devices on/off
- Index(es):
Relevant Pages
|