View previous topic :: View next topic |
Author |
Message |
arunkish
Joined: 23 Dec 2008 Posts: 83
|
Working FAT16 or FAT32 Library needed |
Posted: Mon Jun 17, 2013 1:16 am |
|
|
Dear All
I am using 18F4620 clocked at 20 Mhz - Compiler Version 3.2. I am trying to work with FAT16 / FAT32 libraries posted on the forum and none of them works for me.
Hardware has no issues, since the hardware works with my previous program that writes and reads sectors using multiple block read/write command. However it works in RAW mode.
Right now, as I said I am trying to work with FAT file system and can anyone give me a link or post some source code that works for v 3.22 with 18Fxxxx please.
Thanks |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Jun 17, 2013 2:34 am |
|
|
I'm afraid hardware...... (evil grin)
Problem is that I'd guess your 'previous program', was using _software SPI_.
The drivers from CCS, and most other sources, use the SPI hardware port.
There is a 'key difference'. The software implementation accepts a signal as 'high', if it is above 2v (on your chip, on a standard pin). The hardware interface, _requires_ the signal to go up to 4v, before it is seen as 'high'. The 3.3v SD card, can't do this without a buffer chip.
Now, they use the hardware port, since it is enormously faster (typically anything up to perhaps 30* the speed).
Look at the design her:
<www.smallridge.com.au/download/BE_Reference_Design_PIC18F4620_ENC28J60.zip>
Look at the second page, which has the SD card interface. Note the use of the 74ACT125D on the SO line. This or an equivalent is _required_ to get the hardware interface to work.
Also, as a comment, this is BrushElectronics, and his drivers are for a small fee, 'excellent', since they handle the extra complexities of SDHC as well. No connection, just a user who decided not to waste my time 're-inventing the wheel', when I went from SD to SDHC.....
Best Wishes |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Mon Jun 17, 2013 2:53 am |
|
|
Thank you...
FYI, I have used Hardware SPI for my old program. I will still check with the hardware as you said. By the way can you please provide me for the working / tested code and library for Fat16 or Fat32. Compiler V 3.222, PIC18F4620 |
|
|
oxo
Joined: 13 Nov 2012 Posts: 219 Location: France
|
|
Posted: Mon Jun 17, 2013 3:00 am |
|
|
arunkish wrote: | Thank you...
FYI, I have used Hardware SPI for my old program. I will still check with the hardware as you said. By the way can you please provide me for the working / tested code and library for Fat16 or Fat32. Compiler V 3.222, PIC18F4620 |
http://www.smallridge.com.au/#SDUTIL |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Mon Jun 17, 2013 3:15 am |
|
|
Question.
How big is the SD card?.
The CCS libraries do basically work. There are problems if the card is not formatted in a rather minimal way (partial fixes for that in the group), but they do fundamentally run.
However they _only_ support SD. Probably 90+% of cards now sold, are SDHC. If the card is 4GB or larger it will be SDHC.
Unless you have a buffer on SDO though, the hardware SPI port can't work with a 4620 at 4.2v or more (which is required for 20Mhz operation). You were probably using software SPI, and not realising it.
Best Wishes |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
Posted: Mon Jun 17, 2013 8:06 am |
|
|
The size of the card is 2 GB.
Instead of checking it in real hardware, I am trying to compile the library and run it at least in Proteus which fails all the time. I googled and found some information about the Mikroe library, when I tried it all the functions performed well in Hardware as well as Proteus. But I don't want to use mikroe. Please advise me on the library that I can use in CCS in which at least i can create and read the contents of a file please. |
|
|
arunkish
Joined: 23 Dec 2008 Posts: 83
|
|
|
|