I’ve used the PWM peripheral for generating external facing signals but now I want to use the PWM as a fast interrupt source. I’ve setup the PLIC to generate an external interrupt using the PWM module as the source, as in this quick and dirty example:
It should be setting a global variable which, when set, will be tested in the main loop and invert the green LED (embedded for “Hello, world!”). However, that never happens? If I put in a puts() statement within handle_m_ext_interrupt() I see that the interrupt is firing as expected.
In contrast, if I setup an internal timer interrupt the same logic works as expected:
HiFive1 Timer interrupt sample
I’m sure I’m missing something obvious about using external interrupt sources that was probably stated numerous times in documentation, but I can’t quite put my finger on it.
Cheers.