USB file read is slower

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

USB file read is slower

713 次查看
virendrapatel
Contributor III

Hi,..

We have a customized board based on K61fx512, We have a bootloader and application running on it.

We are using bootloader based on MQX OS which supports the USB. Bootloader code detect the USB and copy the .exe file from USB and write it to flash.

We have used demo code for USB from TWRK70 and using as USB Host for full speed mode.

Our exe is around 2.2 MB of size, and the current bootloader USB code takes almost 1 min to read the exe file from USB.

This time is very much compare to USB supported speed, we are assuming that this file should transfer in 1 or 2 sec.

Can someone tell us, why the time required to read 2MB file from USB is very high?

Thanks,

Virendra

标签 (2)
0 项奖励
回复
1 回复

510 次查看
cguarneri
NXP Employee
NXP Employee

Virendra,

The possible cause is the delay when a NAK occurs in _usb_khci_atom_tr() shown below :

   case 0x0a: // NAK

      res = KHCI_ATOM_TR_NAK;

      if (retry)

         _time_delay(delay_const * (pipe_desc_ptr->G.NAK_COUNT - retry));

   break;

A NAK is sent when the USB device is not ready to handle the request yet. The NAK interval depends on how fast the USB device can handle the request.

Therefore, if the Host is sending requests too fast and the device cannot keep up it will send NAKs more frequently.

When the NAK occurs, the _time_delay() will cause a delay before next transfer can begin, thus affecting thoughput.

You can remove this _time_delay() and set USBCFG_DEFAULT_MAX_NAK_COUNT to (3000) to avoid a large delay to improve the performance on MQX 4.x.

Try the following changes :

- Comment out the delay function (file C:\Freescale\Freescale_MQX_4_2\usb\host\source\host\khci\khci.c, function _usb_khci_atom_tr() , lines 1203-1207)

- Change USBCFG_DEFAULT_MAX_NAK_COUNT definition (file C:\Freescale\Freescale_MQX_4_2\usb\host\source\include\host_cnfg.h, line 72) to 3000

0 项奖励
回复