2022-06-03 01:05 AM
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 :
the interrupt init (called before to get any byte) :
the interrupt routine (of course usart interrupt activated in IOC file) :
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 :
Do i miss something or someone has any idea ?
Thanks in advance for your answer,
Best Regards,
Thomas
Solved! Go to Solution.
2022-06-03 01:34 AM
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.
(OFF in bold indicates it is the default setting).
Please have a look at UM1724, available here
Hope this helps.
Regards
2022-06-03 01:34 AM
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.
(OFF in bold indicates it is the default setting).
Please have a look at UM1724, available here
Hope this helps.
Regards
2022-06-03 01:38 AM
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.
2022-06-03 02:45 AM
@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.
2022-06-03 02:47 AM
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