AnsweredAssumed Answered

STM32CubeF7 v1.6.0 USB MSC Device Example bug(incorrect total sector number)

Question asked by Nemui Trinomius on Apr 4, 2017
Latest reply on Apr 4, 2017 by Imen D

Dear ST support team,

I found minor bug on CubeF7 v1.6.0.
Bug found at ./STM32Cube_FW_F7_V1.6.0/Projects/STM32746G-Discovery/Applications/USB_Device/MSC_Standalone/Src/usbd_storage.c

diff -urN b/usbd_storage.c a/usbd_storage.c
--- b/usbd_storage.c 2016-12-31 02:35:58 +0900
+++ a/usbd_storage.c 2017-04-04 23:57:44 +0900
@@ -124,7 +124,7 @@
{
BSP_SD_GetCardInfo(&info);

- *block_num = info.LogBlockNbr - 1;
+ *block_num = info.LogBlockNbr;
*block_size = info.LogBlockSize;
ret = 0;
}


In STORAGE_GetCapacity(),it should return "total sector number".
Thus it is not suitable to return "last sector address"(by info.LogBlockNbr - 1) here.

 

"Last sector address" returns on SCSI_ReadCapacity10() or SCSI_ReadformatCapacity() in
./STM32Cube_FW_F7_V1.6.0/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c

 

I noticed this bug while evaluating industrial SDCard with S.M.A.R.T.
AFAIK,CubeF4 also have this bug(maybe other Cubes...).
Please fix until next release.

 

Best regards,
Nemui.

Outcomes