问答

汇集网友智慧,解决技术难题

hedan12

TA的家园币:46  

  • GD32F470ZG外部flash模拟U盘,每次插拔都要重新格式化?

    用的官方例程SRAM模拟U盘,官方的每次插拔不会掉格式,我改的外部flash,不清楚为什么每次插拔都要重新格式化,但是格式化后又能正常往里面放文件,读文件都是正常的#defineSTORAGE_BLK_NBR512#defineSTORAGE_BLK_SIZ4096staticint8_tSTORAGE_Read(uint8_tLun,uint8_t*buf,uint32_tBlkAddr,uint16_tBlkLen){spi_flash_buffer_read(buf,BlkAddr*STORAGE_BLK_SIZ,BlkLen*STORAGE_BLK_SIZ);return0;}/*!\briefwritedatatothemedium\paramLun:logicalunitnumber\parambuf:pointertothebuffertowrite\paramBlkAddr:addressof1stblocktobewritten\paramBlkLen:numberofblockstobewrite\param[out]none\retvalstatus*/staticint8_tSTORAGE_Write(uint8_tLun,uint8_t*buf,uint32_tBlkAddr,uint16_tBlkLen){//spi_flash_sector_erase(BlkAddr*STORAGE_BLK_SIZ);W25QXX_Write(buf,BlkAddr*STORAGE_BLK_SIZ,BlkLen*STORAGE_BLK_SIZ);return0;}并且我给2M,格式化前2M,格式化后变1.98了

    国产芯片 GD USB flash

    2023-10-17 2