How do you use peripheral Interrupts? #2107
Replies: 1 comment 1 reply
-
ok i think i got a bit closer to what i want, though it's still not functional. I Initalize the SPI2 peripheral in the setup function like this:
then i (hopefully) set the correct bits in the NVIC like so:
this should trigger an interrupt when the SPI Slave has started to transfer that preloaded 0xFF byte. so i did that as well and replaced the old but still, the interrupt never gets triggered so i don't know which part of this i screwed up as it all seems correct to me. maybe i overlooked something with the NVIC? any help would be nice :( |
Beta Was this translation helpful? Give feedback.
-
I got a project that i want to port from AVR to STM32.
that project mainly works around the MCU being an SPI Slave with interrupt driven communication.
it used the Dx Core which makes peripheral interrupts really simple to use.
you just manually enable the interrupt by writing to the correct control register and then use the
ISR(x)
function withx
being the name of the vector to use, which depends on the peripheral.so for my SPI Slave IRQ handler the function was called
ISR(SPI_STC_vect)
now of course the same exact function won't work in this core as well. but either i'm blind or the wiki doesn't mention an equivalent function... or really ANYTHING about using interrupts.
so how do you do stuff like this with this core?
i can enable the interrupt flag in the SPI control register, that one is easy. but how do i assign a function to run when that specific interrupt hits?
Beta Was this translation helpful? Give feedback.
All reactions