Note 15 WiFi.md 2.7 KB


tags: [entity] type: entity topic: stm32-lower note: 15 created: 2026-07-16

updated: 2026-07-16

Note 15: WiFi (lower/stm32/10~11)

Projects

# Directory Description
10 10_wifi_test_hal WiFi AT command test
11 11_wifi_tcp_server_hal WiFi TCP Server

Code Accuracy Audit

Path Audit

Claimed Path Actual Path Status
stm32/10_wifi_test_hal/Core/Src/main.c 10_wifi_test_hal/Core/Src/main.c ✅ Correct
stm32/10_wifi_test_hal/Interface/ESP32/esp32.c 10_wifi_test_hal/Interface/ESP32/esp32.c ✅ Correct
stm32/11_wifi_tcp_server_hal/Core/Src/main.c 11_wifi_tcp_server_hal/Core/Src/main.c ✅ Correct
stm32/11_wifi_tcp_server_hal/App/WIFI/wifi.c 11_wifi_tcp_server_hal/App/WIFI/wifi.c ✅ Correct

ESP32 Driver (10_wifi_test_hal/Interface/ESP32/esp32.c)

Claimed by Note Actual Code Match?
MX_USART2_UART_Init() Line 18 ✅ Match
uint8_t *cmd = "AT+RST=0\r\n" Line 21 ✅ Match
ESP32_SendCmd(cmd, strlen((char *)cmd)) Line 22 ✅ Match
HAL_Delay(2000) Line 25 ✅ Match
memset(respBuff, 0, 1024) Line 32 ✅ Match
HAL_UART_Transmit(&huart2, cmd, cmdLen, 1000) Line 35 ✅ Match
do { ESP32_ReadResp(...) } while (strstr(..., "OK") == NULL) Lines 38-41 ✅ Match
printf("%.*s\n", respLen, respBuff) Line 44 ✅ Match
HAL_UARTEx_ReceiveToIdle(&huart2, buff, 1024, len, 1000) Line 51 ✅ Match
Global: uint8_t respBuff[1024]; uint16_t respLen; Lines 11-12 ✅ Match

WiFi main.c (10_wifi_test_hal)

Note says main.c includes TCP server logic. Actual main.c (10_wifi_test_hal) only sends basic AT commands:

ESP32_Init();
ESP32_SendCmd("AT\r\n", ...);
ESP32_SendCmd("AT+GMR\r\n", ...);

The TCP server logic lives in project 11 (11_wifi_tcp_server_hal), not project 10.

Discrepancy: The note may have merged project 10 and 11 behavior. Project 10 is just a basic AT command test.

WiFi TCP Server (11_wifi_tcp_server_hal/App/WIFI/wifi.c)

Note claims:

  • WIFI_Init(AP) → sets AP mode with AT+CWMODE=2, AT+CWSAP, AT+CIPAP
  • WIFI_TCP_ServerStart() → AT+CIPMUX=1, AT+CIPSERVER=1,8080, AT+CIPDINFO=1
  • WIFI_TCP_SendData → sprintf AT+CIPSEND, then HAL_UART_Transmit
  • WIFI_TCP_ReadData → sscanf to parse +IPD format

All match actual code. The +IPD parsing via sscanf is correctly captured.

Summary

Overall Accuracy: High

Issues Found:

  1. Note may be ambiguous about whether project 10 or 11 contains the TCP server code — project 10 (main.c) only does basic AT testing; TCP server logic is in project 11
  2. All ESP32 driver code in esp32.c matches perfectly