polarfire-soc / polarfire-soc-documentation

PolarFire SoC Documentation
Other
37 stars 19 forks source link

How to use global interrupts #52

Closed fcuzzocrea closed 3 years ago

fcuzzocrea commented 3 years ago

Hi!

I am trying to write a simple demo application to interact with UART interrupts using the baremetal library.

Right now, to keep it as simple at possible I am only interacting with HART 0.

If I use local interrupts on hart0 (i.e. using MSS_UART_enable_local_irq() on UART0) this simple program (https://hastebin.com/ucemunudik.cpp) works as expected, in the sense that if I type something on the keyboard from my UART output, the "hart0 MMUART0 local IRQ." is printed correctly.

If I want to use interrupts via the PLIC (i.e. using MSS_UART_enable_irq() on UART0) instead the program (https://hastebin.com/aqodotenar.cpp) in not working, in the sense that the message which should be printed by MSS_UART_irq_tx() does not appear on the UART output, nor the input from the keyboard triggers the rx handler. Is there something else I am missing to be able to make it work?

Thanks in advance!!!

hughbreslin commented 3 years ago

Hey @fcuzzocrea have you also enabled the PLIC interrupts and set the interrupt priority for the UART you're using?

Have a look at this example

You can find IRQ names here in the mss_plic.h file.

hughbreslin commented 3 years ago

Actually, sorry, this example is much better!

fcuzzocrea commented 3 years ago

Thanks! I was missing to call PLIC_SetPriority() !

hughbreslin commented 3 years ago

If everything's working ok would you be able to mark the issue as closed? If you have any further issues on this please let me know :)

fcuzzocrea commented 3 years ago

Yeah of course! Thanks for you help!