2019-05-26 05:37 AM
I am using the STM32L412C8 and I am having trouble with the USART2 RX/TX pin swapping. I enabled it in CubeMX but if I send data to the PA2 pin (originally TX but should be RX after the swap) I get nothing. If however I send my data to PA3(should be TX after the swap) data instantly comes in. Checking the CR2 register of the USART, the SWAP bit is set.
What am I doing wrong?
2019-05-26 07:45 AM
Did you configure PA2 as peripheral?
2019-05-26 08:28 AM
Both pins should be alternate function configured. Otherwise, check the errata sheet.
2019-05-26 08:49 AM
Yes, and I tried both push-pull and open drain.
2019-05-26 08:49 AM
Both have been configured for USART2. The errata sheet has nothing relevant.
2019-05-26 10:11 AM
I've got STM32L4R5 connected to HC-06 BT module with wires, will give it a try tomorrow to check it at my desk.
2019-05-27 01:53 AM
Well it works on stm32l4r5. However, UE can t apparently be reset manually in debug mode.
2019-05-27 09:29 AM
OP's problem may also be the way how Rx is handled, regardless of the swap...
JW
2019-05-27 10:27 AM
Would you mind sharing your code or the ioc file from CubeMX?
2019-05-27 10:29 AM
What do you mean? I have used both HAL and LL functions to receive data and the result was the same.