UART doesn't receive data from HC-06
Hello !
My STM board is STM32-L073RZ.
I've had a lot of problem with HC-06, tried to somehow send the command "AT" or "AT\r\n", but I didn't get anything back. The bluetooth wasn't connected to any device because the diode was blinking.
- I tried changing the Baund Rate from 9600 to higher it didn't work.
- I've tried to add Pull up on TX,RX (I've read maybe it doesn't have internal so I've added but it didn't work) :

- I've even took off the voltage divider and it didn't work, It was added from the start like in this example :

Here is the code :
char response[100] = "";
while (1)
{
// Send AT command to HC-06
char atCommand[] = "AT\r\n";
HAL_UART_Transmit(&huart2, (uint8_t *)atCommand, sizeof(atCommand)-1, 500);
// Add a delay to allow time for the HC-06 to process the command
HAL_Delay(1000);
// Handle the response from HC-06 (you may need to implement a function to receive and process data)
// For simplicity, you can use a blocking receive function like HAL_UART_Receive.
// Example of receiving response
HAL_UART_Receive(&huart2, (uint8_t *)response, sizeof(response)-1, 500);
response[sizeof(response)-1] = '\0'; // Null-terminate the string
printf("%s --\n", response);
// Process or print the received response as needed
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
I also thought that Arduino didn't add pull up for the HC-06 but maybe they have always turned on ? So I have to add pull up for STM32, I did but it still didn't work. I was expecting and "OK" response instead I had "--" and the response array was empty.
I don't know where is the error.
