This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Starterware/PROCESSOR-SDK-AM335X: Merging Starterware examples usb_dev_msc and hs_mmcsd

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: CSD

Tool/software: Starterware

Hi all,

    My goal is to achieve reading and writing files on SD card through usb msc dev.  In Starterware, there are two examples, usb_dev_msc and hs_mmcsd, which single build and could work.

Now merge the two examples, but it didn't work.   Any advice will be appreciated. Thank you.

More details as follow.

  1. Disk_read()
  2. Disk_write()
  3. Disk_ioctl()

these three functions in the file "usbdmscglue.c"  had been adjust for SD read, write and ioctl,  which refer to the file "fat_mmcsd.c".

maybe  not correct completely, thanks for point out something.

BR,

KEYS

  •  this had been solved, several place should be changed.

    USBDMSCStorageOpen, 

    USBDMSCStorageRead,

    USBDMSCStorageWrite,

    USBDMSCStorageNumBlocks.

    specially, when getting sector count, data style should be (unsigned long long) .

    case GET_SECTOR_COUNT:
    {
    mmcsdCardInfo *card = fat_devices[drv].dev;

    if (SD_CARD_CSD_VERSION(card))
    {
    card->tranSpeed = SD_CARD1_TRANSPEED(card);
    card->blkLen = 1 << (SD_CARD1_RDBLKLEN(card));
    card->size = SD_CARD1_SIZE(card);
    card->nBlks = card->size / card->blkLen;
    }
    else
    {
    card->tranSpeed = SD_CARD0_TRANSPEED(card);
    card->blkLen = 1 << (SD_CARD0_RDBLKLEN(card));
    card->size = SD_CARD0_SIZE(card);
    card->nBlks = SD_CARD0_NUMBLK(card);
    }
    *buff =(unsigned long long) card->nBlks;//
    break;
    }

    Thanks ~

  • Hi Key,

    I'm trying to do the same things like you.

    Could you kindly share " usbdmscglue.c"  which you modified for reference?

    Thanks a lot.

    BR,

    Rex

  • 0412.usbdmscglue.c

    Hi Rex,

    the attachment is  my usbdmscglue.c, 

    the function disk_ioctl() in  fat_mmcsd.c under  xx\fatfs\port also needs make some change as mentioned above.

    BR,

    keydongle

  • Hi Keydongle,

    Thanks for your kindly share. I can test usb_dev_msc with ramdisk successfully.

    But when modify to MMCSD. I meet "CortxA8: Unhandled ADP_Stopped exception 0x20023", try to figure out why.

    By the way, thanks a lot.

    BR,

    Rex Liao