Author Topic: Does MSD need to implement FAT driver or just filesystem file?  (Read 5927 times)

entimaniac

  • Member
  • ***
  • Posts: 3
I'm trying to implement SCSI commands onto a VNC2 chip by FTDI for what will be a flash drive (more to come later, this is first stage). I am getting into the commands and realized I'm confused about what needs to be on my device. Am I able to statically allocate a chunk of memory to act as my storage location? And then I can just use that area for some basic reads and writes? Or do I need to set up a system of functions for doing some fun stuff? I wrote a FAT32 driver in college for a class and I remember having to do a lot of calculations based on sectors and sizes and all sorts of little pieces. If I allocate an area that holds an MBR, then Boot sectors, etc., Is that all I need in terms of the FAT system? Is it the host that takes care of all the functions for accessing, writing, and updating that data in my allocated spot? I'm sure the SCSI commands will actually be taking care of it on the device end, but will the host tell me through SCSI what areas to update? Or will I have to implement that functionality as well?

Thanks for the help!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Does MSD need to implement FAT driver or just filesystem file?
« Reply #1 on: April 21, 2016, 09:24:36 pm »
I will try to provide a more detailed response soon, but in the meantime, I want to be sure you are aware of this resource:

http://www.ftdichip.com/Support/Documents/TechnicalPublications/USBDesignByExample.htm

entimaniac

  • Member
  • ***
  • Posts: 3
Re: Does MSD need to implement FAT driver or just filesystem file?
« Reply #2 on: April 22, 2016, 09:34:36 am »
Yes, I've used that book and its included files and it really helped me get started on this project. It and FTDI's sample applications and other resources have no MSD implementations. They have support for BOMS and FAT interfaces, but only as a host.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Does MSD need to implement FAT driver or just filesystem file?
« Reply #3 on: April 22, 2016, 10:47:57 am »
The SCSI commands specify where to read and write. These quotes about the READ commands are from my book, USB Mass Storage:

In the command block, the LOGICAL BLOCK ADDRESS field specifies the LBA of the first requested block, and the TRANSFER LENGTH field contains the number of requested blocks.

On receiving a READ(10) command, a device should send the contents of the requested blocks to the host in the data-transport phase. The device doesn’t have to know or care what is in the requested blocks. All the device needs is a block number and the number of blocks to return.

entimaniac

  • Member
  • ***
  • Posts: 3
Re: Does MSD need to implement FAT driver or just filesystem file?
« Reply #4 on: April 22, 2016, 01:59:55 pm »
I appreciate all the help you give on this forum, thanks for the answer!

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Does MSD need to implement FAT driver or just filesystem file?
« Reply #5 on: April 22, 2016, 09:31:44 pm »
Happy to help!