Author Topic: Device LCD appears as an MSD?  (Read 9372 times)

rallysjd

  • Member
  • ***
  • Posts: 21
    • PiXCL Automation Technologies Inc
Device LCD appears as an MSD?
« on: December 27, 2016, 11:16:58 am »
I'm working on a series of FS USB devices (ARM Cortex-M3) with LCDs (480x320 and 800x480), with a comprehensive set of around 100 HID reports for graphics and digital + analog I/O. One command sets up a report loop that transfers a screen shot to the calling app. While functional, it's v-e-r-y slow (because FS and no bulk transfer mode in HID), about 3 minutes for a 480x320x16bit LCD shot.

Your Mass Storage and USB Complete books have been a valuable resource.

I've been experimenting with firmware that implements a composite HID/MSD. Using MSD, a screen shot image equivalent can be read from the SD card in around 2 seconds, clearly better than 3 minutes.  MSD lun#0 is an SD card, and lun#1 would be the LCD graphics ram.  What I think is possible is to have Windows see lun#1 as a non-removable media device and having just one file (e.g. screenshot.pxi).

SCSI Read(10) appears to be the command that Windows (actually the driver) sends to lun#1 to request block_number and transfer_size. So here are my questions:

1. What does Windows read to decide that a Block device is accessible?  An SD card reports its block size and other relevent stuff, and eventually file names and sizes. I've set some similar values for lun#1 but Windows keeps sending device reset commands to lun#1, and lun#0 does not appear in File Explorer for about 2 minutes.

2. Translating the LCD gram space into a series of logical blocks e.g. for 480x320 this is 600 blocks of 512 bytes each, is simple enough. Because of LCD hardware design, I'd have to fill 512 byte buffers and transmit to the host.  Does this sound like a viable approach?

Thanks for any comments or suggestions.
 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Device LCD appears as an MSD?
« Reply #1 on: December 28, 2016, 10:06:16 am »
If you are programming a USB device port to function as an MSD, supporting MSD  and SCSI protocols is not trivial if you don't have example code to work from.

Multiple resets indicate a problem. Examining and emulating responses from flash drives may offer clues, but unless this is just for personal use, you will need to do much more to have a fully functioning MSD.

Other options for bulk transfers are WinUSB and virtual serial port:

http://janaxelson.com/winusb.htm

http://janaxelson.com/serport.htm#usb_virtual_com_ports

http://janaxelson.com/mass_storage.htm

I'm glad to hear you've found my books useful!