<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Flash fs configuring two memory card devices</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/32092/flash-fs-configuring-two-memory-card-devices</link><description> 
I tried to connect the two memory card devices by connecting it on
ssp port of lpc2148, i have access to memory cards when i enabling
them one by one but i can&amp;#39;t access memory card device 1 when i&amp;#39;m
enabling the both devices on file configuration.c</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/154833?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2013 00:07:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:11244091-f35b-4d34-afb0-7600ec2a7bb9</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You really should consider initializing the slave-select lines
totally outside of your file system code. However many init/uninit
you do, the slave-select for each memory card should be in &amp;quot;idle&amp;quot;
state at all times when you aren&amp;#39;t doing any transfers. So you should
deassert them on boot. And they should stay that way after any
uninit() calls.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/154834?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2013 00:05:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e6a66eed-4ef9-4c6c-aec4-b970a556f0fe</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
THANK U ALL for kind advice and guidance&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/154335?ContentTypeID=1</link><pubDate>Mon, 07 Oct 2013 00:00:27 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cd6c3325-ee8d-4757-b03a-48d2b16a2ea6</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
Now i&amp;#39;m able access two drives in same bus i done a small mistake
in my spi1_drv uninit function, you can see it on my above posted
code&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/153762?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 23:46:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:24454b7e-2951-40cd-8666-ea32de6cb026</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Don&amp;#39;t you see any issues with having two drivers perform
operations on the same registers?&lt;/p&gt;

&lt;p&gt;
What if the two memory card &amp;quot;drivers&amp;quot; gets called with different
baudrate?&lt;/p&gt;

&lt;p&gt;
And next thing - have you verified if the file system code
initializes an interface before every use and then uninitializes it?
Or if it initializes both interfaces and then leaves them
initialized?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/153760?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 23:38:35 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8fbb54d7-c057-422b-a8d1-77908f142f39</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
What do you mean by &amp;quot;here are two pullups in a MOSI and MISO
pins&amp;quot;&lt;/p&gt;

&lt;p&gt;
Each signal only needs one pullup resistor even if you connect the
signal to two memory cards.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/153082?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 23:38:06 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2dba4135-1046-4396-8006-91da7224610d</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
This is my spi driver&lt;/p&gt;

&lt;pre&gt;
/*----------------------------------------------------------------------------
  SPI Driver instance definition
   spi0_drv: First SPI driver
   spi1_drv: Second SPI driver
 *---------------------------------------------------------------------------*/

//#define __DRV_ID  spi1_drv
#define __PCLK    48000000

/* SPI Driver Interface functions */
static BOOL Init (void);
static BOOL Init1 (void);
static BOOL UnInit (void);
static BOOL UnInit1 (void);
static U8   Send (U8 outb);
static BOOL SendBuf (U8 *buf, U32 sz);
static BOOL RecBuf (U8 *buf, U32 sz);
static BOOL BusSpeed (U32 kbaud);
static BOOL SetSS (U32 ss);
static BOOL SetSS1 (U32 ss);
static U32  CheckMedia (void);        /* Optional function for SD card check */

/* SPI Device Driver Control Block */
SPI_DRV spi0_drv = {
  Init,
  UnInit,
  Send,
  SendBuf,
  RecBuf,
  BusSpeed,
  SetSS,
  CheckMedia                          /* Can be NULL if not existing         */
};



/* SSPSR - bit definitions. */
#define TFE     0x01
#define TNF     0x02
#define RNE     0x04
#define RFF     0x08
#define BSY     0x10
SPI_DRV spi1_drv = {
  Init1,
  UnInit1,
  Send,
  SendBuf,
  RecBuf,
  BusSpeed,
  SetSS1,
  CheckMedia                          /* Can be NULL if not existing         */
};

/*--------------------------- Init ------------------------------------------*/

static BOOL Init (void) {
  /* Initialize and enable the SSP Interface module. */

  /* SSEL is GPIO, output set to high. */
  IODIR0 |= 1&amp;lt;&amp;lt;20;
  IOSET0  = 1&amp;lt;&amp;lt;20;
  /* SCK1, MISO1, MOSI1 are SSP pins. */
  PINSEL1 = (PINSEL1 &amp;amp; ~0x000003FC) | 0x000000A8;
        // reset SPI
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;

  /* Enable SPI in Master Mode, CPOL=0, CPHA=0. */
  SSPCR0  = 0x0007;
  SSPCR1  = 0x0002;
  SSPCPSR = 0xFE;
  return (__TRUE);
}


/*--------------------------- UnInit ----------------------------------------*/

