You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to use uart (via printf) in interrupt handlers such as the i2c handler (via Wire.onRequest).
Describe the solution you'd like
I am not sure about all the supported devices, but on the STM32F103, the subpriority is ignored because NVIC_PRIORITYGROUP_4 is used. Currently, the I2C interrupts are set to preemption priority 0. The USART1 preemption priority is also 0. This means that using UART in an interrupt handler will never exit, because HAL_UART_Transmit requires the USART interrupt.
On the other hand, this may be a good idea because using printf() inside an interrupt handler is slow, but interrupt handlers should be really fast.
Currently I can manually do this:
Wire.begin(0x50);
HAL_NVIC_SetPriority(I2C1_ER_IRQn, 1, 0);
HAL_NVIC_SetPriority(I2C1_EV_IRQn, 1, 0);
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0); // usart now has higher priority than i2c
Perhaps we should take a look at all of the interrupt priorities in the code base and decide on a global ordering.
The text was updated successfully, but these errors were encountered:
I am unable to use uart (via
printf
) in interrupt handlers such as the i2c handler (viaWire.onRequest
).Describe the solution you'd like
I am not sure about all the supported devices, but on the STM32F103, the subpriority is ignored because NVIC_PRIORITYGROUP_4 is used. Currently, the I2C interrupts are set to preemption priority 0. The USART1 preemption priority is also 0. This means that using UART in an interrupt handler will never exit, because HAL_UART_Transmit requires the USART interrupt.
On the other hand, this may be a good idea because using printf() inside an interrupt handler is slow, but interrupt handlers should be really fast.
Currently I can manually do this:
Perhaps we should take a look at all of the interrupt priorities in the code base and decide on a global ordering.
The text was updated successfully, but these errors were encountered: