CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CCS MMCSD & FAT32 Drivers on SD - Working for anyone?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








CCS MMCSD & FAT32 Drivers on SD - Working for anyone?
PostPosted: Mon Oct 13, 2008 10:12 pm     Reply with quote

I only want to hear from people with success using the included ex_fat.c with the mmcsd.c and fat.c (in FAT32 mode).

It's not working for me.

Thanks,

-Ben
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Oct 13, 2008 10:14 pm     Reply with quote

Gah! I thought I was logged in and it let me post.

Funky. -- anyway - let me know.

I forgot to add, I'm using CCS latest version under MPLAB 8.10 w/HPC Explorer and PICtail. (yes, I've already matched up the right #defines for the SPI lines and nCS as well as disconnected the LM74 temp sensor and it's pullup resistors on the HPC PCB)

I've been doing this with SanDisk 512MB, 1G cards.

I've had to make all sorts of additions to get even a heartbeat.. (like a correct init procedure)

The straight stock code inits, and directories don't lock up... but anything else
starts and then freezes the PIC.

I've been able to at least make it not freeze, but nothing works (init_fat and print_CID and print_CSD are sporadic at best)


Thanks,

-Ben
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: CCS MMCSD & FAT32 Drivers on SD - Working for anyone
PostPosted: Tue Oct 14, 2008 6:07 am     Reply with quote

Anonymous wrote:
I only want to hear from people with success using the included ex_fat.c with the mmcsd.c and fat.c (in FAT32 mode).

It's not working for me.

Thanks,

-Ben


Based on the above, you don't want to read my post :-)

I spent a lot of time developing FAT libraries for CCS and MCHP compilers and doing so I uncovered a hardware bug on some of Microchips SD/MMC PICTails.

**** THIS MODIFICATION ADDRESSES A HARDWARE INCOMPATIBILITY BETWEEN THE MICROCHIP AC164122 REV3 SD/MMC PICTAIL board and the MICROCHIP PICDEM HPC when fitted with a PIC18F8722 or other +5V VDD PIC ****

This modification is for SD cards that operate at 3.3 volts when working in conjunction with the HPC fitted with a PIC18F8722 PIC operating at 5.0 volts. The modification covers the removal of U1 integrated circuit which is responsible for level translation from the 5 volt PIC outputs of the SPI bus to the corresponding 3.3 volt inputs of the SD Card. U1 on the affected PICTail board is an VHCT125A manufactured by ON. According to this data sheet it's input are tolerant to 7 volts making this chip apparently a good solution as a level translator between the 5 volt PICs and the 3.3 volt SD/MMC cards. However this is not the case. When the inputs of U1 are over driven (+5volt in with 3.3Volt VDD) the switching propagation delay appears to be impacted with the result that the timing of the SPI bus is corrupted.

There are two solutions. Replace U1 with a 74xxx series device, such as the 74LCX125M, that will work correctly in this mode or replace U1 with a series of resistor dividers. Details of the latter option follows:

The modification covers the removal of U1 and installation resistor dividers on SCK, SDO and CS respectively (labels refer to the PIC). R11 (activity LED limiting resistor) is also removed as this would adversely affect the voltage divider on the CS line.

1. Remove U1 (VHCT125A)
2. Install 3.3K resistor (SMD 603) between pad U1-3 to U1-4
3. Install 3.3K resistor (SMD 603) between pad U1-6 to U1-7
4. Install 3.3K resistor (SMD 603) between pad U1-8 to U1-10
5. install 1.8K resistor (SMD 603) between pad U1-2 to U1-3
6. install 1.8K resistor (SMD 603) between pad U1-5 to U1-6
7. install 1.8K resistor (SMD 603) between pad U1-9 to U1-8
8. Remove R11 (activity LED series resistor)
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Oct 14, 2008 8:21 am     Reply with quote

Thanks for the reply.

This is a Rev. 1 PCB --- but has the VHCT125A on it - so I'm going to assume that's my culprit for all this whackiness.

I had a logic analyzer hooked to the system and it looked ok - but wow.

I'll change this out and see what the results are...

Thanks a ton,

-Ben
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Oct 17, 2008 12:28 pm     Reply with quote

I'm back.

I ordered the very parts Andrew recommended and am still where I was before.

Out of the box, the CCS drivers don't see to do anything but not work.

