I'm trying to establish an SPI communication with a display. Here's my code which enables it:
SPI->CTRL=SPI_MASTER_bm|SPI_MODE0_bm|SPI_PRESCALER_DIV4_gc;
SPI->CTRL|=SPI_ENABLE_bm;
SPI is a member of my class which is successfully initialized to point to SPIC.
The code is finished, but there's nothing on the screen. I used the Embedded Debugger to see what the SPI points to and it's the same as SPIC. I saw in the memory watch and in the I/O watch. The Enable bit is set, but the master bit isn't. I don't know what could possibly turn off that bit. I Ctrl+F'd over the code to see if maybe there's an assignment writing into the control register. At first, I found out, but after fixing the code, I see the SPIC_MASTER bit set. After stepping through the code, the bit gets cleared. Is this an error in the microcontroller?