From 315076375f516ed6ea5d74601d53677af83d9306 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 25 Mar 2019 00:40:51 +0700 Subject: [PATCH] fix timer prio for freertos to blink led --- examples/device/cdc_msc_hid_freertos/ses/nrf5x/FreeRTOSConfig.h | 2 +- examples/device/cdc_msc_hid_freertos/src/main.c | 2 ++ hw/bsp/pca10056/board_pca10056.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/FreeRTOSConfig.h b/examples/device/cdc_msc_hid_freertos/ses/nrf5x/FreeRTOSConfig.h index 26df38d3d..754158622 100644 --- a/examples/device/cdc_msc_hid_freertos/ses/nrf5x/FreeRTOSConfig.h +++ b/examples/device/cdc_msc_hid_freertos/ses/nrf5x/FreeRTOSConfig.h @@ -83,7 +83,7 @@ /* Software timer related definitions. */ #define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY 2 +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2) #define configTIMER_QUEUE_LENGTH 32 #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE diff --git a/examples/device/cdc_msc_hid_freertos/src/main.c b/examples/device/cdc_msc_hid_freertos/src/main.c index b5d5cf790..388bd9ad1 100644 --- a/examples/device/cdc_msc_hid_freertos/src/main.c +++ b/examples/device/cdc_msc_hid_freertos/src/main.c @@ -125,6 +125,8 @@ void cdc_task(void* params) tud_cdc_write_flush(); } } + + taskYIELD(); } } diff --git a/hw/bsp/pca10056/board_pca10056.c b/hw/bsp/pca10056/board_pca10056.c index 923721fd7..90f466356 100644 --- a/hw/bsp/pca10056/board_pca10056.c +++ b/hw/bsp/pca10056/board_pca10056.c @@ -91,6 +91,8 @@ void board_init(void) SysTick_Config(SystemCoreClock/1000); #endif + // Priorities 0, 1, 4 (nRF52) are reserved for SoftDevice + // 2 is highest for application NVIC_SetPriority(USBD_IRQn, 2); // USB power may already be ready at this time -> no event generated