USB MSC Device won't stay ejected

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB MSC Device won't stay ejected

3,031 次查看
mukelarvin
Contributor IV

I am having trouble getting my device to eject when the user ejects the USB Mass Storage Device from a PC.

I am able to observe the kUSB_DeviceMscEventStopEjectMedia event but then my device just remounts again. Is there a step that I am missing? Do I need to disable the MSC device somehow?

0 项奖励
回复
8 回复数

3,015 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @mukelarvin ,

I tested RT1060_dev_msc_ramdisk. After eject, the device doesn't mount again. How did you test?

 

Regards,

Jing

0 项奖励
回复

3,012 次查看
mukelarvin
Contributor IV

I am using the IMXRT1050-EVKB with SDK v2.10.0 and example evkbimxrt1050_dev_msc_ramdisk_bm. I get the same result using our custom board design.

The device will mount but when I press eject the device immediately remounts. I see the same behaviour on both Windows and Mac.

I added a case to catch the eject event but the stack doesn't seem to do anything with it.

case kUSB_DeviceMscEventStopEjectMedia:
eject_handler(); // increment eject count
error = kStatus_USB_Success; // the calling function doesn't even look at this
break;
0 项奖励
回复

3,000 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @mukelarvin ,

I tested on RT1050 EVKB and use SDK2.10.0 now on win10. But it is fine. It will not remount after eject.

Then I tested on Mac. It seems it has initialize problem. So, it can't eject. If click eject, the message will appear again.

 

Regards,

Jing

0 项奖励
回复

2,992 次查看
mukelarvin
Contributor IV

Hi @jingpan,

We noticed something unusual. I was right-clicking on the device in the File Explorer and selecting eject. Then my coworker tried using the eject dialog in the task bar and then it ejects cleanly.

How were you ejecting the device? I'm going to try both ways in debug and see how it behaves.

 

L.M.

0 项奖励
回复

2,968 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Yes, same with you. So, it seems a host issue. When you eject msc disk in file explorer or in eject dialog, there is nothing happened in device USB stack. The device is still in connection status. So, I think this is only a host issue. Windows/Mac tell user it is save to remove disk. Windows will not access disk any more. That's it. In your case, you needn't worry about it.

 

Regards,

Jing

0 项奖励
回复

2,933 次查看
mukelarvin
Contributor IV

This is still an issue for us because we need to know when the user ejects the Mass Storage Device because we need to remount access to the file system from the MCU. We are caching data in RAM that needs to be saved to flash before we do a power cycle.

We have decided to fully remove USB Mass Storage and switch to serial data transfer over the CDC COM port.

So the specific issue is not resolved. We have just decided to use a different interface.

0 项奖励
回复

2,925 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi @mukelarvin ,

I found that if eject in file explore, there is really nothing different. But if eject by the little dialog, USB_DeviceEhciInterruptTokenDone() interrupt and USB_DeviceEhciInterruptSof() interrupt don't come any more.

 

Regards,

Jing

0 项奖励
回复

2,986 次查看
mukelarvin
Contributor IV

@jingpan It looks like the kUSB_DeviceMscEventStopEjectMedia event isn't called when I press eject from the Taskbar. I'm still trying to see what happens in that case.

0 项奖励
回复