 |
 |
| View previous topic :: View next topic |
| Author |
Message |
tranjimmysd
Joined: 05 May 2005 Posts: 9
|
|
Posted: Fri May 13, 2005 1:20 am |
|
|
Hi,
I am kind of new to this field. I just wonder if anyone can confirm that 16F877A and the ICD-u40 still work at the 3.3 voltage level.
I have the CCS proto-board for 16F877A. To convert it to the 3.3 board, can I just take out the IC 7805 and replace it with the 7803( for 3.3 volt regulator)?
Jim |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
| yea thst my code |
Posted: Fri May 13, 2005 6:42 am |
|
|
Hi,
Yea thats my code you've got hold of there. Try and credit where you get it from. The bug fix regarding SS_DISABLED is absolutely correct and is fixed in newer versions. I think if its not working you probably have you voltage translation wrong.
The mmc_spi driver mentioned isn't in my version of the compiler so I guess it must be a new thing.
cheers
ed |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun May 15, 2005 8:16 pm |
|
|
I got one of the PQI MMC-RS units. I agree that it doesn't work
with Ed Waugh's driver.
The CCS MMC driver can't work with a 16F877, because the code
has RAM arrays of 512 bytes. That's way beyond the size that
the 16F877 will permit, and it won't compile the driver.
I will test the CCS driver with a 18F452 and see if it works. |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Mon May 16, 2005 12:13 am |
|
|
Hi,
Yea your totally right the 16f877 doesn't have enough memory for this code. In the past I've used a 256kbit eeprom on the I2C bus with a 16f876 to solve this problem. I think my code for that is next to this code on the website. Thats all fine as long as you don't want to do anything really fast, you could get an FRAM I guess www.ramtron.com. I expect you'll always need this much temporary storage tho as I think the minimum block size is 512bytes and I'm not sure you can do the fragment writing in spi mode but I haven't really had a close look at it.
ed |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 16, 2005 10:27 am |
|
|
According to the MMC datasheets fragmented writing isn't possible, but I haven't tried to confirm this.
A Ramtron FRAM is nice for extending the limited RAM capabilities of the smaller PIC processors, just don't make the error of placing the FRAM on the same SPI-bus as the MMC or you'll end up with the fragmented writing problem again. Use the I2C version of the FRAM device instead. |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Mon May 16, 2005 10:48 am |
|
|
Hi,
Yea I meant the FRAMs that are pin replacements for the I2C eeprom parts. Those guys also do some interesting looking processor assitant type things I might check out. As far as fragmented writing goes I think your right and its only available in mmc mode rather than spi mode, although I definately found some stuff that implied it worked. I've also found some confusion with where the data is valid. Most data sheets say its on the rising edge of the clock for both input and output but I have a SanDisk tech sheet that says output is valid on the falling edge. Any suggestions?
cheers
ed |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 16, 2005 11:59 am |
|
|
| Quote: | | I've also found some confusion with where the data is valid. Most data sheets say its on the rising edge of the clock for both input and output but I have a SanDisk tech sheet that says output is valid on the falling edge. Any suggestions? | From the "MultiMediaCard System Specification Version 3.1" for SPI bus timing: | Quote: | 7.11 Bus Timing
Identical to MultiMediaCard mode. The timing of the CS signal is the same as any other card input. | And then the chapter on MMC bus timing:
| Quote: | 6.7 Bus Timing
Data must always be sampled on the rising edge of the clock. | Figure 41 shows the timing diagram data input/output referenced to clock, this makes it very clear that both the input and output data are to be sampled on the rising clock edge.
Maybe your Sandisk document is reffering to another version of the specificiation, but very likely it's an error in the Sandisk document.
The latest versions of the MMC documentation are no longer free for download, but you can download the older v3.1 from http://www.vvm.com/~darkwing/PDF/mmcsys-version_3-1.pdf |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Mon May 16, 2005 12:07 pm |
|
|
Hi,
yea i have that version and your right thats what it says but In SanDisk MultiMediaCard Product Manual rev. 3 it says:
| Quote: | | SanDisk's MultimediaCards clock data in on the rising edge and out on the falling edge. |
Although the diagram under this line clearly shows the data getting clocked on rising edges for both which is why I had ignored it. Crappy error tho, unless I got the wrong end of the stcik completely.
ed |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Mon May 16, 2005 12:39 pm |
|
|
hi,
Yea I have that one too, this is why i decided to ignore the line in the other manual. Its exactly the same plot in the technote as in the manual version i have whihc obviously disagrees with the line I quoted just now.
I don't suppose either of you guys have any tips for this crc7 thing? I have tried a couple of routines and i'm pretty sure I'm getting the starting and polynomial values correct but don't seem to be able to generate the same result for the one example I have which is for the out of reset instr (I think) | Quote: | | 0x40,0x00,0x00,0x00,0x00,0x95 | Any suggestionswould be welcome.
cheers
ed |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 16, 2005 1:04 pm |
|
|
Do we know that's a valid CRC, or is it just a magic number put
in there to signal a reset ? |
|
 |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 16, 2005 2:34 pm |
