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
  • > I need device removal by right-click eject, the drive should disappears from "My Computer" window.

    Umm...
    Though it isn't usual, there is no way other than soft-disconnect of the device.

    USB sticks emulate SD card readers.
    In the view point of USB, USB stick isn't a removable disk, because its medium (memory) isn't removable. But in practice, USB sticks have been implemented as removable. I believe it's because of safety, to cancel write cache. OS writes to removable disks immediately without any write cache. When a disk is accidentally plugged off, write cache increases possibility of file system inconsistency.

    After a removable drive ejects its medium, the drive itself still connects to the host PC. After CD, DVD or SD are ejected, you'll see the drive / card reader remain on "My Computer". Just like these drives, USB sticks also keep its emulated "drive" after eject. Just plug-off makes these "drives" disappear. That is, you have to plug off the stick to make it disappear.

    Firmware emulates plug-off using soft-disconnect.
    Call USB_Connect( FALSE ), after the device finishes SCSI_START_STOP_UNIT command.

    Tsuneo

Reply
  • > I need device removal by right-click eject, the drive should disappears from "My Computer" window.

    Umm...
    Though it isn't usual, there is no way other than soft-disconnect of the device.

    USB sticks emulate SD card readers.
    In the view point of USB, USB stick isn't a removable disk, because its medium (memory) isn't removable. But in practice, USB sticks have been implemented as removable. I believe it's because of safety, to cancel write cache. OS writes to removable disks immediately without any write cache. When a disk is accidentally plugged off, write cache increases possibility of file system inconsistency.

    After a removable drive ejects its medium, the drive itself still connects to the host PC. After CD, DVD or SD are ejected, you'll see the drive / card reader remain on "My Computer". Just like these drives, USB sticks also keep its emulated "drive" after eject. Just plug-off makes these "drives" disappear. That is, you have to plug off the stick to make it disappear.

    Firmware emulates plug-off using soft-disconnect.
    Call USB_Connect( FALSE ), after the device finishes SCSI_START_STOP_UNIT command.

    Tsuneo

Children
  • Hi chinzei,
    Thanks for your reply...
    I ejected the media as your suggestion..
    The device is removed from PC and its file contents are not available..but I got an error during ejection...
    "An error was encountered trying to eject Device(G:)"
    I found from the debug message after execution of these commands:SCSI_MEDIA_REMOVAL SCSI_START_STOP_UNIT,OS sends these commands for another time.
    But the media is not available,it think the MEDIA is not responding and produce the error...
    Thanks

  • Hi Chinzei,
    Thank for your discussion...
    Now the device successfully removed from "My Computer"
    Thanks