AnsweredAssumed Answered

How can I generate an arbitrary interrupt from software?

Question asked by arnold_w on Feb 1, 2016
Latest reply on Feb 2, 2016 by FTITI.Walid
I want to generate an interrupt from software in order to execute things in a different "thread" than the main()-thread. In other Microcontroller-brands I've been previously working with this has been very easy to achieve, I would simply enable the interrupt and set the interrupt flag. When I try to do that with my STM32F04-microcontroller, nothing happens:

    RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
    TIM3->DIER |= TIM_DIER_UIE;             // Update interrupt enable
    HAL_NVIC_EnableIRQ(TIM3_IRQn);          // Enable interrupts
    TIM3->SR |= TIM_SR_UIF;                 // Set interrupt flag
 
 
void TIM3_IRQHandler(void)
{
    UART1_TransmitNullTerminatedString("\r\nTIM3_IRQHandler");   // This is never executed. Why?
}

What is the proper way to issue arbitrary interrups (TIM3_IRQHandler, CAN1_RX0_IRQHandler, DMA2_Stream6_IRQHandler or whatever) from software?

Outcomes