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

SD driver with PIC24

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







SD driver with PIC24
PostPosted: Mon Nov 30, 2009 12:22 pm     Reply with quote

We here have been fighting major problems getting the SD driver to work.

Its used in a FAT 16 driver and both had been fully tested and working standalone.

But when installed into the main project it fails by reseting the processor in the middle of mmcsd_get_r1()

This doesn't make any sense as it has been called many times before.

The SD card had been initialised.
The BIOS block read.
The directory table read and a subdirectory.
But when the FAT table is read from the first fat table sector it just resets the processor within the mmcsd_get_r1() as it reads the block.

Anyone have any idea how this can happen and what can be done, losing complete confidence in this compiler with all the bugs we have currently overcome.

Currently looking into other compilers :(
thanks
Robert
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Nov 30, 2009 12:54 pm     Reply with quote

Quote:
it just resets the processor within the mmcsd_get_r1() as it reads the block

My favourite candidates for unintended resets are accessing odd or nonexisting memory addresses, can be
either a compiler bug or user coding error, and stack overflows. Did you use a reasonable stack setting?
The default PCD setting isn't, see the respective forum discussions.

Your post sounds really depressive.
Guest








Getting there we think
PostPosted: Tue Dec 01, 2009 7:51 am     Reply with quote

Thanks for you reply FvM.

Seem to be getting to the bottom of things.

Firstly there are problems with #USE DYNAMIC_MEMORY that allocates the dynamic head to an odd address and puts a clr.w to an odd address in the main header code.

Second strcpy does the same thing depending on build.

Third a inc of addresss and data pointers in the sd read and write data functions gets compiled incorrectly and transfers the completely wrong address into the function.

We found most of this by using a capture of the address error interrupt.

This is depressive as the prototype needs to demo'd at a meeting of 80 people in a week.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Dec 01, 2009 10:57 am     Reply with quote

I see a good chance to get rid of these problems within one or two days.

As another interesting option, brushelectronics.com has a SD driver for PIC24/Microchip C30. They are basically interested to port it to CCS if you are contributing to the development effort. As an advantage, the driver "dynamically supports FAT12/FAT16 and FAT32". I considered to use this option, but my respective project has been delayed due to more urgent things. Contact asmallri@brushelectronics.com for details.
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