EmbeddedRelated.com
Forums
Memfault Beyond the Launch

USB FX2 Mass Storage Implementation

Started by EM van Rijk May 13, 2004
Hello all,

I working on a Cypress FX2 dev board thats Bulk-Only Mass Storage
Compliant.

I've looked at the CY4611 example in detail, but it is more limited than
I need. I need to implement SCSI protocol at the firmware level, because
there is no SCSI compliant device behind it.

The problem I'm having is that I need to check for a CBW header to see
if it's a valid SCSI command. This in it's turn makes it impossible to
run in AUTO mode.
When I recieve a invalid CBW command according to the USB MSC BOT 6.6.1
docs I need to wait for a reset recovery.
"6.6.1 CBW Not Valid
If the CBW is not valid, the device shall STALL the Bulk-In pipe. Also,
the device shall either STALL the
Bulk-Out pipe, or the device shall accept and discard any Bulk-Out data.
The device shall maintain this state
until a Reset Recovery."

Does this mean the device will be reset at hardware level by a USB reset
or do I need to wait for an UNSTALL of the endpoint by a Clear_Feature?

Also when the CBW is valid, I can read the CBW header from the
EPxFIFOBUF but after readling I can't seem to be able to flush the
buffer to recieve new data. FIFORESET, will clear the buffer but I will
loose all the data I've stored in the other buffers. OUTPKTEND = 0x82;
doesn't seem to skip the packet (is it because i've accessed it
already?).

So what would be the best way to read the EP2FIFOBUFFER and get rid of
it without resetting the buffers.

On a side note: Is there a differnce between AUTOOUT=1 and 0 when arming
OUT buffers. As far I can see in AUTOOUT=1 this will set the EP2CS to
0x48, what means all 4 buffers full. Am I correct.

Thanks for any help you can give me
--
Erick van Rijk
 > Does this mean the device will be reset at hardware level by a USB reset
 > or do I need to wait for an UNSTALL of the endpoint by a Clear_Feature?

Reset Recovery is described in USB MSC BOT 5.3.4. It's a soft-reset and 
unstall. Remember to clear data toggle too before unstalling.

I cannot comment on your specific FX2 issues as I've only written USB 
Mass Storage firmware for SX2, which is a little different.

David
Thanks for the info :)

Erick

obsna wrote:
> > > Does this mean the device will be reset at hardware level by a USB reset > > or do I need to wait for an UNSTALL of the endpoint by a Clear_Feature? > > Reset Recovery is described in USB MSC BOT 5.3.4. It's a soft-reset and > unstall. Remember to clear data toggle too before unstalling. > > I cannot comment on your specific FX2 issues as I've only written USB > Mass Storage firmware for SX2, which is a little different. > > David
-- Erick van Rijk Networked Embedded Systems TNO Physics and Electronics Laboratory Direct phone: +31 70 3740 693

Memfault Beyond the Launch