STM32F303 ; SPI Clock polarity; and interrupt not work
in code :
// Bit1 CPOL: Clock polarity
// 1: CK to 1 when idle
SPI2->CR1 |= 1<<1;
in fact clock is Zero when idle .
interrupt not work, src:
// Bit 7 TXEIE: Tx buffer empty interrupt enable
// 0: TXE interrupt masked
// 1: TXE interrupt not masked. Used to generate an interrupt request when the TXE flag is set.
SPI2->CR2 |= 1<<7 ;
// Bit 6 RXNEIE: RX buffer not empty interrupt enable
// 0: RXNE interrupt masked
// 1: RXNE interrupt not masked. Used to generate an interrupt request when the RXNE flag is set.
SPI2->CR2 |= 1<<6;
---------------
// 52 SPI2 global
// 0x0000 00D0
(uint32_t) spi_2_interrupt_handler,
-------------
__attribute__((interrupt("IRQ")))
void spi_2_interrupt_handler (void)
{SPI2->DR = 0x55;}
-----------------