Carlos Alexander Alvarez Dominguez

USB host MSD Hard Fault in K20

Discussion created by Carlos Alexander Alvarez Dominguez on Jan 1, 2013

The problem is as follows:


I adapted one of the examples to work with USB Stack Processor Expert, specifically "C:\Freescale\Freescale USB Stack v4.0.3\Source\Host\examples\msd_mfs_generic\cw10\kinetis_k20". I've checked the processor clock settings, I used the USB Host Stack component of the PE.


The way I adapted was creating a new project in PE and adding the libraries used in the example. I also put the pin PTC9 to 1 to enable the USB 5V.


Everything compiles, the USB get interface.


Mount the file system,


f_result = f_mount(HOST_CONTROLLER_NUMBER, &fatfs);


but when I try to open a file or do any "MFS" operation


f_result = f_open(&archivo, "/Test.txt", FA_READ);


I have a Hard Fault.


sometimes instead of a Hard Fault the program continues to run but the function f_mount returns error:



FR_DISK_ERR,/* (1) A hard error occured in the low level disk I/O layer */


That's related to "diskio.c"


I tried a PE component made by Erich Styger to trace HardFaults and trace the last executed code to a function in 'hostmain.c'.


I'm a little confused and don't know where to find.


Attached the source code to see if someone can give me a hand.


Sorry for spelling errors or syntax, (I do best reading in english than writing)

Original Attachment has been moved to: