The STM32 connects its UART to pin GPIO6 and GPIO7 as it is explained in the AT-Project user Guide page 14
I don't conect the CTS and RTS.
I installed the ESP32-C3-Mini-1 on the PCB and connected the same line, it doesn't work.
The ESP doesn't even echo the AT commands or answer the AT+GMR as it oes with the DevKit.
The following is the code that I initialize the UAR on the STM32 side.
Code: Select all
static void AT_UARTs_Init(uint32_t baud_rate)
{
__HAL_RCC_USART4_CLK_ENABLE();
__HAL_RCC_USART5_CLK_ENABLE();
// Configure the UART parameters
huart4.Instance = USART4;
huart4.Init.BaudRate = baud_rate;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart4) != HAL_OK)
{
my_error_handler(6);
}
huart5.Instance = USART5;
huart5.Init.BaudRate = baud_rate;
huart5.Init.WordLength = UART_WORDLENGTH_8B;
huart5.Init.StopBits = UART_STOPBITS_1;
huart5.Init.Parity = UART_PARITY_NONE;
huart5.Init.Mode = UART_MODE_RX;
huart5.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart5.Init.OverSampling = UART_OVERSAMPLING_16;
huart5.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart5.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart5) != HAL_OK)
{
my_error_handler(7);
}
HAL_UART_Receive_IT(&huart5, &at_in_buff[0][0], 1);
HAL_NVIC_SetPriority(USART4_5_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART4_5_IRQn);
}