SPI and card.init failed

Hi,

I am using the SPI port to interface a SD card and two other devices. The problem is that I can interface each one individually working very well. However, when I try to integrate all together is not working. The SD Card throw the following error:
error: card.init failed
SD error: 2,1F

Using other SD Card gives to me:
error: volume.init failed
SD error: 3,1D

I am using this, on the setup section:

// initialize SPI port 
void spi_initialize(void) {
  SPCR = (1<<SPE) | (1<<MSTR); // spi enabled, master mode
  clr = SPSR; // dummy read registers to clear previous results
  clr = SPDR;
}
// SPI specific for master/slave communication
	pinMode(MOSI, OUTPUT);
	pinMode(SCK, OUTPUT);
	pinMode(MISO, INPUT);
        // Looked at page 11 of this: http://www.atmel.com/dyn/resources/prod_documents/doc2585.pdf
        pinMode(10, OUTPUT); 
        digitalWrite(10, HIGH); //physical SS pin high before setting SPCR
         
	// Slaves as outputs
	pinMode(6, OUTPUT);
	pinMode(7, OUTPUT);
	
	// magnetometer specific pins
	pinMode(9, OUTPUT);
	
        //reset pins
	digitalWrite(9, LOW);
	
	// slaves deselected
	digitalWrite(6, LOW);   // rtc idle mode
	digitalWrite(7, HIGH); // datasheet HIGH =  in idle mode

        Serial.begin(9600); // downlink baud rate
    
        spi_initialize(); // initialize SPI port
        // initialize the SD card
        if (!card.init(SPI_FULL_SPEED, 8)) error("card.init failed");

Have a look inside SD2card.cpp. All this is already done there, so you don't need to do it yourself:

  SPCR = (1<<SPE) | (1<<MSTR); // spi enabled, master mode
  clr = SPSR; // dummy read registers to clear previous results
  clr = SPDR;

...

  // set pin modes
  pinMode(chipSelectPin_, OUTPUT);
  chipSelectHigh();
  pinMode(SPI_MISO_PIN, INPUT);
  pinMode(SPI_MOSI_PIN, OUTPUT);
  pinMode(SPI_SCK_PIN, OUTPUT);

Are you saying your posted code on its own fails? Or in conjunction with the other devices? We need more detail then. But the basic point is that the chip select for each device need to be pulled low when you want to use it and set high again afterwards. Judging by the SDfat library, that is doing that. But what about the other devices? For example, before trying the card.init did you already initialize SPI for another device?

By the way, the SPI library does all this low-level stuff, it's just confusing to play with individual registers unless you have to.