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

fat.c / ex_fat.c: SD card, contents messed up.

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



Joined: 12 Aug 2009
Posts: 30

View user's profile Send private message

fat.c / ex_fat.c: SD card, contents messed up.
PostPosted: Wed May 26, 2010 8:28 pm     Reply with quote

Yet another datalogger-project where data is supposed to be stored in SD-card so it could be analysed in PC.

I format SD card with PC, create some directories and files.
Then I move card to my test circuit and use ex_fat.c to see the contents of card (with "dir"-command).

Listing is messed up, there is directory/file names in 8+3-format but names are all messed up. Example:

hÌ*Äáí.kÈ
\ÌfÄeâvb.k"
Äíd\$f'â.eÙ
¸Édìd¼.da;

I can create/remove directories and files, append data to files, cat files etc. with PIC but they do not show when I connect card to PC. Everything created earlier with PC is ok.

Files/directories created with PIC are ok if I check them with PIC.

What could possibly be wrong?

Not likely a hardware problem because I can create and delete files with PIC.

Source code: ex_fat.c

Only changed buffer sizes in main()-function and pin assignments for SD card connection.

char buffer[255] -> char buffer[64];
char opt_buffer[255] ->char opt_buffer[64];


PIC: 18F2550
Compiler: PCH 4.099
SD-card: Canon 8MB, Kingston 128MB microSD, Kingston 2GB microSD (tried with FAT32)
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: Thu May 27, 2010 1:45 am     Reply with quote

You might want to try my drivers. It works with all these cards.
_________________
Regards, Andrew

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



Joined: 12 Aug 2009
Posts: 30

View user's profile Send private message

PostPosted: Thu May 27, 2010 8:57 am     Reply with quote

Guaranteed to work? Money back if not working as expected?

What is the writing speed to SD card with your drivers in kilobytes per second?
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: Thu May 27, 2010 9:11 am     Reply with quote

halibatsuiba wrote:
Guaranteed to work?


Yes - provided the data structures on the media are valid


Quote:
Money back if not working as expected?


No. The drivers are in source code form - you can't stuff a genie back in the bottle. However I have lots of CCS customers using this driver. Why not ask on the forum the experience of other users of the driver?


Quote:
What is the writing speed to SD card with your drivers in kilobytes per second?
I don't know. The fastest I have tried for a production application was 12 (24?) bytes every millisecond but that was with a PIC24 with the C30 compiler. I have not speed tested the CCS PIC18F implementation.
_________________
Regards, Andrew

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



Joined: 23 Oct 2006
Posts: 33
Location: South Africa

View user's profile Send private message Visit poster's website

Pic24FJ256 SD Driver PCWHD Compattible?
PostPosted: Fri May 28, 2010 12:47 am     Reply with quote

Andrew ,
I want to use the CCS compiler (PCWHD) on the Pic24FJ256 and use your SD Driver did you ever test it on this configuration to see if it work? I see you have it for the PIC18 and CCS. It should work I can't see any reason why not but would like to know if you testes it?

Johan
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: Pic24FJ256 SD Driver PCWHD Compattible?
PostPosted: Fri May 28, 2010 12:58 am     Reply with quote

johanpret wrote:
Andrew ,
I want to use the CCS compiler (PCWHD) on the Pic24FJ256 and use your SD Driver did you ever test it on this configuration to see if it work? I see you have it for the PIC18 and CCS. It should work I can't see any reason why not but would like to know if you testes it?

Johan


I have not tested the driver on recent versions of the CCS compiler. The driver did not work on PCD. There were a number of issues related to SPI ports, pointers and heap that prevented it from working. It is on my to do list but it has sat there for a few months now...
_________________
Regards, Andrew

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



Joined: 25 May 2010
Posts: 16

View user's profile Send private message

Re: fat.c / ex_fat.c: SD card, contents messed up.
PostPosted: Sat May 29, 2010 7:30 am     Reply with quote

halibatsuiba wrote:
Yet another datalogger-project where data is supposed to be stored in SD-card so it could be analysed in PC.


Working on similar thing. Use similar PIC too. I m using PIC18F2553.

http://www.ccsinfo.com/forum/viewtopic.php?p=132795#132795

mmcsd.c reads and writes using logical address. There is an offset between logical and physical sectors. I modified mmcsd.c to scan the offset such that mmcsd_read_data() is able to read correct information from the boot sector (Physical address 0x0 ~ 0x1FF). Did you do the same? or you found better solution?

However, mmcsd_read_data() is still unable to read the correct Next_Free_Clust (Physical address 0x3EC ~ 0x3EF). The reason is that it is located inside the reserved sector and somehow, mmcsd_read_data() isn't able to read correctly from reserved sector. Have you seen the same problem?

Thanks.
halibatsuiba



Joined: 12 Aug 2009
Posts: 30

View user's profile Send private message

PostPosted: Wed Jun 02, 2010 7:32 am     Reply with quote

Can you give a list of PIC cpus and SD-cards you have tested your software with?

Also it would be nice to get general hw and sw requirements, like how much RAM and EEPROM it uses, which CCS compiler you have tested it with etc.

+++++++++++++++++++++++
Please discuss sales issues of products by PM or email.
Ref. forum rules #7, #8

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

asmallri wrote:
halibatsuiba wrote:
Guaranteed to work?


Yes - provided the data structures on the media are valid


Quote:
Money back if not working as expected?


No. The drivers are in source code form - you can't stuff a genie back in the bottle. However I have lots of CCS customers using this driver. Why not ask on the forum the experience of other users of the driver?


Quote:
What is the writing speed to SD card with your drivers in kilobytes per second?
I don't know. The fastest I have tried for a production application was 12 (24?) bytes every millisecond but that was with a PIC24 with the C30 compiler. I have not speed tested the CCS PIC18F implementation.
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