usbd_rom_msc_ram example shows wrong disk size while connecting it to PC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

usbd_rom_msc_ram example shows wrong disk size while connecting it to PC

1,166 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Idanba on Tue Feb 10 23:41:11 MST 2015
Hi,

I'm using Keil's MCB4300 eval board and trying to run the above lpcopen example.
I can see in the code that MSC_MEM_DISK_SIZE   is defined to  be ((uint32_t) (32 * 1024)) and while trying to format it ( From the PC) the size shown
is really 32KB, BUT right clicking on the mass storage device and then properties reveals the PC recognize it as 12KB.... Why is that ?
Tried to change the MSC_MEM_DISK_SIZE  but still no change.
I'm using windows 7 and LPCXpresso v7.5.0

Thanks in advance,
Idan
标签 (1)
0 项奖励
回复
4 回复数

1,145 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Idanba on Wed Feb 25 23:16:49 MST 2015
Thanks mc !
0 项奖励
回复

1,145 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Thu Feb 12 09:24:00 MST 2015
Hi Idanba,
You can store data in a buffer in the internal SRAM as done in the example. You can also increase buffer size and transfer data from SRAM to flash when it gets fill.


Quote:
Another question I have is In case we'd like to be a mass storage DEVICE, using USB ROM API, Do we have to store the data received only on RAM?


You will have to use IAP to program data in the flash



Quote:
where g_memDiskArea located on chip's SRAM.


It is in internal SRAM at 0x20004000



Quote:
Is there a way to use the USB ROM API provided but define the 'Storage' as external RAM or External flash? How would these write/read function should look like?


Yes, define buffer at external SRAM location, instead of internal SRAM. You will have to use  programming algorithm to program data in an External Flash
0 项奖励
回复

1,145 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Idanba on Thu Feb 12 02:08:47 MST 2015
Hi Wouter,

Thanks a lot for the quick answer!

Another question I have is In case we'd like to be a mass storage DEVICE, using USB ROM API, Do we have to store the data received only on RAM?
From the example given it looks like *buff_adr will only hold the address we'd like to write into rather than data itself and this address, if I understand it right, must be accessible
for the USB DMA.

static void translate_wr(uint32_t offset, uint8_t * *buff_adr, uint32_t length, uint32_t hi_offset)
{
*buff_adr =  &g_memDiskArea[(((uint64_t) offset) | (((uint64_t) hi_offset) << 32)) + length];
}
where g_memDiskArea located on chip's SRAM.

Is there a way to use the USB ROM API provided but define the 'Storage' as external RAM or External flash? How would these write/read function should look like?

Thanks again!
Idan
0 项奖励
回复

1,145 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Wed Feb 11 09:56:33 MST 2015
Hi Idan,

The physical memory of the 'drive' is 32kB, but the FAT table already takes ~20kB of that, leaving ~12kB of usable space. This usable space is what Windows reports.

Regards,
Wouter
0 项奖励
回复