cancel
Showing results for 
Search instead for 
Did you mean: 

USART 3 Receive Interrupt not working

fabio frasi
Associate II
Posted on August 04, 2017 at 15:48

i have build with stm32cubemx usart 3 pc10 pc11 pin of stm32f446 115200,n,8,1 full duplex use with interrupt and receive interrupt not working all working fine if use alternate function uart4 on the same pin i think that there are many special setting

in the case of usart3 have you any idea ?

5 REPLIES 5
Posted on August 04, 2017 at 18:30

Hello fabio!!

1. In USART3 configuration you used

__HAL_UART_ENABLE_IT(&huart3,UART_IT_TC);

__HAL_UART_ENABLE_IT(&huart3,UART_IT_RXNE);

There is no need to use this. All interrupts enabled automaticaly.

2 in both configurations  you don't wait for completion of rx function. .  and you transmit a byte just after you try to receive a byte.

fabio frasi
Associate II
Posted on August 04, 2017 at 19:33

can you send me init of usart structure for async rs232 115200,n,8,1 the struct is different from uart and not an have an example

Posted on August 05, 2017 at 13:31

Your initialization code looks fine.. except ..

Delete inside the file stm32f4xx_it.c and inside the USART3_IRQHandler(void)      the    

HAL_UART_Receive_IT(&huart3,rx_s,1);

 

remove the

__HAL_UART_ENABLE_IT(&huart3,UART_IT_TC);

__HAL_UART_ENABLE_IT(&huart3,UART_IT_RXNE);

 from main.c file

fabio frasi
Associate II
Posted on August 07, 2017 at 22:55

Dear Vangelis Fortunas thank's for your reply

yes is true the 2 line of code

__HAL_UART_ENABLE_IT(&huart3,UART_IT_TC);

__HAL_UART_ENABLE_IT(&huart3,UART_IT_RXNE);

are not necessary

the presence in the interrupt routine of

HAL_UART_Receive_IT(&huart3,rx_s,1);

 

is necessary because if remove the line only first receive caracter is stored and rx interrupt then stop.

i have write a simple echo teminal that woking fine at 460kbit 1kbyte data echo

BUT

there is a BUG or a strange behavior in the library or in the core wen you map in the ST32f446VE pin PC10 and PC11 the uart4 all working fine wen you map usart3 in the same pin the rx interrupt not working.Remember that i use of usart2 with the same setting on the pin pa2 and pa3 and all working fine.

Posted on August 08, 2017 at 00:12

Hello again!

>'the presence in the interrupt routine of

HAL_UART_Receive_IT(&huart3,rx_s,1);

 

is necessary because if remove the line only first receive caracter is stored and rx interrupt then stop.'

First of all, inside your main() function, you called HAL_UART_Receive_IT(&huart3,rx_s,1); this means that you requested from port  only one byte.!!

If you want to request another byte you must do it 

not inside IRQ handler

but in your loop or  somewhere else .

The most posible is to have a HAL Lock stituation!