2017-03-21 01:56 AM
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
(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