Hi Everyone,
I would like to do a USB driver on a K64F that is capable of copying a file into a USB Stick.
I found the following documentation: Creating a New USB project with KSDK and Processor Expert support in KDS
Unfortunately, this example uses Processor Expert, but I can't use Processor Expert on my application. The other
thing is that this example was done for a mouse and not a USB stick. I looked in the KSDK_1.2.0 and the only
other device is a keyboard application. The other thing would be being able to create a file in the USB stick before
I can transfer the information into it.
Has someone done this, has documentation on doing this?
Thanks
Neil
Hi Neil:
Have you solved this issue? Can I suggest you download the latest KSDK? It is more stable and easier to use.
There is one example in the installation folder, it executes some FatFS APIs to test the attached device. You can check the read me file under this folder.
SDK_2.2_TWR-K64F120M\boards\twrk64f120m\usb_examples\usb_host_msd_fatfs\
You can download the latest MCUXpress ( KSDK) from the below link
Welcome to MCUXpresso | MCUXpresso Config Tools
Regards
Daniel
Hi Daniel,
Yes this issue was resolved, now I am fighting with the other post you answered.
As far as moving to the latest KSDK, I don't want to do just yet. I have the SD card portion working on
the KSDK_1.3.0 and I would like to get the USB msd portion working on the same KSDK, so that I am
not creating more issues on top of something that is already working.
Thank you for picking up this post.
Neil
Update,
I was able to get some of the errors removed, by adding additional paths and by copying a
new descriptor.c and descriptor .h file. Since I want the USB driver to be a host and not a
device as in the MOUSE example being used, I copied the descriptor.c and descriptor.h
files from the following project "frdmk64_usb_msd" which can be found in the forum by doing a
search. Once I recompiled, I was still getting an error here:
uint8_t g_config_descriptor[CONFIG_DESC_SIZE] =
{
/* Configuration Descriptor Size - always 9 bytes*/
CONFIG_ONLY_DESC_SIZE,
/* "Configuration" type of descriptor */
USB_CONFIG_DESCRIPTOR,
/* Total length of the Configuration descriptor */
USB_uint_16_low(CONFIG_DESC_SIZE), USB_uint_16_high(CONFIG_DESC_SIZE),
/* NumInterfaces */
CONFIG_DESC_NUM_INTERFACES_SUPPOTED,
/* Configuration Value */
1,
/* Configuration Description String Index */
0,
/* Attributes.support RemoteWakeup and self power */
(USB_DESC_CFG_ATTRIBUTES_D7_POS) | (USBCFG_DEV_SELF_POWER << USB_DESC_CFG_ATTRIBUTES_SELF_POWERED_SHIFT) | (USBCFG_DEV_REMOTE_WAKEUP << USB_DESC_CFG_ATTRIBUTES_REMOTE_WAKEUP_SHIFT),
/* Current draw from bus */
Apparently USBCFG_DEV_SELF_POWER and USBCFG_DEV_REMOTE_WAKEUP are not defined in the descriptor.h file. This I found very
strange, because it means the person who did this did not compile this file because they would have realized that these were not included. Weird??? Anyways, after doing a search, I came across this: dash-user-boot/usb_device_config.h at master · hologram-io/dash-user-boot · GitHub which did have the above missing includes and I added them to the descriptor.h file and re-compiled and now the compiler did a
successful compile.
Update,
Using the following example: Creating a New USB project with KSDK and Processor Expert support in KDS, I been trying
to build a USB project that is Bare Metal (no PE). Unfortunately, after fighting multiple issues, I compiled the example and
have the following errors coming from usb_descriptor.c and usb_descriptor.h:
I am not even sure if I need to include usb_descriptor.c and usb_descriptor.h. The example was used
for a Mouse device (HID) and I am trying to use an USB stick device (MSD - Mass Storage Device).
Can someone tell me if I need to even include the descriptors and if so, why am I getting these errors.
By the way, here is a picture of my include paths:
Thanks,
Neil
Update,
The KSDK_1.2.0 has a MSD folder and I am hoping that it is the Mass Storage Device driver that I need. Can someone
from NXP confirm this.
Thanks,
Neil
Update,
Using the USB stick should have been device class: Mass storage