2015-06-12 09:24 AM
For access to the data SD-card from side the MCU is used a FATFs technology. From the PC side is used USB mass storage device (MSD) with direct access to data from SD-card without FAT system on the MCU.
To guarantee only one access to methods SD card is used following code:
HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
if(SD_state == MSD_OK)
{
/* Write block(s) in DMA transfer mode */
if(HAL_SD_WriteBlocks_DMA(&hsd, pData, WriteAddr, BlockSize, NumOfBlocks) != SD_OK)
{
SD_state = MSD_ERROR;
}
else
{
SD_state = MSD_OK;
}
}
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
When MCU is create or modify files on SD-card, data in the browser from the PC side don't updated. It's refresh is only when plug of USB cable is remove and insert. How can i update data on the browser without remove and insert of a USB cable?
2015-06-12 09:41 AM
I guess you'd need to write some Windows drivers and file system drivers to manage the incoherency you've caused.
You could get the MSC to throw a SENSE ERROR indicating that the media changed?2015-06-13 09:29 AM
My device is doing some measuring and have saved results on the SD-card. When measure is finished i can reset MSD to show Windows browser is data have been changed. I can't understand what is SENSE ERROR, where can i find it?
2015-06-13 10:04 AM
You'd want to review the SCSI command protocol used here, probably the ATAPI/MMC specification, which breaks down a list of SENSE CODEs the device can throw in case of error or status conditions it wishes to tell the PC side driver stack.
2015-06-13 10:47 AM
I saw all file usbd_mcs_scsi.c, but can't find any command for my task.