Electron: SPI1 not SPI1ing?

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.

Set the clock speed FIRST, and use D5 for the slave select.

Does this mean that that solved the issue? If so, providing that context to the statement would help :wink:

That’s what solved it. Getting SPI data flowing now. At least I can see it on my scope, TFT display still does nothing, so still looking for mistakes. Let’s see, mosi to mosi, miso to miso, sclk to sclk, D5 to CS…

I would first kick that speed way down to eliminate other issues.
I would start off with at the most 1MHZ. Once you get it working there you can start to increase it in steps until the LCD starts acting flakey and then back off some.

Been having trouble finding any guidance on how fast the display should go. I’ll try SLOW.

Oh. The real code for the tft WAS at 1MHz…

Hmm. Why is the reset being held low. Ok. Fixed.

One more mistake fixed, more to go.

Hmm. My MISO signal looks pretty wonky. Low is .5v and high is .8v?

Let’s see, it’s wired to D3, JTAG isn’t trying to assert JTAG_TRST?

Oh my! Something drew on my display!

happy happy happpy