EVK1.4 BSP

Introduction

The EVK1.4 BSP is designed for clarity and flexibility, with a modular architecture where each file is generally assigned to specific peripherals, streamlining application development and customization. Reference files are provided below.

IRQ Priority Scheme

SPARK projects use a 4-bit priority system, allowing for 16 levels of interrupt priority (0-15), where a lower number indicates a higher priority. Below is the IRQ priority definitions as well as a breakdown and rationale behind each choice.

/* Priorities */
#define PRIO_AUDIO_SAI_DMA_TX_IRQ   1
#define PRIO_AUDIO_SAI_DMA_RX_IRQ   1
#define PRIO_RADIO_IRQ              2
#define PRIO_RADIO_DMA_RX_CPLT      2
#define PRIO_RADIO_DMA_TX_CPLT      2
#define FREE_RUNNING_TIMER_PRIORITY 3
#define PRIO_USB_LP_IRQ             8
#define PRIO_LPUART_IRQ             11
#define PRIO_LPUART_DMA_TX_CPLT     11
#define PRIO_LPUART_DMA_RX_CPLT     11
#define PRIO_UART4_IRQ              11
#define PRIO_USB_DET_IRQ            11
#define PRIO_PENDSV_IRQ             12
#define PRIO_TIMER_NO_IRQ           0xFFFFFFFF

Priority 1: Audio SAI DMA IRQs

Audio SAI DMA IRQs are set at priority 1, the highest configured priority in the BSP, to ensure SAI transfers are done in a timely manner with the use of DMA. Audio operations are sensitive to delays, as any lag could affect audio playback quality. By keeping this at the highest priority, it is ensured that audio data is fed or obtained from the SAI peripheral through DMA as soon as possible, preventing disruptions.

Priority 2: Radio IRQs

At priority 2, radio IRQs handle the UWB communication. Although they are not as time critical as audio, they still need to be processed within a certain period to ensure that the schedule is maintained. This configuration allows SAI operations to take precedence but still provides a high-priority path for radio operations.

Priority 8: USB IRQ

The USB IRQ, responsible for data transfer, is set at priority 8. The USB interrupt service routine is less time sensitive than audio or radio operations. This level allows higher-priority interrupts to preempt USB handling, as well as keeps priorities 3 to 7 open for developer use. Bear in mind that implementing processing-heavy operations at priority 3-7 could hinder proper USB operations.

Priority 11: USB Detection IRQ

The USB detection IRQ is set at priority 11 and is used to detect when a USB device is connected or disconnected.

Priority 12: PendSV IRQ (Wireless Core Callbacks)

The PendSV IRQ, set at priority 12, is implemented as a software interrupt that handles callbacks from the SPARK Wireless Core (SWC) by context switching. This IRQ is used to offload tasks from higher-priority interrupts, ensuring non-critical processing doesn’t interfere with core functionalities on non-RTOS systems. With an RTOS, other mechanisms such as notifications or semaphores are used to trigger the thread in charge of SWC callbacks.

Priorities 0, 3-7, 9-10, and 13-15: Open for Developer Use

These priorities are available for developers to use as needed, allowing flexibility to accommodate additional peripherals or features. Developers should plan their IRQ needs to ensure the most critical tasks receive prompt processing and that they are short enough to not negatively affect lower priority service routines.

Timer IRQs: Application-Level Prioritization

Timer IRQs are not fixed in the priority list but are instead set at the application level. This is because their priority requirements can vary greatly depending on the application’s specific timing needs. Developers should plan and assign priorities to these timer IRQs according to the timing constraints and latency requirements of their application.

Reference