frdmk64f usb device ramdisk example freertos write file from code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

frdmk64f usb device ramdisk example freertos write file from code

1,031 Views
theophileleroy
NXP Employee
NXP Employee

Hello,

I've run with success frdmk64f_dev_msc_ramdisk_freertos example:

pastedImage_1.png

pastedImage_2.pngpastedImage_1.png

Next step, I want to write a text file into the ramdisk (from the code) to be read by the user on the host machine. How can I do that?

Thank you,

Théophile

Labels (1)
0 Kudos
2 Replies

824 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Theophile:

You can use f_write API to write a file.

Please refer to below link for f_write

FatFs - f_write 

Here is an example for how to use f_write.

SDK_2.4.1_FRDM-K64F\boards\frdmk64f\usb_examples\usb_host_msd_fatfs\freertos

Regards

Daniel

0 Kudos

824 Views
theophileleroy
NXP Employee
NXP Employee

I agree the problem I have is that in project usb_host_msd_fatfs\freertos the fatfs library is implemented with usb_host and not device stack. In file "diskio.c", low-level function implement function like USB_HostMsdInitializeDisk, USB_HostMsdReadDisk, etc...

In my case, I want to create the file on a USB ramdisk like device. I see that some function are also implemented for that kind of application: ram_disk_read(pdrv, buff, sector, count), ram_disk_write(pdrv, buff, sector, count), ... but I don't find the reference to them in the project

Regards

0 Kudos