Resolving Unhandled IRQn Error with SPI4

I’ve been encountering an ‘Unhandled IRQn error’ specifically when using SPI4, which doesn’t occur with SPI3, SPI2, or SPI1. After reviewing the provided code and logs, here are some potential causes and solutions:

  1. Interrupt Handling: The error suggests that SPI4’s interrupt isn’t being handled properly. Ensure that the NVIC settings enable and prioritize SPI4’s interrupt correctly.

  2. DPPI Configuration: The Digital Pulse Processing Interface (DPPI) might not be configured correctly. Verify that the Timer and SPI events are properly linked without conflicts.

  3. GPIO and Pin Settings: Check that the GPIO pins for SPI4 are correctly configured as outputs and not conflicting with other peripherals.

  4. SPI Frequency: The SPI frequency might be too high for the hardware or connected device. Try lowering the frequency to see if the issue persists.

  5. Error Handling: Enhance the SPI event handler to better manage errors, ensuring transfers are aborted and SPI is reset if an error occurs.

  6. Simplified Testing: Test SPI4 with a basic read/write operation to isolate if the issue is with the application code or configuration.

  7. Hardware Limitations: Check for any hardware-specific limitations or errata related to SPI4 on your nRF device.

By addressing these areas, you can identify and resolve the cause of the unhandled IRQn error on SPI4.