2011-03-10 06:55 AM
How do you properly ack peripheral IRQs in STM32L?
2011-05-17 05:27 AM
In general you should clear in the PERIPHERAL the bit that caused the interrupt or disable the interrupt.
NVIC_ClearPendingIRQ(SPI2_IRQn); // not really neccessary. NVIC_EnableIRQ(SPI2_IRQn); pSpiBus->CR2 |= SPI_CR2_TXEIE; However as soon as I enable the interrupt, I hit the ISR over & over because I'm not acking the interrupt correctly. My ISR looks like this: void SPI2_IRQHandler(void) { // contunue transmission: pSpiBus-> DR = ....; // or pSpiBus->CR2 &= ~SPI_CR2_TXEIE; // disable interrupt }2011-05-17 05:27 AM
Wait a minute, I'm an idiot. The SPI_CR2_TXEIE generates an interrupt whenever the TX buffer is empty, not when it's done transmitting. That's why I'm hitting it over & over. duh.