I tried searching for using 2 SPI devices on the same pin, but could not find an answer for my current situation.
I am trying to use an E-ink display( Waveshare 10.3 inch with IT-8951 driver) that loads images using the SD Card Module.
I am currently using the Wemos D1 R32 which only has one set of SPI pins. So I have connected both the devices to the same set of SPI pins.
Both initialize and work perfectly without the other set of pins. I am not able to properly initialize both the devices at the same time.
Even if they initialize occasionally, The E-ink display behaves differently displaying lighter/darker images than the normal and eventually goes dark.
#include <SD.h>
#include <SPI.h>
const int chipSelect = 16;
uint8_t six[6000];
int i=0;
void setup(void)
{
Serial.begin(115200);
//SD Card Code begin
Serial.print("Initializing SD Card....");
//SD.begin(chipSelect);
if(!SD.begin(16))
{
Serial.print("Card failed, or not Present");
// return;
}
Serial.println("Card Initialized");
File dataFile = SD.open("/data.txt");
if(dataFile)
{
Serial.println("six.txt");
while(dataFile.available())
{
six[i] = dataFile.parseInt();
i++;
}
for(int i=0;i<10;i++)
{
Serial.println(six[i]);
delay(3000);
}
dataFile.close();
}
else
{
Serial.println("File does not exist or named wrong");
}
//SD Card Code end
Serial.println("\n\n\n");
Serial.printf("MISO %i\n", MISO);
Serial.printf("MOSI %i\n", MOSI);
Serial.printf("SCK %i\n", SCK);
Serial.printf("CS %i\n", CS);
Serial.printf("RESET %i\n", RESET);
Serial.printf("HRDY %i\n", HRDY);
Serial.println("Display init ...");
if(!display_begin()) {
Serial.println("Display init failed");
exit(1);
};
Serial.println("Display init ok");
IT8951DisplayArea(0, 0, 1200, 825, 0);
}
//extern unsigned char six[];
//extern unsigned char sixone[];
//extern unsigned char sixthree[];
//extern unsigned char sixfour[];
unsigned int pic_width = 600;
unsigned int pic_height = 412;
void loop() {
int x = random(0, gstI80DevInfo.usPanelW - pic_width);
int y = random(0, gstI80DevInfo.usPanelH - pic_height);
x -= x%4; // somehow the image is distorted when not aligned like this
display_buffer(six, 300, 300, pic_width, pic_height);
}
While initiating the E-ink, the Serial monitor reads this,
- Proper Initialization
Panel(W,H) = (1200,825)
Image Buffer Address = 11A1E0
FW Version = SWv_0.2.1T
LUT Version = M841
- Not initialized When using both the SD at the same time.
W: 65535 H: 65535
Image Buffer Address = FFFFFFFF
FW Version = ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮(a@?
LUT Version = ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮(a@?