cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO STM32L073 USART2 RX doesn't work

TKopp.67
Associate II

Hi everyone,

I'm currently trying to implement USART2 in the Nucleo STM32L073, but despite i see frames coming from the other chip, i can't have any interrupt in RX (configured to get byte by byte). I also tried the polling method but it doesn't work better. I may be missing something obvious.

Here is my code :

init code :

0693W00000Nr9fkQAB.pngthe interrupt init (called before to get any byte) :

0693W00000Nr9g9QAB.pngthe interrupt routine (of course usart interrupt activated in IOC file) :

0693W00000Nr9giQAB.png 

UART2 pins are mapped as PA2/PA3 and so if i understood well the RX pin should be the bottom left pin of the CN10 (when you look at the board from over).

Here is the USART2 registers when waiting for the byte :

0693W00000Nr9iFQAR.pngDo i miss something or someone has any idea ?

Thanks in advance for your answer,

Best Regards,

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
Guenael Cadier
ST Employee

Dear @TKopp.67​ 

ISR at 0x6000d0 indicate that RXNE bit is 0, so nothing received from UART point of view yet. RXNE interrupts will be triggered when RXNE will raise to 1.

I think it could be related to HW configuration of your NUCLEO L073, with PA2/PA3 not connected to CN10.

0693W00000Nr9nAQAR.jpg(OFF in bold indicates it is the default setting).

Please have a look at UM1724, available here

Hope this helps.

Regards

View solution in original post

4 REPLIES 4
Guenael Cadier
ST Employee

Dear @TKopp.67​ 

ISR at 0x6000d0 indicate that RXNE bit is 0, so nothing received from UART point of view yet. RXNE interrupts will be triggered when RXNE will raise to 1.

I think it could be related to HW configuration of your NUCLEO L073, with PA2/PA3 not connected to CN10.

0693W00000Nr9nAQAR.jpg(OFF in bold indicates it is the default setting).

Please have a look at UM1724, available here

Hope this helps.

Regards

Mike_ST
ST Employee

Hello,

PA2/PA3 are the ST-Link's UART pins, so you probably want to remove SB14/SB13.

Please check the schematic, you'll see on page 1 that USART_RX is connected to STLK_RX.

Pavel A.
Evangelist III

@TKopp.67​ This line: __HAL_UART_GET_IT_SOURCE(&huart2, UART_IT_RXNE)

is suspicious, because when RxCpltCallback is called, the received byte is already moved so the RX interrupt bit clears.

Generally the UART HAL routines are not good for anything beyond quick tests, especially one byte RX.

Roll your own, or use DMA.

TKopp.67
Associate II

Thanks that was indeed my problem, now i just in the callback but get's overrun error. Anyway i will try to understand why it happens now.

Have a nice day,

Best Regards,

Thomas