static BOOL UnInit (void) {
  /* Return SSP interface to default state. */

  IODIR0  &amp;amp;= ~(1&amp;lt;&amp;lt;20);
  PINSEL1 &amp;amp;= ~0x000003FC;
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;
  return (__TRUE);
}


/*--------------------------- Send ------------------------------------------*/

static U8 Send (U8 outb) {
  /* Send and Receive a byte on SPI interface. */

  SSPDR = outb;
  /* Wait if RNE cleared, Rx FIFO is empty. */
  while (!(SSPSR &amp;amp; RNE));
  return (SSPDR);
}


/*--------------------------- SendBuf ---------------------------------------*/

static BOOL SendBuf (U8 *buf, U32 sz) {
  /* Send buffer to SPI interface. */
  U32 i;

  for (i = 0; i &amp;lt; sz; i++) {
    SSPDR = buf[i];
    /* Wait if Tx FIFO is full. */
    while (!(SSPSR &amp;amp; TNF));
    SSPDR;
  }
  /* Wait until Tx finished, drain Rx FIFO. */
  while (SSPSR &amp;amp; (BSY | RNE)) {
    SSPDR;
  }
  return (__TRUE);
}


/*--------------------------- RecBuf ----------------------------------------*/

static BOOL RecBuf (U8 *buf, U32 sz) {
  /* Receive SPI data to buffer. */
  U32 i;

  for (i = 0; i &amp;lt; sz; i++) {
    SSPDR = 0xFF;
    /* Wait while Rx FIFO is empty. */
    while (!(SSPSR &amp;amp; RNE));
    buf[i] = SSPDR;
  }
  return (__TRUE);
}


/*--------------------------- BusSpeed --------------------------------------*/

static BOOL BusSpeed (U32 kbaud) {
  /* Set an SPI clock to required baud rate. */
  U32 div;

  div = (__PCLK/1000 + kbaud - 1) / kbaud;
  if (div == 0)   div = 0x02;
  if (div &amp;amp; 1)    div++;
  if (div &amp;gt; 0xFE) div = 0xFE;
  SSPCPSR = div;
  return (__TRUE);
}


/*--------------------------- SetSS -----------------------------------------*/

static BOOL SetSS (U32 ss) {
  /* Enable/Disable SPI Chip Select (drive it high or low). */

  if (ss) {
    /* SSEL is GPIO, output set to high. */
    IOSET0 = 1&amp;lt;&amp;lt;20;
  }
  else {
    /* SSEL is GPIO, output set to low. */
    IOCLR0 = 1&amp;lt;&amp;lt;20;
  }
  return (__TRUE);
}


/*--------------------------- CheckMedia ------------------------------------*/

static U32 CheckMedia (void) {
  /* Read CardDetect and WriteProtect SD card socket pins. */
  U32 stat = 0;

#if 0
  if (!(IOPIN0 &amp;amp; 0x04)) {
    /* Card is inserted (CD=0). */
    stat |= M_INSERTED;
  }
  if ((IOPIN0 &amp;amp; 0x20)) {
    /* Write Protect switch is active (WP=1). */
    stat |= M_PROTECTED;
  }
#else
  /* When CD,WP signals are not connected. */
  stat = M_INSERTED;
#endif
  return (stat);
}

static BOOL SetSS1 (U32 ss) {
  /* Enable/Disable SPI Chip Select (drive it high or low). */

  if (ss) {
    /* SSEL is GPIO, output set to high. */
    IOSET0 = 1&amp;lt;&amp;lt;7;
  }
  else {
    /* SSEL is GPIO, output set to low. */
    IOCLR0 = 1&amp;lt;&amp;lt;7;
  }
  return (__TRUE);
}

/*--------------------------- Init ------------------------------------------*/

static BOOL Init1 (void) {
  /* Initialize and enable the SSP Interface module. */

  /* SSEL is GPIO, output set to high. */
  IODIR0 |= 1&amp;lt;&amp;lt;7;
  IOSET0  = 1&amp;lt;&amp;lt;7;
  /* SCK1, MISO1, MOSI1 are SSP pins. */
  PINSEL1 = (PINSEL1 &amp;amp; ~0x00000FC) | 0x000000A8;
        // reset SPI
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;
  /* Enable SPI in Master Mode, CPOL=0, CPHA=0. */
  SSPCR0  = 0x0007;
  SSPCR1  = 0x0002;
  SSPCPSR = 0xFE;
  return (__TRUE);
}


/*--------------------------- UnInit ----------------------------------------*/

