Page 1 of 1

UFI/CBI via EHCI: Status-Phase stalls ... WHY?

Posted: Fri Nov 26, 2010 6:08 am
by edonner
Hi,

I've got a Sony USB floppy drive and want to access it with my own OS-Code. I just wrote an "OS Loader" - a simple thing running without interrupts and memory-manager so far.
I succeeded with EHCI and UHCI: I wrote the controller-drivers (EHCI & UHCI), a usb-driver and a MSB-diver. I can succesfully call INQUIRY(), READCAPACITY() and READ() on USB-Sticks.

And now I'm working on UFI/CBI. INQUIRY() works too and returns successfully:


CONTROL-PHASE:
* ADSC is accepted
* Data-Out is accepted
* Status is OK

BULK-PHASE:
* Data-In with Inquiry-Data is successful

INTERRUPT-ON-COMPLETE
* Data-In via Interrupt-Endpoint is successful

But when I send e.g. ReadCapacity, StartStop, TestUnitReady or Read10, the controller behaves as follows:

CONTROL-Phase:
* The ADSC is accepted
* The data-stage is accepted
* The Status-stage says "STALLED"

Because the USB- and Controller-Software work well for Mass-Storage-Bulk, I assume to have a general problem in my understanding of UFI/CBI.
Has anyone experiences with that, could anybody please help?

Thanks & regards,
Enrico.

Re: UFI/CBI via EHCI: Status-Phase stalls ... WHY?

Posted: Fri Nov 26, 2010 3:46 pm
by XanClic
I have experienced the same conditions, and my solution was to simply ignore it (Linux does this, too, afaik). After I've received a STALL, I'm using SENSE (discarding the data). I'm repeating this process until the STALL disappears or the SENSE itself STALLs.

I hope this helps you. :)

Re: UFI/CBI via EHCI: Status-Phase stalls ... WHY?

Posted: Sat Nov 27, 2010 4:54 am
by edonner
Hi XanClic,

thanks for the hint - I'm going to try it and let you know!

Just ignoring the stalled status causes new problems somewhere in my code which I have to investigate before trying the SENSE().
When I ignore the STALL from the Control-Transfer's Status-Stage and enter the BULK-Phase, my OS crash's. I really do not know
yet why but I assume that the UHCI-Controller raises an interrupt when I force a Bulk-Transfer after a stalled Control-Transfer. And
it seems, this interrupt is not handled correctly by my OS. Otherwise: How could a EHCI/UHCI-Controller be able to crash a OS.
Must be an interrupt, I thought that I read something about a non-maskable UHCI-Int. Have to investigate!

Thank you & best regards,
Enrico.

Re: UFI/CBI via EHCI: Status-Phase stalls ... WHY?

Posted: Sat Dec 04, 2010 10:51 am
by edonner
Hi all,

I did some further investigations. One thing I should have done much earlier is to check the ASC returned in the interrupt-phase of the CBI. I did it now and ASC = 29 "POWER ON RESET OR BUS DEVICE RESET OCCURRED". Yes, when setting up the UHCI-Controller I reset controler & ports. So my Sony-Floppy seems to react properly. But now: How shall a UFI-Device being set up after a reset on the bus? I guess there's a sequence of UFI-commands to keep - do I need to start with MODE SENSE / MODE SELECT?

Thanks & regards,
Enrico.