USB MSD FAT demo hangs

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

USB MSD FAT demo hangs

1,464 Views
marlonsmith
Contributor IV

Hi everyone,

I'm running the usb msd demo with a k20 chip to try and read a file from a USB drive.  When I insert the drive, it is recognized as attached, and fat_demo() is called.

Near the start of fat_demo(), there are several disk_ioctl() calls.  The section of code looks like this:

/* Send some SCSI requests first */

    disk_initialize(0);

#if !HIGH_SPEED_DEVICE

time_delay(1000);
#endif  

res = disk_ioctl(0, UFI_INQUIRY_CMD, NULL);
res = disk_ioctl(0, UFI_INQUIRY_CMD, NULL);
res = disk_ioctl(0, REQUEST_SENSE_CMD, NULL);
//res = disk_ioctl(0, UFI_TEST_UNIT_READY_CMD, NULL);       /* On some devices UFI_TEST_UNIT_READY_CMD may fail*/  
res = disk_ioctl(0, UFI_READ_FORMAT_CAPACITY_CMD, NULL);
res = disk_ioctl(0, UFI_READ_CAPACITY_CMD, NULL);

As you can see there are several disk_ioctl calls.  The code always hangs on the second one (res = disk_ioctl(0, UFI_INQUIRY_CMD, NULL);), and seems to be spinning in the _usb_khci_task() function.

Has anyone else had this problem? If I commend out that particular line, the code just hangs on the next one. It somehow makes it through the first disk_ioctl call though.

Thanks

Marlon

Labels (2)
Tags (2)
6 Replies

979 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Marlon,

Freescale USB Stack includes support for K20 devices in 50 MHz and 72 MHz versions. Could you please specify which specific example are you testing and on which IDE?

For example, if using the 72 MHz version of K20 on CodeWarrior v10.x, the full path will be:

C:\Freescale\Freescale USB Stack v4.1.1\Source\Host\examples\msd_mfs_generic\cw10\kinetis_k20_72MHz\

Best regards!

/Carlos

0 Kudos
Reply

979 Views
marlonsmith
Contributor IV

Thanks Carlos, I was able to get this problem figured out. Everything is working now.

0 Kudos
Reply

979 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Marlon,


It is good to know that you already solved your issue. Anyway, in case that you have plans to use the 72 and 50 MHz variations of K20 and K40, they have some issues regarding BDT allocation. I have attached the corrected files; it is just required to replace the old ones with these.

Best regards!

/Carlos

979 Views
raleigh
Contributor I

Hello Carlos,

I was having trouble running the msd mfs example for the K20 as well. Using CW 10.5 and the following example code:

C:\Freescale\Freescale USB Stack v4.1.1\Source\Host\examples\msd_mfs_generic\cw10\kinetis_k20_72MHz

I verified the buffer allocation table issue you described. The HardFault condition occurred at the following instruction:

*((uint_32*)BD_PTR(0, 1, ep_ptr->tx_bd) + 1) = ((uint_32)buf);

Your changes in the linker file and to khci_kinetis.c fixed the issue! Thanks a ton.

Regards,

Raleigh

0 Kudos
Reply

979 Views
embeddedarchite
Contributor I

@CarlosCasillas

Hi Carlos,

I'm using K22F 120MHz and I plan to have a USB MSD bootloader. Is there any support with this chip/frequency?

Thanks!

0 Kudos
Reply

979 Views
CarlosCasillas
NXP Employee
NXP Employee

Hello,

 

The K22F device is not currently supported on the USB Stack examples; however, the best option for porting any of the existing examples to your custom requirements is taking as base the operating frequency of the Kinetis device. In this case, it is better porting the examples from K70F120M or K60F120M devices to K22F MCU.

 

Best regards!

/Carlos

0 Kudos
Reply