7 years ago.

Disable Uart Interrupt in STM32F091RCT6

Hi, I am using STM32F091RCT6 in my application. I am using 4uart ports Uart1 - (PA9,PA10) Uart4 - (PA0,PA1) Uart6 - (PA4,PA5) Uart3 - (PC4,PC_5) I have defined receive interrupt for all these four interrupts. But no two uart data will send/receive data at a time. I find problem like when i send command to uart6 then out of 5bytes, only 3bytes are getting sent. when i comment uart4 then all bytes are getting sent to uart6. Can anyone please suggest me some idea to troubleshoot this problem?

I had planned to disable uart4 interrupt but there is no any particular interrupt IRQn defined for uart4. It is defined as USART3_8_IRQn which is global interrupt for usart3-8. How can i disable particularly usart4? It seems problem is related to putc() which hangs entire operation as out of 5bytes only 3bytes are getting transmitted from uart6. I had checked in forum about this issue and found disable_irq(); and enable_irq(); as solution for someone but problem in using this is it will avoid uart6 data reception as soon as i send uart6 transmit command. So i can't use this concept of disabling global interrupt. If anyone can suggest how to disable uart4 interrupt individually.

1 Answer

7 years ago.

Please post your code and apply the <<code>> your code <</code>> tags for best formatting. Assuming you are using mbed for your coding or is it Keil or another compiler ? It should be possible to mask the USART you do not wish to use via a bit mask. Just the same, in theory, a well behaved IRQ service routine should permit the use of all such active USARTs at the same time. What is the data rate for each USART ? Is it possible that hardware flow control (RTS & CTS) are enabled in error ? If yes, then you are required to force these lines to be true else the transmission will block. You could jumper the RTS & CTS pins together to force the flow control lines to be held true. Alternatively, disable the use of hardware flow control. Assuming the issue is not mbed compiler or your code related, it should be possible to make use of multiple USARTs at the same time with proper initialization. Other solutions are to use the Keil compiler (free from ST for the STM32F0) along with the CubeMX tool to allow their code wizard to generate the skeleton code for all such enabled UARTs. That is a very practical approach for USART testing.

Here is an article on how to use the CubeMX solution (free) from ST:

https://www.youtube.com/watch?v=IdKx4oWNJfw