This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

freertos priority confusion

Setting interrupt priority according to FreeRTOS documentation is an inverted priority sequencing, i.e. lower number is high priority. However in the freeRTOS example provided, Logging is set to priority 1, and BLE 2. This would then set BLE is a lower priority then logging?

I am trying to design a 5 thread system. 1) BLE 2) Logging 3) LEDs 4) SAADC 5) SPI (external Flash). Confused as to how I should prioritize these.

Also in the SDK 14 FreeRTOS example, BLE is no longer in isn't own task? What was the architecture reasoning behind this?

p.s. Note I'm using SDK 12.3 and cannot migrate over to SDK 14 quite now.

Thanks guys,

Parents
  • Hi Dave, In FreeRTOS low priority number means low priority (inverse to what we have on ARM core, where exception priority is higher with lower number).

    You can read more about FreeRTOS priority here. Please note the line below mentioned on that page.

    Low priority numbers denote low priority tasks. The idle task has priority zero (tskIDLE_PRIORITY)
    

    I haven't tried the example in SDK14 myself but quick look shows that the function nrf_sdh_freertos_init creates a task for BLE.

  • This contradicts the FreeRTOS documentation. In file list.c "...on Cortex-M parts where numerically high priority values denote low actual interrupt priorities, which can seem counter intuitive."

    This is also mentioned in the FreeRTOS documentation page: www.freertos.org/RTOS-Cortex-M3-M4.html

    "The next thing to know is that, in ARM Cortex-M cores, numerically low priority values are used to specify logically high interrupt priorities. For example, the logical priority of an interrupt assigned a numeric priority value of 2 is above that of an interrupt assigned a numeric priority of 5."

Reply Children
No Data
Related