1

The situation is as follows, I've connected a SPI TFT screen to the ESP8266 DevKit, set my own MISO,MOSI, CD, SCK pins and it works fine, wanted to do the same for using the SD card reader, but then I realized that the SD library is using the pre-defined pins with no visible way override this.. There must be a way, no?

I did try editing the pins_xxx files:

static const uint8_t SS   = 10;
static const uint8_t MOSI = D7; //11;
static const uint8_t MISO = D5; //12;
static const uint8_t SCK  = D6; //13;

But it did not work, I'm not that well familiar about the build process.. So, is there a way to accomplish this? Maybe a different library?

P.S. I am using the Arduino IDE for the ESP.

3
  • 1
    Do you have a reason to not share the SCK, MISO, MOSI lines between the two devices? – James Waldby - jwpat7 Jun 4 '17 at 22:22
  • 1
    on nodeMCUs, you really want to use the native (SPECIAL) pin modes when you can, especially on a device like a screen. in other words, get the SD working, then share with the TFT sans CS, which remaps. – dandavis Jun 5 '17 at 1:06
  • @JamesWaldby-jwpat7 & dandavis I just got familiar with the SPI interface and did not know about sharing the pins, now I do though, thanks! – MustSeeMelons Jun 5 '17 at 12:01
0

After some trial and error got both the screen and sd card reader working sharing the MISO and SCK lines. I was using a display wit the Adafruit ST7735 driver (and their library), worked fine with both hardware and software, but the SD card reader (generic, not even a part number on it) was able to work only with hardware SPI as the standard SD library does not support software SPI for some reason. The most important takeaway is this: The SD library internally uses the predefined MOSI,MISO and SCK pins, but fot the ESP8266 dev kit they were mapped to pins labeled HMOSI, HMISO and HSCLK - D7, D6 and D5. Now that I think about it, the H must stand for "Hardware", if only I had this epiphany sooner.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.