From 8df24d48777948e305e3201059ee1317ca2b1048 Mon Sep 17 00:00:00 2001 From: Julian Metzler Date: Tue, 11 Jun 2024 11:33:25 +0200 Subject: [PATCH] Set priorities for all but ADC1 and Fault interrupts to 1,0 so ADC doesn't get preempted --- Src/control.c | 10 +++++----- Src/setup.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Src/control.c b/Src/control.c index dd730948..78fa26d8 100644 --- a/Src/control.c +++ b/Src/control.c @@ -84,13 +84,13 @@ void PPM_Init(void) { #if defined(CONTROL_PPM_LEFT) /* EXTI interrupt init*/ - HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0); + HAL_NVIC_SetPriority(EXTI3_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI3_IRQn); #endif #if defined(CONTROL_PPM_RIGHT) /* EXTI interrupt init*/ - HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0); + HAL_NVIC_SetPriority(EXTI15_10_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); #endif @@ -200,15 +200,15 @@ void PWM_Init(void) { #ifdef CONTROL_PWM_LEFT /* EXTI interrupt init*/ - HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0); + HAL_NVIC_SetPriority(EXTI2_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI2_IRQn); - HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0); + HAL_NVIC_SetPriority(EXTI3_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI3_IRQn); #endif #ifdef CONTROL_PWM_RIGHT /* EXTI interrupt init*/ - HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0); + HAL_NVIC_SetPriority(EXTI15_10_IRQn, 1, 0); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); #endif diff --git a/Src/setup.c b/Src/setup.c index 3a8829f3..fff878cf 100644 --- a/Src/setup.c +++ b/Src/setup.c @@ -62,10 +62,10 @@ volatile adc_buf_t adc_buffer; __HAL_RCC_DMA1_CLK_ENABLE(); /* DMA1_Channel6_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0); + HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 1, 0); HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn); /* DMA1_Channel7_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0); + HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 1, 0); HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn); huart2.Instance = USART2; @@ -89,10 +89,10 @@ void UART3_Init(void) /* DMA interrupt init */ /* DMA1_Channel2_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel2_IRQn, 0, 0); + HAL_NVIC_SetPriority(DMA1_Channel2_IRQn, 1, 0); HAL_NVIC_EnableIRQ(DMA1_Channel2_IRQn); /* DMA1_Channel3_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 0, 0); + HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 1, 0); HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn); huart3.Instance = USART3; @@ -161,7 +161,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx); /* USART2 interrupt Init */ - HAL_NVIC_SetPriority(USART2_IRQn, 0, 0); + HAL_NVIC_SetPriority(USART2_IRQn, 1, 0); HAL_NVIC_EnableIRQ(USART2_IRQn); /* USER CODE BEGIN USART2_MspInit 1 */ __HAL_UART_ENABLE_IT (uartHandle, UART_IT_IDLE); // Enable the USART IDLE line detection interrupt @@ -216,7 +216,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart3_tx); /* USART3 interrupt Init */ - HAL_NVIC_SetPriority(USART3_IRQn, 0, 0); + HAL_NVIC_SetPriority(USART3_IRQn, 1, 0); HAL_NVIC_EnableIRQ(USART3_IRQn); /* USER CODE BEGIN USART3_MspInit 1 */ __HAL_UART_ENABLE_IT (uartHandle, UART_IT_IDLE); // Enable the USART IDLE line detection interrupt @@ -349,9 +349,9 @@ void I2C_Init(void) __HAL_LINKDMA(&hi2c2,hdmatx,hdma_i2c2_tx); */ /* Peripheral interrupt init */ -/* HAL_NVIC_SetPriority(I2C2_EV_IRQn, 0, 0); +/* HAL_NVIC_SetPriority(I2C2_EV_IRQn, 1, 0); HAL_NVIC_EnableIRQ(I2C2_EV_IRQn); - HAL_NVIC_SetPriority(I2C2_ER_IRQn, 0, 0); + HAL_NVIC_SetPriority(I2C2_ER_IRQn, 1, 0); HAL_NVIC_EnableIRQ(I2C2_ER_IRQn); */ }