MSC #890
Replies: 7 comments 6 replies
-
to use msc with actual flash chip, you need to implement an caching to handle 512 bytes write to erase/write 4K sector. This is implemented in C ++ (Arduino), but can be a good reference https://github.com/adafruit/Adafruit_SPIFlash/blob/master/src/Adafruit_FlashCache.cpp For simplicity, such as example that requires additional driver is not supported yet. I may do it when having more time. but not now. |
Beta Was this translation helpful? Give feedback.
-
Yeah, for the Flash chip operation is no problem, enumerated out of the U disk read and write normal. My working logic is to send the FAT table to the FLASH chip with the starting address of 0. The main problem is that I changed the number of sectors by changing the bytes 0x13~0x14 of the array in FAT table MSC_DISK. These two bytes are written as 0xF0, 0x01, and the size of the USB flash disk is only 169K, actually it should be 248K. Modify 0xF0 to 0x0C, and the size of the USB flash drive is only 169K
|
Beta Was this translation helpful? Give feedback.
-
Yes, I used this project to modify the read and write driver interface and the FAT table. The phenomenon is that the function is normal and the file can be read and write, but the enumerated U disk is not the right size.
…------------------ 原始邮件 ------------------
发件人: "hathach/tinyusb" ***@***.***>;
发送时间: 2021年6月16日(星期三) 下午5:17
***@***.***>;
***@***.******@***.***>;
主题: Re: [hathach/tinyusb] MSC (#890)
https://github.com/hathach/tinyusb/blob/master/examples/device/cdc_msc/src/msc_disk.c#L154-L160
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
FAT is modified as follows:
0xEB, 0x3C, 0x90, 0x4D, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, 0x00, 0x02, 0x01, 0x02, 0x00,
0x01, 0x00, 0x02, 0xf0, 0x01, 0xF8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x29, 0x34, 0x12, 0x00, 0x00, 'T' , 'i' , 'n' , 'y' , 'U' ,
'S' , 'B' , ' ' , 'M' , 'S' , 'C' , 0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, 0x00, 0x00,
DISK_BLOCK_NUM和DISK_BLOCK_SIZE has been modified as follows
enum
{
DISK_BLOCK_NUM = 1024*2, // 1K KB is the smallest size that windows allow to mount
DISK_BLOCK_SIZE = 512
};
…------------------ 原始邮件 ------------------
发件人: "hathach/tinyusb" ***@***.***>;
发送时间: 2021年6月16日(星期三) 下午5:58
***@***.***>;
***@***.******@***.***>;
主题: Re: [hathach/tinyusb] MSC (#890)
You have to modify FAT and update the code with block size and number of blocks too.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
You mean this method must be formatted in order to get the correct FAT? However, I encountered a strange phenomenon that the size of the U disk was indeed the size I set when I formatted, but the formatting always prompted Windows to complete the formatting, does the formatting need a special function interface function?
…------------------ 原始邮件 ------------------
发件人: "hathach/tinyusb" ***@***.***>;
发送时间: 2021年6月16日(星期三) 晚上8:32
***@***.***>;
***@***.******@***.***>;
主题: Re: [hathach/tinyusb] MSC (#890)
If you are using it with the external flash, don't use the ramdisk FAT, you should just read/write flash sector to directly to the flash device. Windows/Linux would need to format it first to get the right FAT.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Please tell me where you feel a problem may cause Windows to be unable to complete the formatting. W25QXX_Read((u8 *)buffer, lba+offset, bufsize); /W25QXX_Write((u8 *)buffer, lba+offset, bufsize); There should be no problem with the overwriting of the USB protocol. Verification on another USB stack is possible
…------------------ 原始邮件 ------------------
发件人: "hathach/tinyusb" ***@***.***>;
发送时间: 2021年6月16日(星期三) 晚上9:51
***@***.***>;
***@***.******@***.***>;
主题: Re: [hathach/tinyusb] MSC (#890)
format is only composed of WRITE10, nothing special.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
For most manufacturers, the FLM file is the same for many models. For newer models that haven't been updated yet, you can use this plugin to replace the XML file.
…------------------ 原始邮件 ------------------
发件人: "hathach/tinyusb" ***@***.***>;
发送时间: 2021年6月20日(星期天) 凌晨2:04
***@***.***>;
***@***.******@***.***>;
主题: Re: [hathach/tinyusb] MSC (#890)
I have no idea with your code, since I don't know how you implement it. However, from your response, modifying the RAM disk is not the correct approach. What you should do is actual write/read to the your flash device (W25Q) and have an 4K sector caching since windows will write in block of 512.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
-
Hi, I used CDC_MSC modification to make a DEMO that read FLASH chip. However, no matter how this FAT table is modified, it will only display 127K at most on PC. If formatted, it will prompt failure.
Beta Was this translation helpful? Give feedback.
All reactions