2021-11-07 03:33 AM
// I use this code. And stm32h750 B/D w/ Esp8266.
UART_HandleTypeDef UART2_WIFI;
uint8_t RX_Data[128];
uint8_t RXD;
uint8_t data[11]="AT+CWLAP\r\n";
if(IndexCount >= 200)
{
IndexCount = 0;
if(StartFlag == 0)
{
HAL_GPIO_WritePin(GPIOH,GPIO_PIN_10,GPIO_PIN_SET);
StartFlag = 1;
}
Test_Uart = HAL_UART_Transmit(&UART2_WIFI,data,4,100);
}
else
{
IndexCount ++;
}
void MX_USART2_UART_Init( void )
{
UART2_WIFI.Instance = USART2;
UART2_WIFI.Init.BaudRate = 115200;
UART2_WIFI.Init.WordLength = UART_WORDLENGTH_8B;
UART2_WIFI.Init.StopBits = UART_STOPBITS_1;
UART2_WIFI.Init.Parity = UART_PARITY_NONE;
UART2_WIFI.Init.Mode = UART_MODE_TX_RX;
UART2_WIFI.Init.HwFlowCtl = UART_HWCONTROL_NONE;
HAL_UART_Init(&UART2_WIFI);
__HAL_UART_ENABLE_IT(&UART2_WIFI,UART_IT_RXNE);
HAL_UART_Receive_IT(&UART2_WIFI,&RXD,1);
}