This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EJECT FAILURE IN STM32 USB MASS STORAGE EXAMPLE

Hi all,
I am using the stm32usb_mem keil example for USB mass storage implementation.
It is working well as mass storage device.
I found that when i right click the device to use the eject option.
I got an error message "An error was encountered trying to eject Device(G:)".
The device cannot be removed.
Anyone can solve this problem.

Thanks
Aru

Parents
  • Are you working on this Keil example?
    "STM32 USB Mass Storage Device Example"
    http://www.keil.com/download/docs/362.asp

    In your code, SCSI_MEDIA_REMOVAL (PREVENT ALLOW MEDIUM REMOVAL) is always accepted, as follows.

    void MSC_GetCBW (void) {
      ...
      case SCSI_MEDIA_REMOVAL:
        CSW.bStatus = CSW_CMD_PASSED;
        MSC_SetCSW();
    //  goto fail;
    

    Does your drive have auto-eject capability?
    If it doesn't, fail this command, as the original code does.
    MSC device doesn't need to accept every SCSI command sent by host.
    It should fail on unsupported SCSI commands.

    Rather, a problem of the original example is,
    it always returns the same SenseData of NO SENSE (Key:0x00), NO ADDITIONAL SENSE INFORMATION (ASC/ASCQ=0x00/0x00). After fail of SCSI command, it should return typical SenseData, such as,

    Sense Key, ASC/ASCQ
    NOT_READY (0x02), MEDIUM_NOT_PRESENT (0x3A/0x00)
    ILLEGAL REQUEST (0x05), INVALID COMMAND OPERATION CODE (0x20/0x00)
    UNIT_ATTENTION (0x06), NOT_READY_TO_READY_CHANGE, MEDIUM_MAY_HAVE_CHANGED (0x28/0x00)
    etc.

    Tsuneo

Reply
  • Are you working on this Keil example?
    "STM32 USB Mass Storage Device Example"
    http://www.keil.com/download/docs/362.asp

    In your code, SCSI_MEDIA_REMOVAL (PREVENT ALLOW MEDIUM REMOVAL) is always accepted, as follows.

    void MSC_GetCBW (void) {
      ...
      case SCSI_MEDIA_REMOVAL:
        CSW.bStatus = CSW_CMD_PASSED;
        MSC_SetCSW();
    //  goto fail;
    

    Does your drive have auto-eject capability?
    If it doesn't, fail this command, as the original code does.
    MSC device doesn't need to accept every SCSI command sent by host.
    It should fail on unsupported SCSI commands.

    Rather, a problem of the original example is,
    it always returns the same SenseData of NO SENSE (Key:0x00), NO ADDITIONAL SENSE INFORMATION (ASC/ASCQ=0x00/0x00). After fail of SCSI command, it should return typical SenseData, such as,

    Sense Key, ASC/ASCQ
    NOT_READY (0x02), MEDIUM_NOT_PRESENT (0x3A/0x00)
    ILLEGAL REQUEST (0x05), INVALID COMMAND OPERATION CODE (0x20/0x00)
    UNIT_ATTENTION (0x06), NOT_READY_TO_READY_CHANGE, MEDIUM_MAY_HAVE_CHANGED (0x28/0x00)
    etc.

    Tsuneo

Children