Hi everyone,
I have a custom board which has a USB connection and a micro SD card connection. I am currently collecting
data on the micro SD card (as a data logger), but I would also like be able to insert a USB stick and read a file
from it and/or be able to create a file and write to it.
I am confused if I should be following a USB host example project or should I be using the device example project?
These are both located in the Kinetics->KSDK_1.3.0->examples->frdmk64f->demo_apps->usb
I need for both the existing SD card code working and the USB (host or device) code working, both will be using
the Chang FatFs.
Can someone help me on this?
Neil
I don't know whether or not you ever found any of the items that you were looking for. FatFs talks to a file called "diskio.c" which is included in the FatFs folder of the SDK. "diskio.c" talks to some combination of "fsl_mmc_disk.c", "fsl_ram_disk.c", "fsl_sd_disk.c", "fsl_sdspi_disk.c", and "fsl_usb_disk.c" depending on which physical device types you want to interact with as a FAT file system. All of these files are in the SDK as well (<sdk dir>\middleware\fatfs_0.12b\src). There are several other files that you will need to add to your project as well: event.c, fsl_sd.c, fsl_sdmmc.c, get_fattime.c. The two "fsl_*" files can be found in the SDK (along with the additional header files that they reference: fsl_card.h, fsl_specification.h, sdhc_config.h). The "event.c" file must be written by you, but at least a couple of examples of this file are included in the SDK tree. I am still looking for an example implementation of the get_fattime() function.
I would encourage you to visit the FATFS web site as a newer version is available (0.13) along with 2 bug fix patches. Beyond that, I cannot be much help to you--I have only ever tied FATFS to an SD card, so the missing USB libraries are outside of my experience. Hope this helps, even though this doesn't address your original question.
Thank you Don,
I am at the point where I am able to use the FATFS on the USB and I tied all the USB libraries. Unfortunately, I been struggling with an example
I am following. The example uses Tasks which is part of the OS, although the project was written for Baremetal??? Weird!!! Anyways, it seems
that once the example project starts working, its locked in a endless loop that does not come out. I am trying to figure out how to make it come
out that way I can service other routines in my application.
Neil
What problem are you having? Are you using FreeRTOS? I have a bit of experience w/ FreeRTOS, so maybe I could help.
Hi Don,
Take a look at this thread: https://community.nxp.com/thread/461422
The example I am following doesn't use FreeRTOS, is BM(Bare Metal), I fully explain what is happening in the thread.
Any help will be great.
Neil
Hi Neil:
If you need to write to/ read from a file from USB stick, usb stick is a device, your custom board is a host.
You can check the msd_fatfs demo
KSDK_1.3.0\examples\frdmk64f\demo_apps\usb\host\msd\msd_fatfs
Regards
Daniel
Hi Daniel,
Thank you for pointing me in the right direction. I will take a look at the demo application and
see how its done.
Do you know if I can have both the SD card and the USB working simultaneously using the same
FatFs from Chang?
Regards,
Neil
Hi Neil Porven
In theory it is possible to write into several different physical disc, but I have never tried it in practice.
Regards
Daniel
Hi Daniel,
I imported the project and noticed that the fatfs file did not contain the file fsl_usb_disk, which contains
the msd_diskio.c and .h files. My first question is of course aren't these files needed?
Second, after I compiled the project, it complained about the following library libusbh_bm.a I noticed that
a Read.pdf document in the sample project stated that the following libraries are needed:
<install_dir>/usb/usb_core/host/lib/bm/<tool_chain>/<soc_name>
<install_dir>/lib/ksdk_platform_lib/<tool_chain>/<platform>
I have some questions regarding this:
1. Where am I suppose to place these libraries and how?
2. What do these libraries do for the project itself?
Thank you,
Neil
Thank you Daniel.