Re: fx2lp out endpoint not arming (AUTOOUT mode)




<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);
}
}


.



Relevant Pages

  • Re: fx2lp out endpoint not arming (AUTOOUT mode)
    ... code but EP2CS still reports the FIFO is full after a FIFO reset ... (which I assume means it didn't arm correctly). ... eeprom (firmware I didn't write), then I just nuke it by uploading my ... recall in previous instances it came up as 'full' after a FIFO reset). ...
    (comp.arch.embedded)
  • Re: Atmel USB Wireless devices
    ... The device requires two sets of firmware to be ... The problem is that the device really dies after uploading the internal ... It really needs a reset before it will communicate again. ... The story gets more complex since the descriptors of the device have changed ...
    (freebsd-hackers)
  • Re: fx2lp out endpoint not arming (AUTOOUT mode)
    ... I found that the only way I could get the AUTOOUT function to reliably ... FIFORESET = 0x04; SYNCDELAY; ... eeprom (firmware I didn't write), then I just nuke it by uploading my ... recall in previous instances it came up as 'full' after a FIFO reset). ...
    (comp.arch.embedded)
  • Re: HP3320 scanner failure
    ... Download and install the latest firmware after reading the instructions on ... Select your product and then select "Cross operating system (BIOS, Firmware, ... If that does not work then perform an NVRAM reset as follows. ... Whilst still holding these keys power the printer on, ...
    (comp.periphs.printers)
  • Re: FIFO newbie question
    ... This FIFO uses an asynchronous reset, ... internal registers of FIFO. ... its flags show that the FIFO is empty. ... fifo outputs the previously read value. ...
    (comp.arch.fpga)