Problem with usb_host and fat32 library applicated at PIC32M

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
well77
Posts: 2
Joined: 09 Jun 2015 13:33

Problem with usb_host and fat32 library applicated at PIC32M

#1 Post by well77 » 09 Jun 2015 13:46

Hello,
I'm using a PIC32MX220F032B with the library usb_host and fat32.
I modified the example dell'usb_host commenting whole part on the display to use only the part of management usb.
I edited the section on the interrupt so:

void USB1Interrupt () iv IVT_USB_1 iLevel 7 ics ICS_SOFT {
   USBHost_IntHandler ();
   USBIF_bit = 0;
}

The software correctly detects the connection and disconnection of USB but not read anything.
After several tests I found that the routine crashes in FAT32_Init () function USBHost_MSCApplication ().
The function enters FAT32_Init () but never goes out!

What can be?


By Corrado

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Problem with usb_host and fat32 library applicated at PI

#2 Post by marina.petrovic » 10 Jun 2015 11:39

Hi,

Whether you tested default FAT32 example from FAT32 Library adjusted for the MCU which you use to be sure that FAT32 works properly?

You should first double check basic things, like whether the SD card is formatted properly and so on.
Also, you should check whether you have FAT32_Close() routine which need to be used to close an already opened file selected by fHandle.

Best regards,
Marina

well77
Posts: 2
Joined: 09 Jun 2015 13:33

Re: Problem with usb_host and fat32 library applicated at PI

#3 Post by well77 » 12 Jun 2015 08:23

Hello,
I am finally able to run the routine uninstalling libraries fat32 and usb_host and reinstalling.
Now I have another problem!
FAT32 functions do not work properly ....
The function FAT32_Open ("X_FILES.TXT" FILE_WRITE); for example works, but the function FAT32_Open ("X_FILES.TXT" FILE_APPEND); does not allow you to add data to the file, in fact, the file is damaged and you can not open it!
I also tried FAT32_Format ("DEVICE"); but does nothing formatting, FAT32_Delete ("X_FILES.TXT"); not delete the file ....
Also memories usb 8 and 16 GB are blocking everything! I note when I plug the usb but the program goes into loop somewhere without turning the main and not recognizing more if I remove the USB.
Use the PIC32MX220032B, I used your example but you have it created for PIC32MX795F512L, FAT32 The library needs to set for my PIC32MX220032B?

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: Problem with usb_host and fat32 library applicated at PI

#4 Post by marina.petrovic » 29 Jun 2015 13:37

Hi,

I wasn't able to reproduce the same behavior which you describe with FAT32_Open ("X_FILES.TXT" FILE_APPEND); routine.
I tested it on PIC32MX795F512L for which default example is written.

Yes, like I mentioned in my previous answer, you need to adjust simple example for the MCU which you use in order to test it.

We have successfully tested FAT32 library with 2GB, 4GB and 8GB microSD cards.

Mass Storage Device example from USB Host library is tested with some "older" flash drives (for example, ST 1GB).
Unfortunately, there are some problems with FAT32 Library and newer version of flash drives.
You can find more detailed explanation on this forum topic:
http://www.mikroe.com/forum/viewtopic.p ... 93#p246293

Best regards,
Marina

Post Reply

Return to “Libstock Discussion”