Regarding the thread "Flash file system problem" by Gennady Palitsky 2007-Apr-22, I came to the same point,where I have to create a Heap (8k) and copied retarget.c from C:\Keil\ARM\Boards\Keil\MCB2300\RL\FlashFS\SD_File to my application.
The problem I have is different: Stepping the following code, after "retv = finit( );" the program counter jumps back to the beginning of this function over and over.
/******************************************************************************** * Initializing MMC/SD Interface (SPI-MODE) * retv: 0 ok, 1 failed ********************************************************************************/ U32 mmc_init (void) { U32 retv; MMC_Disable; spi_init( ); MMC_Enable; retv = finit (); if (retv == 1) { printf ("\nSD/MMC Init Failed"); } else { printf ("\nSD/MMC Card is Unformatted"); strcpy ((char*)str, "SWMZ\r\n"); cmd_format ((char*)str); retv = finit (); } return(retv); }
"Regarding the thread 'Flash file system problem' by Gennady Palitsky 2007-Apr-22"
It would be easier and far more useful to just give the link: http://www.keil.com/forum/docs/thread9743.asp
Thanks for the hint.
I removed spi_init since its called from finit( ); But now, finit( ) returns 1.
So you need to look at what could cause finit( ) to return 1...
Believe me - that was my idea too ..
First there is a question: are you using SPI mode or a Native mode. It is possible to use both with LPC23xx devices.
If finit() returned 1 then the SD/MMC card was not initialized into SPI/Native mode. This error is returned from the mmc/mci layer. It means you do not have a working connection with your SD/MMC memory card. Most likely you have misconfigured SPI/MCI interface.
Please check the spi inteface by single stepping the spi_send() function to see if you have any response from the card at all.
If you are using Native mode, then single step the mci_init() function to see where it fails.
Can you check \Keil\ARM\Boards\MCB2300\RL\FlashFS\SD_File if this example works?
Franc
I'm a step further: using copy/paste I initialized a wrong register in spi_init. Now I get 0x02 on return from finit( ). Unfortunately there is no list which tells me what the return values mean. Btw: it is SPI mode! ... and I know, I have to look for that ;-).
Error messages are from fs_fat.c module. Return value 2 means that FlashFS failed to read MBR or that MBR is invalid.
Thanks, where can I find this info?
When you bought RL-ARM you received complete sources for FlashFS. Open the fs_fat.c file and check the error codes.
Where can I find the good 8051 ,z80 , pic and amr simulators? do you have the other ide's from them as well?
Thanks again to all of you for supporting me.
Franc I'm using the following pins on the sd card: Pin 1: /Select Pin 2: MOSI Pin 3: GND Pin 4: +3V3 Pin 5: SCLK Pin 6: GND Pin 7: MISO Pin 8: GND Pin 9: nc
I suppose this is SPI mode - correct? And this: \Keil\ARM\Boards\MCB2300\RL\FlashFS\SD_File is this NATIVE mode?
What's the difference in interfacing the card (hardware)?
Yes, your connection is for SPI mode. However SD_File is configured for NATIVE mode.
A difference is in the connection. Native mode uses 4 data lines, but spi mode uses only 1 data line. The transfer speed in native mode is much higher than in spi mode.
Transfer speed is no problem. However SD_File is configured for NATIVE mode.: Where is my mistake? Is the example \Keil\ARM\Boards\MCB2300\RL\FlashFS\SD_File in Native- or SPI mode?