How do I enable High Speed USB using FSL 1.0.2 bootloader for MK64FN1M0VMD12 ?

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

How do I enable High Speed USB using FSL 1.0.2 bootloader for MK64FN1M0VMD12 ?

Jump to solution
1,218 Views
nitinharish
Contributor V

Folks (Mark Butcher:mjbcswitzerland)

How do I enable High Speed USB data transfer on MK64FN1M0VMD12 FSL bootloader ?

I have tried by enabling it by defining MCU_MK70F12 in the project and changing the user_config.h in USB folder

#if !defined(HIGH_SPEED_DEVICE)

     #if (defined MCU_MK70F12) || (defined __MCF52277_H__)

              #define  HIGH_SPEED_DEVICE    (1)

     #else

              #define  HIGH_SPEED_DEVICE    (0)

     #endif

#endif

But this does not compile, get lots of errors e.g.: Error[Pe020]: identifier "USBHS_DEVICEADDR" is undefined \bootloader\src\usb_device\driver\kinetis\usb_dci_kinetis.c 239

Labels (2)
1 Solution
835 Views
mjbcswitzerland
Specialist V

Nitin

I don't actually know the FSL code (the KBOOT-HID operation can be reverse engineered to any Kinetis device in a couple of hours just by looking at the traffic with a USB analyser) but I just checked and found the code where it is set. It is in

FSL_Kinetis_Bootloader_1_0_2\src\usb_device\hid\usb_descriptor.c


in


uint_8 USB_DESC_CONST g_config_descriptor[CONFIG_DESC_SIZE]

   /*IN Endpoint descriptor */

   ENDP_ONLY_DESC_SIZE,

   USB_ENDPOINT_DESCRIPTOR,

   HID_IN_ENDPOINT|(USB_SEND << 7),

   USB_INTERRUPT_PIPE,

   HID_ENDPOINT_PACKET_SIZE, 0x00,

   0x0A,

 

   /* OUT Endpoint descriptor */

   ENDP_ONLY_DESC_SIZE,

   USB_ENDPOINT_DESCRIPTOR,

   HID_OUT_ENDPOINT|(USB_RECV << 7),

   USB_INTERRUPT_PIPE,

   HID_ENDPOINT_PACKET_SIZE, 0x00,

   0x0A

The OUT interrupt polling rate is important so that the host can send more frequently. 0x0A means once every 10ms (actually 8ms since USB doesn't do 10) so change this to 1 instead.

You could see what effect the IN endpoint rate has too - I left it at 10 but you may find that 1ms livens up the protocol response time on top of the faster data transmission.

Regards

Mark

View solution in original post

6 Replies
835 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Nitin,

Current Kinetis bootloader V1.0.2 only supports USB full speed device.

If you want to use USB high speed device, Freescale USB stack V4.1.1 provides high speed module driver at default path:

C:\Freescale\Freescale USB Stack v4.1.1\Source\Host\source\driver\kinetis\ehci

More detailed info about Freescale USB stack V4.1.1, please check below link:

USB Stack|Freescale


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
835 Views
nitinharish
Contributor V

Thanks Hui

Can you please let me know, what is the tested speed for Full Speed USB in FSL 1.0.2 ?

I cant find any released document that states it.

My issue is the USB FSL 1.0.2 (full speed) takes about 27 seconds to send a 400KB file (CRC is disabled), that is really poor.

I want to increase that and understand the source of this huge delay.

Thanks and Regards

Nitin Harish

0 Kudos
835 Views
mjbcswitzerland
Specialist V

Nitin

The K64 has a FS USB interface and not a HS one (compare with the HS one in the K70 [which has both a FS/LS and a HS one, which needs an external transceiver] as comparison).

The reason why the KBOOT HS loader is so slow is because the OUT interrupt endpoint is set up too slow - if I remember correctly it is set for 10ms interrupt polling rate which means that only a small block of data is transferred and programmed each 10ms. On top of that the KBOOT protocol's handshaking adds additional time overhead (the old Freescale HIDloader.exe achieves much faster programming speeds).

If you change the endpoint configuration from 10ms to 1ms you should find a x8 increase in speed.

At least this is what I did in the uTasker serial loader's KBOOT-HID mode to stop it being so sluggish and I assume that it won't cause any problem in the FSL version either.

Regards

Mark

835 Views
nitinharish
Contributor V

Thanks Mark, and I was waiting for you to show up.

Where is the location of this endpoint configuration ? (Sorry new to the USB world)

0 Kudos
836 Views
mjbcswitzerland
Specialist V

Nitin

I don't actually know the FSL code (the KBOOT-HID operation can be reverse engineered to any Kinetis device in a couple of hours just by looking at the traffic with a USB analyser) but I just checked and found the code where it is set. It is in

FSL_Kinetis_Bootloader_1_0_2\src\usb_device\hid\usb_descriptor.c


in


uint_8 USB_DESC_CONST g_config_descriptor[CONFIG_DESC_SIZE]

   /*IN Endpoint descriptor */

   ENDP_ONLY_DESC_SIZE,

   USB_ENDPOINT_DESCRIPTOR,

   HID_IN_ENDPOINT|(USB_SEND << 7),

   USB_INTERRUPT_PIPE,

   HID_ENDPOINT_PACKET_SIZE, 0x00,

   0x0A,

 

   /* OUT Endpoint descriptor */

   ENDP_ONLY_DESC_SIZE,

   USB_ENDPOINT_DESCRIPTOR,

   HID_OUT_ENDPOINT|(USB_RECV << 7),

   USB_INTERRUPT_PIPE,

   HID_ENDPOINT_PACKET_SIZE, 0x00,

   0x0A

The OUT interrupt polling rate is important so that the host can send more frequently. 0x0A means once every 10ms (actually 8ms since USB doesn't do 10) so change this to 1 instead.

You could see what effect the IN endpoint rate has too - I left it at 10 but you may find that 1ms livens up the protocol response time on top of the faster data transmission.

Regards

Mark

835 Views
nitinharish
Contributor V

You are just plain AWESOME.

Thank you so much.

0 Kudos