static BOOL UnInit1 (void) {
  /* Return SSP interface to default state. */

  IODIR0  &amp;amp;= ~(1&amp;lt;&amp;lt;8);
  PINSEL1 &amp;amp;= ~0x00000FC;
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;
  return (__TRUE);
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/153079?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 23:34:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7912debc-a063-4d25-b5c4-b7b354a8a835</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m using pullup of 10k for M0SI,MISO and SS pins of both sd cards
there are two pullups in a MOSI and MISO pins&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/152338?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 23:01:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ef736c70-a75c-4417-85f3-7d7191b2b7cd</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;gt;Andrew Neil:&lt;br /&gt;
But is that actually designed &amp;amp; able to manage two separate CS
(SS) lines to select between one of two SD cards sharing the same SPI
bus&amp;hellip;?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
It&amp;#39;s already added, as described on my above post.&lt;br /&gt;
&lt;i&gt;&amp;quot;2) Add another SPI driver object (spi1_drv) for MC1&lt;br /&gt;
In your case, SetSS() is customized, too, to select target SD card,
both in the original and copied.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Ravi,&lt;br /&gt;
Maybe, spurious signaling on the SPI bus makes the second SD card
confused.&lt;/p&gt;

&lt;p&gt;
1) Pull-up resistors at SPI pins and each CS (SS) pin&lt;br /&gt;
The I/O ports of LPC2148 are set to input (floating) after reset,
including power up.&lt;br /&gt;
To avoid spurious signaling on SPI bus, these pull-ups are
required.&lt;/p&gt;

&lt;p&gt;
2) Init() / UnInit() on the SPI driver&lt;br /&gt;
The original Init()/UnInit() routines in SPI_LPC214x.c touch to SPI
and SS ports setting.&lt;br /&gt;
The ports should be initialized once, at the global start-up
initialization.&lt;br /&gt;
And they should be kept untouched while the MCU is running.&lt;/p&gt;

&lt;p&gt;
Init() / UnInit() change just SPI registers.&lt;/p&gt;

&lt;pre&gt;
C:\Keil\ARM\Boards\Keil\MCB2140\RL\FlashFS\SD_File\SPI_LPC214x.c

static BOOL Init (void) {
  /* Initialize and enable the SSP Interface module. */

/*   &amp;lt;------- move these lines into the global start up initialization
  // SSEL is GPIO, output set to high.
  IODIR0 |= 1&amp;lt;&amp;lt;20;
  IOSET0  = 1&amp;lt;&amp;lt;20;
  // SCK1, MISO1, MOSI1 are SSP pins.
  PINSEL1 = (PINSEL1 &amp;amp; ~0x000003FC) | 0x000000A8;
*/
  // reset SPI
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;

  /* Enable SPI in Master Mode, CPOL=0, CPHA=0. */
  SSPCR0  = 0x0007;
  SSPCR1  = 0x0002;
  SSPCPSR = 0xFE;
  return (__TRUE);
}

/*--------------------------- UnInit ----------------------------------------*/

static BOOL UnInit (void) {
  /* Return SSP interface to default state. */

/*   &amp;lt;----  delete these lines
  IODIR0  &amp;amp;= ~(1&amp;lt;&amp;lt;20);
  PINSEL1 &amp;amp;= ~0x000003FC;
*/
  SSPCR1  = 0x0000;
  SSPCR0  = 0x0000;
  SSPCPSR = 0x00;
  return (__TRUE);
}
&lt;/pre&gt;

&lt;p&gt;
3) finit()&lt;br /&gt;
finit(NULL), in init_card() on the demo, initializes both of SD
cards.&lt;br /&gt;
To ensure separate initialization per the cards,&lt;br /&gt;
this call is replaced with finit(&amp;quot;M0:&amp;quot;) and finit(&amp;quot;M1:&amp;quot;)&lt;/p&gt;

&lt;pre&gt;
C:\Keil\ARM\Boards\Keil\MCB2140\RL\FlashFS\SD_File\SD_File.c

