2020-10-11 03:41 AM
Hello! If I write less than 12KB #MSD works fine. If I write more than 12KB, Windows7 will ask me to format the drive. If the MSD is not reconnected to the PC, everything works fine. Everything breaks down if Ireconnect the device to the PC. Please tell me what could be wrong?
I am using flash with page size 264 B (2048 pages) [AT45DB041]
The defines looks like this
STORAGE_BLK_NBR 1024
STORAGE_BLK_SIZ 512
The write operation looks like this
int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
/* USER CODE BEGIN 7 */
AT45dbxx_WritePage(buf, 256, (uint16_t)blk_addr*2);
AT45dbxx_WritePage(buf+256, 256, ((uint16_t)blk_addr*2)+1);
return (USBD_OK);
/* USER CODE END 7 */
}
I write two pages of 256 bytes
W / R memory operations are working properly.
Memory addressing also works correctly. Checked read / write of all 2048 pages
#msd
#AT45DB
Solved! Go to Solution.
2020-10-11 04:15 AM
Do you need to erase the blocks?
Don't seem to handle multiple block writes.
Test the read/write functionality oitside of the USB operation.
2020-10-11 04:15 AM
Do you need to erase the blocks?
Don't seem to handle multiple block writes.
Test the read/write functionality oitside of the USB operation.
2020-10-11 04:34 AM
Thanks for the answer. Yes, I tested it separately. That being said, if I write files less than 12 KB, everything works well.
2020-10-13 08:42 AM
The code presented writes a single block, it will clearly fail to do the job if asked to write more than one.
blk_len is a count of 512 byte blocks