I’m trying to get SPI1 to work my TFT display, but can’t seem to get data to flow through SPI1. So, obviously, I’ve overlooked something in SPI, so I made myself a tiny program that fails to send data out to the SPI1:
#define tftrstpin C2
#define tftrspin C1
#define tftcspin SS
int led1 = D6;
int led2 = D7;
void setup() {
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(D2,OUTPUT);
pinMode(D4,OUTPUT);
pinMode(D5,OUTPUT);
pinMode(D3,INPUT);
SPI1.begin(SPI_MODE_MASTER);
SPI1.setClockSpeed(15,MHZ);
}
void loop() {
digitalWriteFast(tftcspin,LOW);
SPI1.transfer(0x55);
digitalWriteFast(tftcspin,HIGH);
unsigned long timeis = millis();
if ((timeis % 1000) > 500)
{
digitalWriteFast(led2,HIGH);
}
else
{
digitalWriteFast(led2,LOW);
}
}
So my electron is breathing cyan, and my blue led is blinking at 1hz, but I can’t see any output with my oscilloscope. I expect to see the SS pin go low, then the SCK pin to toggle madly 8 times, while the MOSI pin toggles half madly, but I see none.