With reading the SD Card SPEC myself, I'm already seeing spots where the CCS drivers just didn't "follow directions".

I've had more success with pieces of code I've had to write. Oh well.

Thanks for the Help Andrew,

-Ben

p.s. If anyone has had luck with these drivers "out of the box", please feel free to share. Also, let us know which cards you were using in your testing.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Oct 17, 2008 12:50 pm     Reply with quote

You could always buy my FAT implementation for CCS. It works out the box :-)
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Fri Oct 17, 2008 1:28 pm     Reply with quote

I was helping a friend on this - so my recommendation is going to be for him to do just that.

I know the examples CCS includes are pretty much as-is, but this one should be marked with, "really really may not work in most situations - so beware."

It seems to be really that far off the mark.

By the way - on the PICtail - what kind of corruption did you end up seeing?

I'm guessing something like a data line was late in toggling behind the clock and that corrupted the data. So far, I haven't really seen anything like that (using my Agilent MSO6054a w/SPI decode).. but as a test, I even ran the SPI bus at like 200KHz (paced off timer2)

Between the old VHCT125's and these, the behavior has been pretty same.

-Ben
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Fri Oct 17, 2008 2:02 pm     Reply with quote

asmallri wrote:
You could always buy my FAT implementation for CCS. It works out the box :-)


It indeed does. No affiliation, just a satisfied customer.
olaf
Guest







...
PostPosted: Fri Oct 31, 2008 2:33 pm     Reply with quote

... finally after about 10 hours of testing my code works with mmcsd.c and fat.c.

I'm using 1gb sd card and I think I found out why some cards work and some don't.

At first: #define MMCSD_MAX_BLOCK_SIZE 512 <- needed for sd cards

Second: if you format your sd card windows sometimes creates the file system start anywhere - don't know why but happened to me,
the pic couldn't find the file system because of this.

Best way is to use winhex and to do a physical read to check if file system starts at 0x00.

now read and write works for me
ShellTox



Joined: 25 Jul 2007
Posts: 16

View user's profile Send private message

PostPosted: Wed Jan 07, 2009 7:49 am     Reply with quote

Hello

olaf can you post an example on how you initialize the card? And how you read and write a file on the card?


Thank you
AleksBak



Joined: 23 Dec 2008
Posts: 3

View user's profile Send private message

Re: ...
PostPosted: Fri Jan 09, 2009 1:18 am     Reply with quote

olaf wrote:
... Second: if you format your sd card windows sometimes creates the file system start anywhere - don't know why but happened to me,
the pic couldn't find the file system because of this.
...

Windows creates the beginning of file system as it is necessary and by rules, and that who has written this code has similar transferred it from early versions FAT, that that else worked from 5.25"disks. Smile . And consequently does not work correctly. Besides, this programmer similar very much loves functions of division and they are located everywhere where probably in a code. (Look and you are surprised how many them).
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Feb 27, 2009 10:59 am     Reply with quote

I already posted a code on another topic.

http://www.ccsinfo.com/forum/viewtopic.php?t=37463&highlight=mmc

mmc + fat32 working on 18F

regards.
_________________
Andre
fredp



Joined: 09 Nov 2005
Posts: 2

View user's profile Send private message

PostPosted: Tue May 04, 2010 12:59 am     Reply with quote

asmallri wrote:
You could always buy my FAT implementation for CCS. It works out the box :-)


Just tried buying your FAT implementation. Getting an error, though. Let me know how we can do it as I'd like to buy it.

-- Fred
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Tue May 04, 2010 7:06 am     Reply with quote

Hi fredp,

contact me by email,

regards,

Andre
_________________
Andre
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sat May 08, 2010 3:00 am     Reply with quote

fredp wrote:
asmallri wrote:
You could always buy my FAT implementation for CCS. It works out the box :-)


Just tried buying your FAT implementation. Getting an error, though. Let me know how we can do it as I'd like to buy it.

-- Fred


Sorry to hear you are having an issue with paypal. Paypal sometimes has problems with buy now buttons. You can manually make payment via www.paypal.com to the account sales@brushelectronics.com and in the comment section put the product description from our web page. Once you have done that please send me the confirmation email from paypal - this last step catches any problems with this manual method.

++++++++++++++
Should be discussed in email or PMs. Not in CCS forum.
Pls repect this.

Ref: Forum Rules No. 6, 8.

-- Forum Moderator
++++++++++++++

_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group