How to handle write protection/errors in MSD in unified USBv2 stack?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to handle write protection/errors in MSD in unified USBv2 stack?

937件の閲覧回数
kawk
Contributor I

Hi,

I'm using the usb_v2 stack in a MQX4.2-based project on K70 with a SD card slot. Let's say it's an USB card reader.

I would like to allow the USB host access to the SD card content in two different modes: Read-only for access to drivers and documentation of the product, and Read/Write for writing setup and parametrization data. But the MSD implementation in the stack seems to support only Read/Write and no error handling?

There is no possibility to communicate to the host whether there is a medium present at all and whether it is write-protected?? Everything in this regard is hardcoded. The TEST_UNIT_READY handler in msc_test_unit_ready_command() doesn't call any custom callback. The callback for WRITE doesn't check for any errors during the operation.

If you have any hints for me how to add such functionality or derivatives of the USB stack that already support it, I'd really appreciate it!

Thanks in advance

Kolja

ラベル(2)
0 件の賞賛
返信
1 返信

596件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Coljia:

I think current USB stack not supports this feature. You need to implement it by yourself.

I would suggest you check SCSI command spec which described detailed command transferred on USB bulk endpoints. KSDK USB stack implemented SCSI command protocol.

The medium present and write protect information should be in the sense data which can be returned when you issue request sense command.

Regards

Daniel

0 件の賞賛
返信