I'm currently attempting to connect the STM32F769I-DISCO to a WiFi network using an ESP8266-01 module. I've enabled UART5 and assigned it to the ESP's RX and TX pins, as specified in the STM32F7 datasheet, and I've supplied power to the CH_PD pin on the ESP8266. However, I'm encountering an issue where I'm not receiving any responses from the ESP8266 in the debugger console.
1. Am I using the correct code to activate and connect the ESP8266 to WiFi?
2. How can I determine if the ESP8266 is sending responses once it's successfully connected?
void ESP8266_Init(void)
{
// Enable ESP8266 module
GPIO_ctrl_ESP8266(GPIO_ON); // Stm32 PH7 pin (output) is connected to ESP8266 enable pin CH_PD
// Wait for ESP8266 to initialize (adjust delay as needed)
HAL_Delay(1000);
}
void ESP8266_Setup(void)
{
// Send AT command to reset ESP8266
char resetCommand[] = "AT+RST\r\n";
HAL_UART_Transmit(&huart5, (uint8_t*)resetCommand, strlen(resetCommand), HAL_MAX_DELAY);
// Wait for ESP8266 to reset (adjust delay as needed)
HAL_Delay(2000);
// Connect to WiFi network (replace "SSID" and "password" with your WiFi credentials)
char connectCommand[50];
sprintf(connectCommand, "AT+CWJAP=\"Dali\",\"123456789\"\r\n");
HAL_UART_Transmit(&huart5, (uint8_t*)connectCommand, strlen(connectCommand), HAL_MAX_DELAY);
// Send AT command to query WiFi connection status
char queryCommand[] = "AT+CWJAP?\r\n";
HAL_UART_Transmit(&huart5, (uint8_t*)queryCommand, strlen(queryCommand), HAL_MAX_DELAY);
// Receive response from ESP8266
char rxData[100];
HAL_UART_Receive(&huart5, (uint8_t*)rxData, sizeof(rxData), HAL_MAX_DELAY);
// Print received response
printf("Received response: %s\n", rxData); // Add this line to print the received response
// Parse response to check WiFi connection status
if (strstr(rxData, "OK") != NULL) {
// WiFi connection successful
printf("WiFi connected successfully!\n");
} else {
// WiFi connection failed
printf("WiFi connection failed!\n");
}
}
// Initialize ESP8266 module
ESP8266_Init();
// Setup ESP8266 (set mode and connect to WiFi network)
ESP8266_Setup();
}
]
Any insights or suggestions would be greatly appreciated.
Thank you,
BR,
Nourhene.