Open amirhammad opened 9 years ago
Hi,
First of all, thanks for releasing this great library! I'm very interested in using the MSC driver. Unfortunately, it doesn't work with any of the USB mass storage drives I have available.
I'm running the library on an STM32F429I-DISCO board. Other drivers, like the one for Xbox controllers, work fine.
Here's a log of the debug output:
waiting 5335300 < 5333700
waiting 5338900 < 5333700
waiting 5342600 < 5333700
RESETPENCHNG
DEVICE FOUND
ENUMERATION OF DEVICE@1 STARTED
Sending[8]: 00 05 01 00, 00 00 00 00,
->WRITE 80100040
WR@device...0 |
ACKXFRC::0::RD@device...0 |
DATA: ACKXFRCADDR: 1
Sending[8]: 80 06 00 01, 00 00 12 00,
->WRITE 80500040
WR@device...1 |
ACKXFRCRD@device...1 |
DATA: 12 01 00 02 00 00 00 40 8F 05 87 63 05 01 01 02 03 01 ACKXFRC
Sending[8]: 80 06 00 02, 00 00 40 00,
->WRITE 80500040
WR@device...1 |
ACKXFRCRD@device...1 |
DATA: 09 02 20 00 01 01 00 80 64 09 04 00 00 02 08 06 50 00 07 05 01 02 40 00 00 07 05 82 02 40 00 00 ACKXFRCTOTAL_LENGTH: 32
DEVICE DESCRIPTORINTERFACE_DESCRIPTOR
ANALYZE[1][2][4][5][5]Device Initialized
Sending[8]: 00 09 01 00, 00 00 00 00,
->WRITE 80500040
WR@device...1 |
ACKXFRC|empty packet read|RD@device...1 |
DATA: ACKXFRC
msc CONFIGURED
GET_MAX_LUN
Sending[8]: A1 FE 00 00, 00 00 01 00,
->WRITE 80500040
WR@device...1 |
ACKXFRCRD@device...1 |
DATA: 00 ACKXFRC
MAXLUN= 0
~~~ READ_CAPACITY
Sending[31]: 55 53 42 43, 03 00 00 00, 08 00 00 00, 80 00 0A 25, 00 00 00 00, 00 00 00 00, 00 00 00 00, 00 00 00
->WRITE 00580840
ACKXFRCCBW succeed
STALL
Disabling channel 0
UNHANDLED_ERROR 3: file: libusbhost/src/usbh_driver_msc.c, line: 565
CHH
I have slightly changed the error message. This means cb_data.status
is 3
in STATE_TRANSACTION_READ_CAPACITY_COMPLETE
. I have another drive that stops with the same error, but only after adding this little work-around to re-send the message:
In usbh_driver_msc.c line 486:
case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
LOG_PRINTF("retry cbw send\n");
cbw_send(msc, NULL);
break;
And in the same file:
static void cbw_send(msc_device_t *msc, struct _usb_msc_cbw *cbw)
{
static struct _usb_msc_cbw lastCBWMessage;
if (cbw != NULL) {
lastCBWMessage = *cbw;
} else {
cbw = &lastCBWMessage;
}
static uint32_t tag = 0;
// ...
Before adding this fix, it returned 2
in STATE_TRANSACTION_CBW_COMPLETE
.
Any ideas how this could be fixed?
Hi! the MSC driver is not yet released into the master branch in the official repo because it is not fully working. However, reading of the data from flash disk was working fine when I had been trying it the last time. When I tried to write, STALL condition was put on the bus. That means fatal error reported from the device. Now I tried it with three different usb flash disks.
Please retest using branch devel-msc-fat . It was updated now with the fixes from master.
You can use some flash disk formatted to FAT, place file X.txt
to the root directory of the flash disk.
Application on uController should read it(see demo.c) a print its contents to the console.
If the problem persists, please provide sudo lsusb -v
(I assume you are using unix) with the usb stick inserted.
Mass storage class capability with required commands supported