|
From: | Noam Weissman |
Subject: | Re: [lwip-users] stm32 ethernet interrup priority |
Date: | Mon, 22 Aug 2016 13:40:15 +0000 |
Hi Erkan, This is what I am using, a modified ST example with FreeRTOS 8.x For example this is how ETH is set: void ETH_IRQConfig(void) { NVIC_InitTypeDef NVIC_InitStructure; // Configures and enable the Ethernet global interrupt.
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ETH_ISR_PRIO; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure);
} This is my OS config with ISR priorities etc… Sorry for the alignment it’s the mail editor. /* #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H /*----------------------------------------------------------- * Application specific definitions. * * These definitions should be adjusted for your particular hardware and * application requirements. * * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
* * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configCPU_CLOCK_HZ ( ( unsigned long ) 168000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 20 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) (55 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 20 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_MALLOC_FAILED_HOOK 0 #define configUSE_RECURSIVE_MUTEXES 0 #define configUSE_TIMERS 1 #define configTIMER_QUEUE_LENGTH 20 #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE #define configTIMER_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) // for plugin //#define configQUEUE_REGISTRY_SIZE 6 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ #define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskCleanUpResources 0 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 0 #define INCLUDE_vTaskDelay 1 #define INCLUDE_xTaskGetCurrentTaskHandle 1 /*The table below gives the allowed values of the pre-emption priority and subpriority according * to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function * ========================================================================================================================== * NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description * ========================================================================================================================== * NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority * | | | 4 bits for subpriority * -------------------------------------------------------------------------------------------------------------------------- * NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority * | | | 3 bits for subpriority * --------------------------------------------------------------------------------------------------------------------------
* NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority * | | | 2 bits for subpriority * --------------------------------------------------------------------------------------------------------------------------
* NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority * | | | 1 bits for subpriority * --------------------------------------------------------------------------------------------------------------------------
* NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority * | | | 0 bits for subpriority * ==========================================================================================================================
*/ #define IRQ_SYS_PRIORITY_MODEL NVIC_PriorityGroup_4 /* Cortex-M specific definitions. */ #ifdef __NVIC_PRIO_BITS /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ #define configPRIO_BITS __NVIC_PRIO_BITS #else #define configPRIO_BITS 4 /* 15 priority levels */ #endif /* The lowest interrupt priority that can be used in a call to a "set priority" function. */ #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xF /* The highest interrupt priority that can be used by any interrupt service routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values. */ #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 /* Interrupt priorities used by the kernel port layer itself. These are generic to all Cortex-M ports, and do not rely on any particular library functions. */ #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define ADC3_DMA_ISR_PRIO (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 6) #define ETH_ISR_PRIO (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 5) #define IR_TIMERS_ISR_PRIO (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 2) #define SERIAL_ISR_PRIO (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1) #endif /* FREERTOS_CONFIG_H */
From: lwip-users [mailto:lwip-users-bounces+address@hidden
On Behalf Of Erkan Ersoy Thank you Noam; Somethings are confusing but i think i get it So I shouldn't use priority higher than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY value which is 5 by defult. cortexM3 have priority 0 to 255 but ST uses 0 to 15. Confusing part is ST used those defines #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) those values are configKERNEL_INTERRUPT_PRIORITY : 240 configMAX_SYSCALL_INTERRUPT_PRIORITY: 80 but they never used those defines so they used only values above 5 without defines. Those defines stay there idle. I use 6 for ethernet interrupt and 7 for USART interrupt now it seems work fine On Monday, August 22, 2016 11:51 AM, Jan Menzel <address@hidden> wrote: Hi Erkan!
|
[Prev in Thread] | Current Thread | [Next in Thread] |