I am trying to implement a mass storage device driver on an mcf5272 processor.
I use the endpoint 2 for bulk input and output, while endpoint 1 is used
for the HID interface by an example from freescale - motorola.
Is it possible that endpoint 2 bulk is starved because of endpoint
1 traffic ?
Currently , the device passes enumeration, and receives the Command Block
Wrapper CBW on endpoint 2 OUT. I read the CBW: it contains the SCSI Inquiry
request and an expected length of 36 bytes. The direction bit in the CBW
message is set to IN.
After the CBW is read, I check the direction in the endpoint 2 status register
EP2ISR. It says that the endpoint is currently configured in OUT direction.
After this I try 2 approaches:
1. To wait until there is an interrupt which sets the endpoint 2 to IN
direction. This seems to be somehow connected with IN EndOfTransfer
or IN EndOfFrame event.
However, the IN interrupt for endpoint 2 does not happen,
altough endpoint 0 changes to IN state many times.
2. To change the direction bit in EP2ISR manually and write the data in the
endpoint 2 data register EP2DR. The direction does not change however, after
writing to EP2ISR [DIR]
I clear the EP2CTL [IN_DONE] after the data is written to the ep2
data register so the data can be sent to the host.
[Also I tried to set the EP0CTL [CMD_OVER] bit, to try to ACK
the CBW command, but this still does not change the direction
of endpoint 2 to IN. ]
On the output of the USB analyzer it can be seen that the
OUT transfer of CBW request is completed and ACKed but the IN transfer
does not happen, altough the data has been written to the FIFO and
the EP2CFG [IN_DONE] bit has been cleared. On the analyzer it can be seen
that the host sends IN tokens, but there is no response from the device.
So my question is:
1. Should I wait for the interrupt that sets endpoint 2 to IN mode
before trying to write to the data register.
2. Should I manually ACK the host OUT transmission, before the
IN bytes can be sent.
3. It says in one example that the response to SCSI Inquiry should be
wrapped inside the Command Status Wrapper of the Mass Storage Class.
However, the CSW only has 13 Bytes. So I suppose that the SCSI
response should be sent before sending the CSW and that the CSW message
should only contain the SCSI request status. Is that correct ?
Thanks for any help.
« on: Today at 01:57:38 am »
|Quote Modify Remove|