View previous topic :: View next topic |
Author |
Message |
eskimobob
Joined: 07 Feb 2009 Posts: 40
|
Strange code in FAT_spi.c |
Posted: Mon Feb 16, 2009 3:50 pm |
|
|
Can anyone who is familiar with using SD/MMC cards with the CCS drivers FAT_pic.c and FAT_spi.c tell me if this code is sensible:
In "FAT_spi.c", there is the function "mmc_send_cmd". At the end of this function, there is the following code:
Code: |
for(i = 1; i < bytes; i++)
out[i] = spi_read(0xFF);
|
The strange thing is that a few lines above this, we find:
Which means that the for loop will never be executed.
Surely there is a mistake in the driver? - Either that bit of code is pointless and should not be included or the variable "bytes" should sometimes not be set to 1.
Unless someone can shed some light on this, I will have to delve into the MMC specification
Edit - This is odd. I thought I'd just ensure that the drivers I'm using (supplied with the Ethernet dev kit) are up to date with those in the CCS installation directory and it appears they are significantly different!
What I have as FAT_pic.c appears to be very similar to fat.c and what I have as FAT_spi.c appears to be similar to mmc_spi.c. The question I posed seems only to apply to the driver versions supplied with the dev kit
Off to investigate further... |
|
|
KONAMI
Joined: 29 Aug 2010 Posts: 11
|
|
Posted: Wed Mar 14, 2012 8:25 am |
|
|
I can help u
but i should see code(complet) before help you.
So thing I am asking you is to post entire code here so I will read and then help you.
I am talking of the fat_pic.c fat_pic.h and then your code.
+++++++++++++++++++++++
No, Konami. See forum rule #10:
10. Don't post the CCS example code or drivers, or ask for such code and drivers.
Forum Rules:
http://www.ccsinfo.com/forum/viewtopic.php?t=26245
- Forum Moderator
+++++++++++++++++++++++ |
|
|
eskimobob
Joined: 07 Feb 2009 Posts: 40
|
|
Posted: Wed Mar 14, 2012 8:41 am |
|
|
It's the standard CCS code so you will already have it - I can't post it here anyway ;-)
This thread is over 3 years old so it may well have been modified in the latest CCS code - have a look 8-)
Edit: moderator beat me to it... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Mar 14, 2012 11:26 am |
|
|
The code is part of the CCS TCP/IP Examples, that are not presently available for download. You are right about the respective code block. Apparently, it has been originally intended to read longer responses in mmc_send_cmd(). Because CCS C isn't able to detect it as dead code, you should comment it.
The version of FAT_SPI.c I have has a file date of 2007. I don't think that this version of the MHCP TCP/IP stack and MDD file system will be further maintained by CCS. |
|
|
eskimobob
Joined: 07 Feb 2009 Posts: 40
|
|
Posted: Wed Mar 14, 2012 4:07 pm |
|
|
FvM wrote: | Because CCS C isn't able to detect it as dead code, you should comment it. |
I'm not actually using it ;-) I was experimenting with the CCS web dev kit back when I first posted this 3 years ago.
FvM wrote: | The version of FAT_SPI.c I have has a file date of 2007. I don't think that this version of the MHCP TCP/IP stack and MDD file system will be further maintained by CCS. |
I remember a CCS comment before V4 was released along the lines that they expected the MCHP TCP/IP stack to compile under V4 so we would have access to the latest version. I've not checked since but presumably that didn't come to anything? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Mar 15, 2012 12:40 am |
|
|
Quote: | I remember a CCS comment before V4 was released along the lines that they expected the MCHP TCP/IP stack to compile under V4 so we would have access to the latest version. I've not checked since but presumably that didn't come to anything? |
I didn't yet plan to use the MCHP stack with PIC 18 or PIC24 and CCS C. I'm only using it with PIC32. As all MHCP code, I would expect it to be portable to CCS C somehow, but some adaptions are most likely required. I don't think, that it applies as beginners project. |
|
|
|