cancel
Showing results for 
Search instead for 
Did you mean: 

USB MSC Device to SD card with 1024 block size SD

jmasriera
Associate II
Posted on March 21, 2017 at 09:56

Hi.

I'm working with a test application that is a USB MSC device, the device is the SD card. The code is created by Cube. It works fine with SD cards wit 512 block size. Now I have a 1024 block size SD and it doesn't work. I think that the problem is in SCSI_ProcessRead function, because, hmsc->scsi_blk_len = 1024, MSC_MEDIA_PACKET = 512 and hmsc->scsi_blk_size = 1024, so len = 512 and when calls the Read function the number of blocks to read is 0 (512 / 1024). I've tried to set MSC_MEDIA_PACKET = 1024 but it doesn't work.

How can I solve this problem?

/**

* @brief  SCSI_ProcessRead

*         Handle Read Process

* @param  lun: Logical unit number

* @retval status

*/

static

 

int8_t

 

https://developer.mbed.org/users/NirT/code/F7DISCO_Demo/docs/c00e6c923941/group__MSC__SCSI__Private__Functions.html&sharpga8402e33a14156a6d9a3c2c431df9a6d0

 (USBD_HandleTypeDef  *pdev, 

uint8_t

 lun) {

  USBD_MSC_BOT_HandleTypeDef  *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData;

 

uint32_t

 len;

  len = MIN(hmsc->scsi_blk_len , MSC_MEDIA_PACKET);

 

if

( ((USBD_StorageTypeDef *)pdev->pUserData)->Read(lun ,

                              hmsc->bot_data,

                               hmsc->scsi_blk_addr / hmsc->scsi_blk_size,

                              len / hmsc->scsi_blk_size) < 

0

)   {

...

#sd-card #usb-msc
0 REPLIES 0