diff --git a/flight/AHRS/pios_board.c b/flight/AHRS/pios_board.c index cfe9c6d5f..7a6a61b21 100644 --- a/flight/AHRS/pios_board.c +++ b/flight/AHRS/pios_board.c @@ -301,8 +301,7 @@ const struct pios_i2c_adapter_cfg pios_i2c_main_adapter_cfg = { .flags = 0, /* FIXME: check this */ .init = { .NVIC_IRQChannel = I2C1_EV_IRQn, - //.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, - .NVIC_IRQChannelPreemptionPriority = 2, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, @@ -312,8 +311,7 @@ const struct pios_i2c_adapter_cfg pios_i2c_main_adapter_cfg = { .flags = 0, /* FIXME: check this */ .init = { .NVIC_IRQChannel = I2C1_ER_IRQn, - //.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, - .NVIC_IRQChannelPreemptionPriority = 2, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, diff --git a/flight/OpenPilot/System/pios_board.c b/flight/OpenPilot/System/pios_board.c index f710b43a4..a6798003d 100644 --- a/flight/OpenPilot/System/pios_board.c +++ b/flight/OpenPilot/System/pios_board.c @@ -331,7 +331,7 @@ const struct pios_usart_cfg pios_usart_telem_cfg = { .handler = PIOS_USART_telem_irq_handler, .init = { .NVIC_IRQChannel = USART2_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, @@ -378,7 +378,7 @@ const struct pios_usart_cfg pios_usart_gps_cfg = { .handler = PIOS_USART_gps_irq_handler, .init = { .NVIC_IRQChannel = USART3_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, @@ -426,7 +426,7 @@ const struct pios_usart_cfg pios_usart_aux_cfg = { .handler = PIOS_USART_aux_irq_handler, .init = { .NVIC_IRQChannel = USART1_IRQn, - .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH, + .NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID, .NVIC_IRQChannelSubPriority = 0, .NVIC_IRQChannelCmd = ENABLE, }, diff --git a/flight/PiOS/Boards/STM3210E_OP.h b/flight/PiOS/Boards/STM3210E_OP.h index e26731d01..5c17794b3 100644 --- a/flight/PiOS/Boards/STM3210E_OP.h +++ b/flight/PiOS/Boards/STM3210E_OP.h @@ -116,7 +116,7 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8 #define PIOS_BMP085_EOC_CLK RCC_APB2Periph_GPIOC #define PIOS_BMP085_EOC_EXTI_LINE EXTI_Line15 #define PIOS_BMP085_EOC_IRQn EXTI15_10_IRQn -#define PIOS_BMP085_EOC_PRIO PIOS_IRQ_PRIO_HIGH +#define PIOS_BMP085_EOC_PRIO PIOS_IRQ_PRIO_LOW //#define PIOS_BMP085_OVERSAMPLING 2 #define PIOS_BMP085_OVERSAMPLING 3 @@ -353,7 +353,7 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8 /* With an ADCCLK = 14 MHz and a sampling time of 293.5 cycles: */ /* Tconv = 239.5 + 12.5 = 252 cycles = 18?s */ /* (1 / (ADCCLK / CYCLES)) = Sample Time (?S) */ -#define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_HIGH +#define PIOS_ADC_IRQ_PRIO PIOS_IRQ_PRIO_MID //------------------------- // GPIO diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index cb3e08cfc..107da6ba0 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -68,8 +68,8 @@ void PIOS_PPM_Init(void) /* Enable timer interrupts */ NVIC_InitTypeDef NVIC_InitStructure; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannel = PIOS_PPM_TIM_IRQ; NVIC_Init(&NVIC_InitStructure); @@ -120,8 +120,8 @@ void PIOS_PPM_Init(void) /* Configure interrupts */ NVIC_InitStructure.NVIC_IRQChannel = PIOS_PPM_SUPV_IRQ_CHANNEL; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); diff --git a/flight/PiOS/STM32F10x/pios_pwm.c b/flight/PiOS/STM32F10x/pios_pwm.c index 412466dd5..e8cdeecb1 100644 --- a/flight/PiOS/STM32F10x/pios_pwm.c +++ b/flight/PiOS/STM32F10x/pios_pwm.c @@ -79,8 +79,8 @@ void PIOS_PWM_Init(void) /* Enable timer interrupts */ NVIC_InitTypeDef NVIC_InitStructure; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; for (i = 0; i < PIOS_PWM_NUM_TIMS; i++) { NVIC_InitStructure.NVIC_IRQChannel = PIOS_PWM_TIM_IRQ[i]; @@ -144,8 +144,8 @@ void PIOS_PWM_Init(void) /* Configure interrupts */ NVIC_InitStructure.NVIC_IRQChannel = PIOS_PWM_SUPV_IRQ_CHANNEL; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); diff --git a/flight/PiOS/STM32F10x/pios_spektrum.c b/flight/PiOS/STM32F10x/pios_spektrum.c index 675a50fb4..8f49b8941 100644 --- a/flight/PiOS/STM32F10x/pios_spektrum.c +++ b/flight/PiOS/STM32F10x/pios_spektrum.c @@ -66,8 +66,8 @@ void PIOS_SPEKTRUM_Init(void) /* Configure interrupts */ NVIC_InitStructure.NVIC_IRQChannel = PIOS_SPEKTRUM_SUPV_IRQ_CHANNEL; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; + NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID; + NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); diff --git a/flight/PiOS/STM32F10x/pios_usb_hid.c b/flight/PiOS/STM32F10x/pios_usb_hid.c index fbd6f5e3c..5fb49900a 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid.c @@ -96,7 +96,6 @@ int32_t PIOS_USB_HID_Init(uint32_t mode) /* Enable the USB Interrupts */ /* 2 bit for pre-emption priority, 2 bits for subpriority */ NVIC_InitTypeDef NVIC_InitStructure; - NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;