I have worked with AVR for may years but are new to SPI on Xmega.
The prolem is that I dont have any signal on the SCK pin.
My setup is
// Set up SPI
SPID.CTRL |= SPI_ENABLE_bm | SPI_MASTER_bm | SPI_MODE_2_gc| SPI_PRESCALER_DIV16_gc;
SPID.INTCTRL = SPI_INTLVL_OFF_gc ; // no interrupt
PORTD.DIRSET = PIN7_bm; //Set pin 7 out - SCK
PORTD.OUTSET = PIN4_bm;
PORTD.DIRSET = PIN4_bm; //Set pin 4 out - CS
I understand that the result can be read as:
result = SPID.DATA ;
Anyway, writing to the port sets the IF status flag so the data should have been sent.
Anybody knows the reason and have a solution?