Re: Single pin Hardware serial
Posted: Tue Aug 23, 2022 5:12 am
Probably a HAL or LL functions exist for that. You can try to generate the code with CubeMX.
Everything relating to using STM32 boards with the Arduino IDE and alternatives
https://www.stm32duino.com/
Code: Select all
__HAL_RCC_USART2_CLK_ENABLE();
Code: Select all
Serial2.begin(9600);
USART2->CR1 &= ~(1 << 0); // UE = 0... disable USART
USART2->CR2 |= (1 << 15); //Set RX TX Swap
USART2->CR1 |= (1 << 0); // UE = 1... Enable USART