# How to set by software interrupt of USART in NVIC? - in fact emulate it

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.

• Just call IrqHandler... – Eugene Sh. Jan 31 '17 at 17:15
• 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. – s.paszko Jan 31 '17 at 18:36

You can try using NVIC_SetPendingIRQ() or the software trigger register STIR as in
NVIC->STIR = USART0_IRQn;