1
\$\begingroup\$

After putting data into STM32 USART register DR, data is being transfered and interrupt occurs(TXE,TXC). NVIC jumps into my IrqHandler code. How to set this same interrupt by software(and run IrqHandler), without inserting data into DR.

I have software CTS/RTS handling in my IrqHandler. I would like to have all tranmission management inside interrupt routine. Send function will be only used to prepare SendBuffer and byteIndex for transmission.

\$\endgroup\$
2
  • \$\begingroup\$ Just call IrqHandler... \$\endgroup\$
    – Eugene Sh.
    Commented Jan 31, 2017 at 17:15
  • \$\begingroup\$ In my opinion calling IrqHandler() could be interrupted by UART hardware calling IrqHandler(). This could lead to unpredictable behaviour. This really could occur in my project because of using RTOS. Context of calling IrqHandler is important for me. I have to think about this, because of other programmers who will use my driver. \$\endgroup\$
    – s.paszko
    Commented Jan 31, 2017 at 18:36

1 Answer 1

3
\$\begingroup\$

You can try using NVIC_SetPendingIRQ() or the software trigger register STIR as in

NVIC->STIR = USART0_IRQn;

Both methods will trigger the vector handler function via NVIC.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.