I am having the same problem, and was wondering if you could help.
I created a project with PIC18F26k42 and generated the code using MCC generator.
Timers are working fine, BUT the SPI doesn't work,
I can't see ANY signal in the SCK pin with an oscilloscope.
It is as you said, the initialization is empty,
so I tried to implement my own initialization but it is still NOT working..
Could you provide your initialization code? and also did you modify anything else from the generated MCC files?
Here is my initialization:
SPI1CON0bits.EN = 0; // Disable
SPI1CON0bits.MST = 1; // MASTER
SPI1CON0bits.BMODE = 0;
SPI1CON1bits.SMP = 0;
SPI1CON1bits.CKE = 0;
SPI1CON1bits.CKP = 1;
// Write only mode
SPI1CON2bits.TXR = 1;
SPI1CON2bits.RXR = 0;
SPI1CON0bits.EN = 1; // Enable
When I use SPI1_Exchange8bit it doesn't trigger any SCK signal,
Also it gets stuck so I modified it:
uint8_t SPI1_Exchange8bit(uint8_t data)
//One byte transfer count
SPI1TCNTL = 1;
SPI1TXB = data;
while (SPI1INTFbits.SRMTIF == 0);