Nokia 5110 + SD SPI == Fail

So I have my Nokia 5110 LCD working and the SD card shield working; I just can’t seem to get the LCD working when I initialize the SD library. I’ve already hacked the PCD8544 to allow me to define all the pins to use, but something about the SD library is breaking the SPI bus. Note: It doesn’t matter if the SD shield is connected or not. The SD card seems to work just fine (I can write files) and I’ve made sure to use the same SPI pins for both devices.

If you’re curious, my hacked version of the PCD8544 library is here:


#include <PCD8544.h>
#include <SD.h>

#define SPI_CLK         13 /* SPI CLK */
#define SPI_MISO        12 /* SPI MISO */
#define SPI_MOSI        11 /* SPI MOSI */
#define SD_SELECT       10 /* SD Card SPI Select */
#define LCD_SELECT      9  /* LCD SPI Select */
#define LCD_DC          8  /* LCD data/command */
#define LCD_RESET       7  /* LCD Reset */

PCD8544 LCD;

void setup() {
    pinMode(LCD_SELECT, OUTPUT);
    pinMode(SD_SELECT, OUTPUT);


    Serial.println("Starting LCD");

    /* initialize LCD */
    LCD.begin_custpins(84, 48, SPI_CLK, SPI_MOSI, LCD_DC,
            LCD_RESET, LCD_SELECT);

    // don't talk to LCD while we init the SD
    digitalWrite(LCD_SELECT, HIGH);

    /* initialize SD Card on SPI Bus */
    if (!SD.begin(SD_SELECT)) {
        Serial.println("SD card initialize failed, or not present");
    } else {
        Serial.println("SD card initialize success!");

    LCD.setCursor(0, 0);
    LCD.print("Started LCD!");

void loop() {
    LCD.println("LCD is running!");