pulp-platform / pulpino

An open-source microcontroller system based on RISC-V
http://www.pulp-platform.org
Other
899 stars 298 forks source link

Understanding how to set up event unit for interrupt #375

Closed mksit closed 3 years ago

mksit commented 3 years ago

Hi,

I am writing the C code to handle the interrupt from a custom module. I have already modified crt0.riscv.S to support the new interrupt, but I am confused about how to set up the event unit for the interrupt.

First, I followed this example (https://github.com/pulp-platform/pulpino/blob/master/sw/apps/riscv_tests/testIRQ/main.c) to write ECP, IER and ICP, but I found that the event unit got stuck in SLEEP state.

Then, I tried the approach in another example (https://github.com/pulp-platform/pulpino/blob/master/sw/apps/imperio_tests/testInterrupt/main.c) to write EER as well, and it finally works, but I don't understand why I need to set up EER.

What is the difference between event and interrupt for event unit? Which registers should I write before and after interrupt?