|
|
From the MMC Specification V3.1: | Quote: | The SPI interface is initialized in the non-protected mode. However, the RESET command (CMD0), which is
used to switch the card to SPI mode, is received by the card while in MultiMediaCard mode and, therefore,
must have a valid CRC field.
Since CMD0 has no arguments, the content of all the fields, including the CRC field, are constants and need
not be calculated in run time. A valid reset command is:
0x40, 0x0, 0x0, 0x0, 0x0, 0x95
The host can turn the CRC option on and off using the CRC_ON_OFF command (CMD59). | As I understand this the 0x95 is a valid CRC and not just some magic number. |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Mon May 16, 2005 2:40 pm |
|
|
Yea I have some other stuff somewhere that suggests its a real crc too although I can't seem to calculate it with any of the code I have. If you interested let me know I can post the routines I have for you to have a look at.
ed |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon May 16, 2005 3:49 pm |
|
|
| Yes, post them, and post your test program as well, if you want to. |
|
 |
EdWaugh
Joined: 07 Dec 2004 Posts: 127 Location: Southampton, UK
|
|
Posted: Tue May 17, 2005 2:06 am |
|
|
ok, this is the code I've been playing with. You can see the predefined table which is obviously not ideal on a PIC because of the storage but I was just trying to find an algorithm that worked to start with.
| Code: | unsigned char Crc7Lsb(unsigned char crc,unsigned char *data,int len)
{
static unsigned char const table[256] =
{
0x00,0x41,0x13,0x52,0x26,0x67,0x35,0x74,
0x4C,0x0D,0x5F,0x1E,0x6A,0x2B,0x79,0x38,
0x09,0x48,0x1A,0x5B,0x2F,0x6E,0x3C,0x7D,
0x45,0x04,0x56,0x17,0x63,0x22,0x70,0x31,
0x12,0x53,0x01,0x40,0x34,0x75,0x27,0x66,
0x5E,0x1F,0x4D,0x0C,0x78,0x39,0x6B,0x2A,
0x1B,0x5A,0x08,0x49,0x3D,0x7C,0x2E,0x6F,
0x57,0x16,0x44,0x05,0x71,0x30,0x62,0x23,
0x24,0x65,0x37,0x76,0x02,0x43,0x11,0x50,
0x68,0x29,0x7B,0x3A,0x4E,0x0F,0x5D,0x1C,
0x2D,0x6C,0x3E,0x7F,0x0B,0x4A,0x18,0x59,
0x61,0x20,0x72,0x33,0x47,0x06,0x54,0x15,
0x36,0x77,0x25,0x64,0x10,0x51,0x03,0x42,
0x7A,0x3B,0x69,0x28,0x5C,0x1D,0x4F,0x0E,
0x3F,0x7E,0x2C,0x6D,0x19,0x58,0x0A,0x4B,
0x73,0x32,0x60,0x21,0x55,0x14,0x46,0x07,
0x48,0x09,0x5B,0x1A,0x6E,0x2F,0x7D,0x3C,
0x04,0x45,0x17,0x56,0x22,0x63,0x31,0x70,
0x41,0x00,0x52,0x13,0x67,0x26,0x74,0x35,
0x0D,0x4C,0x1E,0x5F,0x2B,0x6A,0x38,0x79,
0x5A,0x1B,0x49,0x08,0x7C,0x3D,0x6F,0x2E,
0x16,0x57,0x05,0x44,0x30,0x71,0x23,0x62,
0x53,0x12,0x40,0x01,0x75,0x34,0x66,0x27,
0x1F,0x5E,0x0C,0x4D,0x39,0x78,0x2A,0x6B,
0x6C,0x2D,0x7F,0x3E,0x4A,0x0B,0x59,0x18,
0x20,0x61,0x33,0x72,0x06,0x47,0x15,0x54,
0x65,0x24,0x76,0x37,0x43,0x02,0x50,0x11,
0x29,0x68,0x3A,0x7B,0x0F,0x4E,0x1C,0x5D,
0x7E,0x3F,0x6D,0x2C,0x58,0x19,0x4B,0x0A,
0x32,0x73,0x21,0x60,0x14,0x55,0x07,0x46,
0x77,0x36,0x64,0x25,0x51,0x10,0x42,0x03,
0x3B,0x7A,0x28,0x69,0x1D,0x5C,0x0E,0x4F
};
while ( len-- > 0 )
{
crc = (crc >> 8) ^ table[(unsigned char)crc] ^ *data++;
}
return crc;
}
void crc7()
{
unsigned char data[] = {0x40,0x00,0x00,0x00,0x00,0};
int len = sizeof(data), i;
data[len-1] = Crc7Lsb(0,data,len);
printf("Data:");
for (i=0; i<len-1; i++)
{
printf(" ");
printf("0x%02X",data[i]);
}
printf(", CRC: 0x%02X",data[len-1]);
printf(", Check: 0x%02X\n\r",Crc7Lsb(0,data,len));
}
|
You can see where I put in the only example I have to test against and it gets a different result.
Just calling this fn should dump the results out to your selected port.
ed |
|
 |
|
|
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
|