stm32f1: Serial should have a higher irq priority than timers
It's possible for the code to stay in the timer irq for up to 100ms, so serial irqs should have a higher irq priority to prevent them from being starved. (The timer code disables irqs during event dispatch, so serial irqs would only be permitted between events anyway.) Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d32506bd2e
commit
1302514ea8
|
@ -29,8 +29,8 @@ serial_init(void)
|
||||||
LL_USART_SetHWFlowCtrl(USART1, LL_USART_HWCONTROL_NONE);
|
LL_USART_SetHWFlowCtrl(USART1, LL_USART_HWCONTROL_NONE);
|
||||||
LL_USART_SetTransferDirection(USART1, LL_USART_DIRECTION_TX_RX);
|
LL_USART_SetTransferDirection(USART1, LL_USART_DIRECTION_TX_RX);
|
||||||
LL_USART_EnableIT_RXNE(USART1);
|
LL_USART_EnableIT_RXNE(USART1);
|
||||||
|
NVIC_SetPriority(USART1_IRQn, 0);
|
||||||
NVIC_EnableIRQ(USART1_IRQn);
|
NVIC_EnableIRQ(USART1_IRQn);
|
||||||
NVIC_SetPriority(USART1_IRQn, 1);
|
|
||||||
LL_USART_Enable(USART1);
|
LL_USART_Enable(USART1);
|
||||||
|
|
||||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#include "autoconf.h"
|
#include "autoconf.h"
|
||||||
#include "board/misc.h" // timer_from_us
|
#include "board/misc.h" // timer_from_us
|
||||||
#include "stm32f1xx.h"
|
#include "stm32f1xx.h"
|
||||||
#include "stm32f1xx.h"
|
|
||||||
#include "stm32f1xx_ll_bus.h"
|
#include "stm32f1xx_ll_bus.h"
|
||||||
#include "stm32f1xx_ll_tim.h"
|
#include "stm32f1xx_ll_tim.h"
|
||||||
#include "command.h" // shutdown
|
#include "command.h" // shutdown
|
||||||
|
@ -96,8 +95,8 @@ timer_init(void)
|
||||||
LL_TIM_SetAutoReload(TIM2, 0xFFFF);
|
LL_TIM_SetAutoReload(TIM2, 0xFFFF);
|
||||||
LL_TIM_EnableIT_CC1(TIM2);
|
LL_TIM_EnableIT_CC1(TIM2);
|
||||||
LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH1);
|
LL_TIM_CC_EnableChannel(TIM2, LL_TIM_CHANNEL_CH1);
|
||||||
|
NVIC_SetPriority(TIM2_IRQn, 2);
|
||||||
NVIC_EnableIRQ(TIM2_IRQn);
|
NVIC_EnableIRQ(TIM2_IRQn);
|
||||||
NVIC_SetPriority(TIM2_IRQn, 0);
|
|
||||||
timer_kick();
|
timer_kick();
|
||||||
timer_reset();
|
timer_reset();
|
||||||
LL_TIM_EnableCounter(TIM2);
|
LL_TIM_EnableCounter(TIM2);
|
||||||
|
|
Loading…
Reference in New Issue