AnsweredAssumed Answered

KL17 SPI - I'm missing something

Question asked by joe hinkle on Oct 26, 2016
Latest reply on Oct 29, 2016 by joe hinkle

The KL17 SPI should be very simple to set up and use, ... but I'm dead in the water.

 

My setup ... 

 

SIM_SCGC4 |= SIM_SCGC4_SPI1_MASK; // turn clock on
SIM_SCGC5 |- SIM_SCGC5_PORTB_MASK;
SIM_SCGC5 |- SIM_SCGC5_PORTD_MASK;

 

PORTB->PCR[16] = PORT_PCR_MUX(2); // SPI_MOSI
PORTD->PCR[5] = PORT_PCR_MUX(2); // SPI_CLK

 

 

SPI1_C1 =  SPI_C1_SPE_MASK |  SPI_C1_MSTR_MASK |  SPI_C1_CPOL_MASK;

 

SPI1_C2 = SPI_C2_SPIMODE_MASK; // set 16 bit data

SPI1_BR = 4;

 

That should be it ... but I have to be missing something because it won't xmit!!!

 

the SPI1_S register always has the  SPTEF  flag set  which says the xmitter is empty so you can load data to send.

 

No movement of the MOSI or clock pins.

 

After 6 hours burning brain matter try to see what I've missed ... I'm asking ... I have to be missing something ... please tell me what.

 

Thanks.

 

Joe

Outcomes