cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 F3 Discovery USART(s) difficulties

eduardo23
Associate
Posted on October 11, 2016 at 10:42

I am not able to receive data with any usart (usart1, usart3) with interrupts.

The RXNE interrupt never gets asserted and therefore the interrupt is never called. I have jumpered the TX/RX terminal in ''loopback'' fashion for testing.

While debugging, I see the TDR and the RDR data however the RXNE is never asserted.

Both TXIE and RXNEIE are asserted in CR1 of the respective USART, however the only one that works is the TXIE.

What am I missing? This is a stupidly simple matter that should work, however it has consistently frustrated me.

Development with Keil MDK 4.72, have attempted both the ''Standard Peripherals Library'' and the new CubeMX HAL with identical results.

Any help/suggestion will be greatly appreciated!

#stm32 #uart #interrupt #usart
3 REPLIES 3
Posted on October 11, 2016 at 10:55

Don't look at the USART's registers in the debugger.

The debugger is intrusive, and reading the RDR by debugger has the same consequence as reading it by the processor, i.e. clearing RXNE.

JW

Nesrine M_O
Lead II
Posted on October 11, 2016 at 12:30

Hi tavares.eduardo,

You can start with these examples, it may be helpful:

•STM32Cube_FW_F3_V1.6.0\Projects\STM32F3-Discovery\Examples\UART ,if you are a Cube user

•STM32F30x_DSP_StdPeriph_Lib_V1.2.3\Projects\STM32F30x_StdPeriph_Examples\USART\USART_HyperTerminalInterrupt, if you are SPL user.

-Syrine-

eduardo23
Associate
Posted on October 11, 2016 at 23:12

Thanks waclawek.jan, I didn't know that having the debugger is intrusive.

I'll keep that in mind in future debug sessions. However after getting the code to work with Syrine's suggestion, having the ''usart1'' debugger open did not disable the RXNE as expected.

Thanks Syrine for both suggestions.

In fact I had used a very similar code example (for the 303_eval board with the necessary changes), but it wasn't working. I replace all the code with the code from the 

STM32F30x_DSP_StdPeriph_Lib_V1.2.3\Projects\STM32F30x_StdPeriph_Examples\USART\USART_HyperTerminalInterrupt.

After making a slight change to enable the receive interrupt before transmission and the code works now.

I will attempt the same thing but with the CubeMX version and go from there.