Using Local Interrupts #142
-
I am porting a FreeRTOS-based application from SmartFusion2 to the PolarFire ICICLE Kit. Currently, I am debugging from LIM. I started with the MSS_RTC driver example in SoftConsole and pulled in the 64-Bit FreeRTOS port from the general FreeRTOS Distro. I have my application running on HART 4 and communicating via a 'console' on UART_3 and the si2180 USB adapter. The MSS_UART drivers are used with interrupt driven RX via the PLIC. I have customer registers/interfaces in the fabric that I can read/write via FIC_3. However, I'm stuggling with getting the fabric interrupts to work. I'm not sure if this is a lack of understanding wrt creating the ISRs, or if there's an issue in the FreeRTOS port IRQ handling. I have tried both Global (PLIC) and Local IRQ approaches. Choosing one IRQ as an example: Local Approach: Defined enable and disable functions to access the Local Interrupt register of U54_4 as follows:
Defined the RX ISR as follows:
A FreeRTOS-based
PLIC approach: (in U54_4.c)
Provided enable/disable functions wrap the
Then edited the Thoughts ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Also tried a cleaned up
|
Beta Was this translation helpful? Give feedback.
-
Hi @JV73 we have a plan to look into this with a simpler project to try and re-create what you're doing, it'll take us a few days to get it set up to test out the theory that things have gotten out of sequence (which seems more plausible than an issue with the interrupt handling or the PLIC itself), I just wanted to acknowledge this so you know we are going to have a look. Its hard to give a concrete answer without running your code and seeing it for ourselves |
Beta Was this translation helpful? Give feedback.
-
It turns out that, the RISC-V/64-bit/SoftConsole FreeRTOS port in the distro examples pre-empts the mpfs-hal's trap_from_machine_mode() function and the preprocessor setting 'portasmHANDLE_INTERRUPT=handle_m_ext_interrupt' directs FreeRTOS to invoke PLIC-based IRQ handling; so an application must use a PLIC-based approach to IRQ handling when running under this particular RISC-V FreeRTOS port. Also, when using the PLIC, we found that an F2M_IRQ signal should be cleared (de-asserted) from within the PLIC-based ISR() and return EXT_IRQ_KEEP_ENABLED rather than using EXT_IRQ_DISABLE and then having the application re-enable the IRQ after taking some action. This is due to some 'latency' in the PLIC that may allow the application to proceed and re-enable the IRQ before the PLIC has finished the 'completion process' and disables the IRQ (thus, in this case, the 'trigger once or twice but then never again' behavior that we observed. |
Beta Was this translation helpful? Give feedback.
It turns out that, the RISC-V/64-bit/SoftConsole FreeRTOS port in the distro examples pre-empts the mpfs-hal's trap_from_machine_mode() function and the preprocessor setting 'portasmHANDLE_INTERRUPT=handle_m_ext_interrupt' directs FreeRTOS to invoke PLIC-based IRQ handling; so an application must use a PLIC-based approach to IRQ handling when running under this particular RISC-V FreeRTOS port.
Also, when using the PLIC, we found that an F2M_IRQ signal should be cleared (de-asserted) from within the PLIC-based ISR() and return EXT_IRQ_KEEP_ENABLED rather than using EXT_IRQ_DISABLE and then having the application re-enable the IRQ after taking some action. This is due to some 'latency' in t…