Keil Logo Arm Logo

Problem with Filesystem MMI/SD Card

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Peter Keller
Posted
22-Sep-2007 13:45 GMT
Toolset
ARM
New! Problem with Filesystem MMI/SD Card

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);
}
Read-Only
Author
Andy Neil
Posted
22-Sep-2007 14:11 GMT
Toolset
ARM
New! Citing threads

"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

Read-Only
Author
Peter Keller
Posted
23-Sep-2007 11:09 GMT
Toolset
ARM
New! RE: Citing threads

Thanks for the hint.

Read-Only
Author
Peter Keller
Posted
23-Sep-2007 11:11 GMT
Toolset
ARM
New! RE: Problem with Filesystem MMI/SD Card

I removed spi_init since its called from finit( );
But now, finit( ) returns 1.

Read-Only
Author
Andy Neil
Posted
23-Sep-2007 14:21 GMT
Toolset
ARM
New! RE: finit( ) returns 1

So you need to look at what could cause finit( ) to return 1...

Read-Only
Author
Peter Keller
Posted
23-Sep-2007 19:30 GMT
Toolset
ARM
New! RE: finit( ) returns 1

Believe me - that was my idea too ..

Read-Only
Author
Franc Urbanc
Posted
24-Sep-2007 06:48 GMT
Toolset
ARM
New! RE: finit( ) returns 1

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

Read-Only
Author
Peter Keller
Posted
24-Sep-2007 07:46 GMT
Toolset
ARM
New! RE: finit( ) returns 1

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 ;-).

Read-Only
Author
Franc Urbanc
Posted
24-Sep-2007 08:11 GMT
Toolset
ARM
New! RE: finit( ) returns 1

Error messages are from fs_fat.c module. Return value 2 means that FlashFS failed to read MBR or that MBR is invalid.

Franc

Read-Only
Author
Peter Keller
Posted
24-Sep-2007 08:19 GMT
Toolset
ARM
New! RE: finit( ) returns 1

Thanks, where can I find this info?

Read-Only
Author
Franc Urbanc
Posted
24-Sep-2007 11:00 GMT
Toolset
ARM
New! RE: finit( ) returns 1

When you bought RL-ARM you received complete sources for FlashFS. Open the fs_fat.c file and check the error codes.

Read-Only
Author
jalim allar
Posted
24-Sep-2007 11:14 GMT
Toolset
ARM
New! i want the ides plz

Where can I find the good 8051 ,z80 , pic and amr simulators? do you have the other ide's from them as well?

Read-Only
Author
Peter Keller
Posted
25-Sep-2007 09:20 GMT
Toolset
ARM
New! RE: finit( ) returns 1

Thanks again to all of you for supporting me.

Read-Only
Author
Peter Keller
Posted
26-Sep-2007 17:19 GMT
Toolset
ARM
New! RE: finit( ) returns 1

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)?

Read-Only
Author
Franc Urbanc
Posted
27-Sep-2007 06:09 GMT
Toolset
ARM
New! RE: finit( ) returns 1

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.

Franc

Read-Only
Author
Peter Keller
Posted
27-Sep-2007 06:28 GMT
Toolset
ARM
New! RE: finit( ) returns 1

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?

Read-Only
Author
Franc Urbanc
Posted
27-Sep-2007 07:14 GMT
Toolset
ARM
New! RE: finit( ) returns 1

SD_Card example for MCB2300 is in NATIVE mode. You should use SD_Card example for MCB2140 as a reference. It uses SPI mode.

Read-Only
Author
Franc Urbanc
Posted
27-Sep-2007 07:16 GMT
Toolset
ARM
New! RE: finit( ) returns 1

Sorry, it is an SD_File example for MCB2140.

Read-Only
Author
Peter Keller
Posted
27-Sep-2007 20:30 GMT
Toolset
ARM
New! RE: finit( ) returns 1

To close this thread:
The problem was that the SD File system has allocated memory in the Ethernet RAM Area, which was powered off.

 PCONP|=(1<<30);

was the solution.
Thanks to Franc

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

ARM’s Privacy Policy has been updated. By continuing to use our site, you consent to ARM’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.