View previous topic :: View next topic |
Author |
Message |
Robertk Guest
|
SD driver with PIC24 |
Posted: Mon Nov 30, 2009 12:22 pm |
|
|
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
|
|
Posted: Mon Nov 30, 2009 12:54 pm |
|
|
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 |
Posted: Tue Dec 01, 2009 7:51 am |
|
|
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
|
|
Posted: Tue Dec 01, 2009 10:57 am |
|
|
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 [email protected] for details. |
|
|
|