static void init_card (void) {
  U32 retv;

  while ((retv = finit (NULL)) != 0) {        // Wait until the Card is ready
&lt;/pre&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/152337?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 22:33:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:27d9343d-6a62-416f-b9be-32023a61b9e1</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You think?&lt;/p&gt;

&lt;p&gt;
And you think debugging shouldn&amp;#39;t be used to verify that one
driver is 100% done with the interface before the other driver gets
jobs to do?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/151553?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 20:43:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:19632522-3118-44cc-b7e2-f0bd19506bea</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m using seperate cs(ss)for each sd card&lt;/p&gt;

&lt;p&gt;
I think that cs assertion and deassertion will happen when
initializing a card with fat initialization if it is defined in low
level spi driver needed for Flash fs&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/150861?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 13:35:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d4e2a86c-74c5-4176-b63e-fb0c1eac7267</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;CS (SS) is also applied to activate one of SD cards, which
share single SPI bus&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
But is that actually designed &amp;amp; able to manage &lt;b&gt;two
&lt;i&gt;separate&lt;/i&gt;&lt;/b&gt; CS (SS) lines to select between one of &lt;b&gt;two&lt;/b&gt;
SD cards &lt;i&gt;sharing the same SPI bus&lt;/i&gt;...?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/150396?ContentTypeID=1</link><pubDate>Sun, 06 Oct 2013 11:36:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:21d38ce8-88f5-4197-b84b-28dad5e8bc70</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;gt; but code is still going to need to be written to manage
the two together.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
I believe the target drive managemnet is already there, without
any additional code by user.&lt;br /&gt;
In the SPI connection of SD card,&lt;br /&gt;
- CS is asserted to start an operation (command - response -
data).&lt;br /&gt;
- CS must be kept active while an operation is going on.&lt;br /&gt;
- At the end of operation, CS is deserted.&lt;/p&gt;

&lt;p&gt;
CS (SS) is also applied to activate one of SD cards, which share
single SPI bus.&lt;br /&gt;
Therefore, operations occur exclusively for each SD card on the
bus.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/149961?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 14:56:12 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:43711578-2de2-427d-886d-b761c8df4d57</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
He&amp;#39;s still likely to have to do something in his hardware
abstraction code to mediate/arbitrate access between the two mutually
exclusive devices. This is not a responsibility of the file system,
but rather the driver for the board/card scheme.&lt;/p&gt;

&lt;p&gt;
The driver side would appear to function at the individual level,
and that&amp;#39;s great, but code is still going to need to be written to
manage the two together. This part is missing, poking at the existing
code isn&amp;#39;t going to address that.&lt;/p&gt;

&lt;p&gt;
So it&amp;#39;s stuck in a loop, ok that&amp;#39;s great, but why? If you don&amp;#39;t
sufficiently grasp the low level driver code, and the interplay with
the higher level code, then you&amp;#39;ll need to instrument the interface
points, and become familiar with what&amp;#39;s happening, when and why.&lt;/p&gt;

&lt;p&gt;
This isn&amp;#39;t Keil&amp;#39;s responsibility, it is the responsibility of the
implementer, the one tasked with making the board support package or
board drivers. If the task exceeds your skillset consider
out-sourcing the task.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/140632?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 10:11:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d05cbd5c-f8c0-46fb-80f8-3aa3115f74fc</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;gt; if I enabled two drives&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
How did you enable two drives?&lt;br /&gt;
I believe this the supposed way to add MC1.&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;1) Enable MC1 in File_Config.c&lt;/b&gt;&lt;/p&gt;

&lt;pre&gt;
C:\Keil\ARM\Boards\Keil\MCB2140\RL\FlashFS\SD_File\File_Config.c

// &amp;lt;/e&amp;gt;
// &amp;lt;e&amp;gt;Memory Card Drive 1
// ======================
// &lt;i&gt;Enable Memory Card Drive  [M1:]
#define MC1_EN      0    // &amp;lt;---- 1
&lt;/i&gt;
&lt;/pre&gt;

&lt;p&gt;
Optionally, you may attach a cache (MC1_CASZ) to this drive, like
MC0&lt;br /&gt;
In this case, the cache address (MC1_CADR) should be placed, so that
it doesn&amp;#39;t overlap MC0&amp;#39;s.&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;2) Add another SPI driver object (spi1_drv) for MC1&lt;/b&gt;&lt;br /&gt;
Copy and modiy the SPI driver file (SPI_LPC214x.c) for MC1&lt;/p&gt;

&lt;pre&gt;
C:\Keil\ARM\Boards\Keil\MCB2140\RL\FlashFS\SD_File\SPI_LPC214x_MC1.c (copied SPI_LPC214x.c)

#define __DRV_ID  spi0_drv   // &amp;lt;---- spi1_drv
&lt;/pre&gt;

&lt;p&gt;
In your case, SetSS() is customized, too, to select target SD
card, both in the original and copied.&lt;br /&gt;
As most of the routines on the copied file is common to the original,
You may combine them into single file.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/131322?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 07:27:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8463b4cc-c0c9-4865-983f-4c16617a6ea2</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
I have no idea how to DEBUG code because it working perfectly when
I using single memory card and checked another card also for same
condition ,if I enabled two drives only one card get initialized but
another card doesn&amp;#39;t get initialized by flashfs ,I have no idea to
debug this because I don&amp;#39;t know internal routines of flashfs function
finit. Pls instruct me how to debug on it,I think that there is
memory management problem in flashfs for initializing two memory
card,may using file cache will remove this problem I need ur guidance
for this issue&lt;br /&gt;
Thanking you&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/128335?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 05:59:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:71f7bf65-b247-43e1-b0e5-9aa0aa85a451</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
But what have you done to try to DEBUG your problems?&lt;/p&gt;

&lt;p&gt;
Have you checked if your drivers gets called?&lt;/p&gt;

&lt;p&gt;
Does one gets called while the other still have the SPI port
busy?&lt;/p&gt;

&lt;p&gt;
How do you even know that your code is correct?&lt;/p&gt;

&lt;p&gt;
We don&amp;#39;t care much if the program gets stuck in an infinite loop.
Why? Because it is&amp;#39;t our program. So - what are YOU doing about this
issue? Besides spending time on the web telling people that your code
gets stuck in an infinite loop, that is...&lt;/p&gt;

&lt;p&gt;
Have you checked where that loop is? Inside what function? Or in
an exception handler? Or waiting for a hardware condition that can&amp;#39;t
happen because your code doesn&amp;#39;t do what it should?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/117401?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 03:25:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5acf1c92-3f86-4c4f-9dbf-750973e4b040</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
I have problem on initializing both cards at a time,i got stucked
in finit(NULL) function which goes infinite loop when i using 2gb
transcend memory cards connected in a same SSP port i only modified
slave select for two cards and defined spi1 drv and spi0 drv drivers
,i got better result in using SD_FIle example from keil for mcb2140
these drivers when activating two cards seperately ,in two cards
configuration the code is stucked on initializing memory card which
is not a default one,i tested activating two cards seperately by
using finit(&amp;quot;MC0&amp;quot;)and finit(&amp;quot;MC1&amp;quot;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/117400?ContentTypeID=1</link><pubDate>Sat, 05 Oct 2013 03:03:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e4d05066-1893-43b6-a514-1a2b1c24e968</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
My code get stucked for initializing two memory cards in a row,my
code get stucked on finit function when i configure it for two memory
cards,i checked that in finit(NULL) function it is able to only
activate default drive ,i had no idea about finit function ,i hadn&amp;#39;t
added any codes to check. both memory cards are working perfectly in
the same bus activated separately in file configuration, i think that
hardware part has no problem.is there any limitation in memory card
size? i&amp;#39;m using 2gb memory cards,pls guide me&lt;br /&gt;
Thanking you&lt;br /&gt;
sry for delay to answering ur questions&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/107325?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2013 23:27:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f9db4ed9-795f-4ccb-ab09-de3c51eef518</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I didn&amp;#39;t see you supply any answer to my question:&lt;br /&gt;
&amp;quot;Have you added any code to check that the two drivers aren&amp;#39;t
activated at the same time?&amp;quot;&lt;/p&gt;

&lt;p&gt;
It doesn&amp;#39;t seem like you are trying to solve your problem by
trying to figure out what goes wrong.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/107327?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2013 22:25:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8ee61d9a-6067-4b81-8062-30d1634ab331</guid><dc:creator>Ash J</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;...the function execution goes as infinite loop without any
return value.&lt;/i&gt;&lt;br /&gt;
In which infinite loop does it get stuck-up in?&lt;br /&gt;
Have you checked if any fault is generated or not? (Bus Fault, memory
management fault, hard fault...)&lt;br /&gt;
Debug and check.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/81485?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2013 21:26:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5c591a3a-464e-4b57-9d22-d12aa0dedd1d</guid><dc:creator>Ravi shankar</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m initialized cards using finit(NUll),after that i don&amp;#39;t got any
return value from that function,when i using finit(&amp;quot;MC0&amp;quot;),i got
return value of 0 (initialization success) when i using
finit(&amp;quot;MC1&amp;quot;),the function execution goes as infinite loop without any
return value.&lt;/p&gt;

&lt;p&gt;
NOTE: for all this i enabled both card devices in file
configuration .c&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash fs configuring two memory card devices</title><link>https://community.arm.com/thread/68397?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2013 06:49:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:563f4a9c-22b3-41f0-a0f0-835200988ee5</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you have two drivers - wouldn&amp;#39;t that imply that both memory
cards should be accessible concurrently? How would the file system
know that it must wait for the end of a transfer to one card before
it is possible to try a transfer to the other card?&lt;/p&gt;

&lt;p&gt;
Have you added any code to check that the two drivers aren&amp;#39;t
activated at the same time?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>