<\/path> \n<\/svg> <\/p>\n1.STM32\u9a71\u52a8ESP8266\u6a21\u5757<\/h3>\n
\u7b14\u8005\u6240\u4f7f\u7528\u7684ESP8266\u6a21\u5757\u4e3a\u6b63\u70b9\u539f\u5b50\u5f00\u53d1\u7684\u6a21\u5757\uff0c\u8be5\u6a21\u5757\u5c06\u901a\u4fe1\u63a5\u53e3\u53d8\u6210\u4e86\u4e32\u53e3\u3002\u63a5\u4e0b\u6765\u5173\u4e8eESP8266\u6a21\u5757\u7684\u4ecb\u7ecd\u5747\u4ee5\u6b64\u6a21\u5757\u4e3a\u57fa\u7840\u3002<\/p>\n
1.1 CubeMX\u914d\u7f6eSTM32F103C8T6\u82af\u7247\u5f15\u811a<\/h4>\n1.1.1 \u9009\u62e9\u82af\u7247\u578b\u53f7<\/h5>\n
\u6211\u4eec\u9700\u8981\u7ed9\u82af\u7247\u914d\u7f6e\u5f15\u811a\uff0c\u4f7f\u5b83\u80fd\u591f\u5b8c\u6210\u6211\u4eec\u6240\u9700\u8981\u7684\u529f\u80fd\u3002<\/p>\n
1.\u53cc\u51fb\u6253\u5f00CubeMX\u8f6f\u4ef6\uff0c\u5f39\u51fa\u754c\u9762\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n
<\/p>\n
2.\u70b9\u51fb\u4e0a\u56fe\u4e2d\u7684\u201cACCESS TO MCU SELECTOR\u201d\u6309\u94ae\uff0c\u8fdb\u5165\u5982\u4e0b\u754c\u9762\uff1a<\/p>\n
<\/p>\n
3.\u5728\u201cPart Number\u201d\u4e2d\u8f93\u5165\u201cSTM32F103C8\u201d\u5b57\u7b26\uff0c\u7136\u540e\u53cc\u51fb\u201cReference\u201d\u4e2d\u7684\u201cSTM32F103C8Tx\u201d\uff0c\u8fdb\u5165\u5982\u4e0b\u754c\u9762\uff1a<\/p>\n
<\/p>\n
\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u9009\u62e9\u597d\u4e86\u82af\u7247\u7c7b\u578b\u3002\u5728\u4e0a\u56fe\u6240\u793a\u7684\u754c\u9762\u4e2d\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u914d\u7f6e\u82af\u7247\u5f15\u811a\uff0c\u4ee5\u6ee1\u8db3\u6211\u4eec\u7684\u5f00\u53d1\u9700\u8981\u3002<\/p>\n
1.1.2 \u914d\u7f6e\u4e32\u53e3\u5f15\u811a\u548c\u65f6\u949f\u9891\u7387<\/h5>\n
1.\u70b9\u51fb\u201cSystem Core\u201d\uff0c\u518d\u70b9\u51fb\u201cRCC\u201d\uff0c\u5c06\u65f6\u949f\u6e90\u8bbe\u7f6e\u4e3a\u5916\u90e8\u65f6\u949f\u6e90\uff1a<\/p>\n
<\/p>\n
2.\u70b9\u51fb\u201cSYS\u201d\uff0c\u5c06\u201cDebug\u201d\u8bbe\u7f6e\u4e3a\u201cSerial Wire\u201d\uff0c\u201cTimebase Source\u201d\u8bbe\u7f6e\u4e3a\u201cSysTick\u201d\uff1a<\/p>\n
<\/p>\n
3.\u70b9\u51fb\u201cConnectivity\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201cUSART3\u201d\uff0c\u5c06\u901a\u4fe1\u65b9\u5f0f\u8bbe\u7f6e\u4e3a\u201cAsynchronous\u201d\uff08\u5f02\u6b65\u901a\u4fe1\uff09\uff1a<\/p>\n
<\/p>\n
4.\u5728\u201cUART3\u201d\u754c\u9762\uff0c\u70b9\u51fb\u201cDMA Settings\u201d\uff0c\u5c06\u4e32\u53e33\u7684\u901a\u4fe1\u5f15\u811a\u6a21\u5f0f\u8bbe\u7f6e\u4e3aDMA\uff08\u76f4\u63a5\u5bc4\u5b58\u5668\u8bbf\u95ee\uff09\u6a21\u5f0f\u3002\u8fd9\u662f\u56e0\u4e3a\u5728\u7b14\u8005\u7684\u5de5\u7a0b\u4e2d\uff0cWiFi\u9700\u8981\u4e0d\u65ad\u5730\u63a5\u6536\u9640\u87ba\u4eea\u53d1\u9001\u8fc7\u6765\u7684\u6570\u636e\u5e76\u4e0d\u65ad\u5730\u5c06\u5176\u53d1\u9001\u51fa\u53bb\uff0c\u6240\u4ee5\u91c7\u7528DMA\u6a21\u5f0f\uff0c\u51cf\u8f7bCPU\u7684\u8d1f\u62c5\uff1a<\/p>\n
<\/p>\n
\u8bfb\u8005\u5728\u65b0\u5efa\u5de5\u7a0b\u65f6\uff0c\u9700\u8981\u70b9\u51fb\u201cAdd\u201d\u6dfb\u52a0DMA\u901a\u9053\u3002\u6dfb\u52a0\u597d\u540e\uff0c\u5c06\u201cMode\u201d\u8bbe\u7f6e\u4e3a\u201cNormal\u201d\uff0c\u201cData Width\u201d\u8bbe\u7f6e\u4e3a\u201cByte\u201d\uff0c\u5982\u4e0a\u56fe\u6240\u793a\u3002<\/p>\n
6.\u70b9\u51fb\u201cClock Configuration\u201d\uff0c\u5c06\u201cHCLK\uff08MHz\uff09\u201d\u8bbe\u7f6e\u4e3a72\uff1a<\/p>\n
<\/p>\n
1.1.3 \u751f\u6210keil\u5de5\u7a0b\u6587\u4ef6<\/h5>\n
1.\u6240\u6709\u7684\u90e8\u5206\u90fd\u914d\u7f6e\u597d\u540e\uff0c\u70b9\u51fb\u201cProject Manager\u201d\uff0c\u5728\u201cToolchain\/IDE\u201d\u4e2d\u9009\u62e9\u7f16\u8f91\u5668\u4e3a\u201cMDK-ARM\u201d\uff0c\u7136\u540e\u5728\u201cMin Version\u201d\u4e2d\u9009\u62e9\u201cV5\u201d\uff08\u6b64\u5904\u7b14\u8005\u7535\u8111\u5b89\u88c5\u7684\u662fV5\u7248\u672c\uff0c\u8bfb\u8005\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u5b89\u88c5\u7684Keil\u7248\u672c\u9009\u62e9\u5bf9\u5e94\u7248\u672c\uff09\uff1a<\/p>\n
<\/p>\n
2.\u5728\u201cProject Manager\u201d\u754c\u9762\uff0c\u70b9\u51fb\u201cCode Generator\u201d\uff0c\u5728\u201cGenerated files\u201d\u4e2d\u5c06\u7b2c\u4e00\u9879\u4e5f\u52fe\u9009\u4e0a\uff1a<\/p>\n
<\/p>\n
3.\u70b9\u51fb\u754c\u9762\u53f3\u4e0a\u89d2\u7684\u201cGENERATE CODE\u201d\uff1a<\/p>\n
<\/p>\n
<\/p>\n
\u51fa\u73b0\u4e0a\u8ff0\u754c\u9762\uff0c\u5c31\u8bf4\u660e\u4ee3\u7801\u5df2\u7ecf\u751f\u6210\u597d\u4e86\u3002<\/p>\n
4.\u9009\u62e9\u4e0a\u56fe\u4e2d\u7684\u201cOpen Project\u201d\uff0c\u4ee3\u7801\u754c\u9762\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n
<\/p>\n
\u81f3\u6b64\uff0c\u6211\u4eec\u5c31\u914d\u7f6e\u597d\u4e86\u82af\u7247\u7684\u5f15\u811a\u5e76\u751f\u6210\u4e86\u4ee3\u7801\u3002<\/p>\n
1.2 \u63a5\u7ebf<\/h4>\n
\u6b63\u70b9\u539f\u5b50ESP8266\u6a21\u5757\u4fdd\u7559\u4e86\u516d\u4e2a\u9488\u811a\uff0c\u5206\u522b\u662fVCC\u3001GND\u3001RXD\u3001TXD\u3001RST\u548cIO0\u3002\u5e73\u5e38\u4f7f\u7528\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u4ec5\u4ec5\u9700\u8981\u4f7f\u7528\u524d\u56db\u4e2a\u5f15\u811a\u5373\u53ef\u3002\u5728\u4e0a\u9762\u7684\u914d\u7f6e\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u9009\u62e9\u4f7f\u7528\u4e32\u53e33\u4e0eESP8266\u6a21\u5757\u8fdb\u884c\u901a\u4fe1\uff0c\u56e0\u6b64\u9700\u8981\u770b\u82af\u7247\u7684\u5f15\u811a\u5b9a\u4e49\uff0c\u770b\u54ea\u4e24\u4e2a\u5f15\u811a\u662f\u4e32\u53e33\u7684\u5f15\u811a\uff1a<\/p>\n
<\/p>\n
\u53ef\u4ee5\u770b\u5230\uff0cPB10\u4e3aTX\uff08\u53d1\u9001\uff09\uff0cPB11\u4e3aRX\uff08\u63a5\u6536\uff09\u3002\u5219PB10\u63a5\u6a21\u5757\u7684RX\u811a\uff0cPB11\u63a5\u6a21\u5757\u7684TX\u811a\u3002\u63a5\u7ebf\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n
<\/p>\n
\u82af\u7247\u677f\u53ef\u4ee5\u901a\u8fc7micro-USB\u7ebf\u4f9b\u7535\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5916\u63a5\u7535\u6e90\u7a33\u538b\u6a21\u5757\u4f9b\u7535\u3002\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u7a33\u538b\u6a21\u5757\u65f6\uff0c\u6700\u597d\u4f7f\u75285V\u7535\u538b\u7ed9\u82af\u7247\u4f9b\u7535\uff0c\u5426\u5219\u70e7\u5f55\u5668\u65e0\u6cd5\u8bc6\u522b\u5230\u82af\u7247\u677f\u7684\u5b58\u5728\u3002ESP8266\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7a33\u538b\u6a21\u5757\u5411\u5176\u4f9b\u7535\uff0c5V\u548c3.3V\u5747\u53ef\u3002<\/p>\n
1.3 \u9a71\u52a8\u903b\u8f91\u548c\u4ee3\u7801<\/h4>\n
\u8981\u5b9e\u73b0\u4e00\u4e2a\u5b8c\u6574\u7684\u5de5\u7a0b\uff0c\u6211\u4eec\u9700\u8981\u8bbe\u8ba1\u597d\u6a21\u5757\u7684\u4f7f\u7528\u903b\u8f91\u5e76\u4f7f\u7528\u4ee3\u7801\u5c06\u5176\u5b9e\u73b0\u3002<\/p>\n
1.3.1 AT\u6307\u4ee4\u4e0e\u6a21\u5757\u914d\u7f6e\u8fc7\u7a0b\u4ecb\u7ecd<\/h5>\n
\u9996\u5148\u6211\u4eec\u8981\u914d\u7f6e\u6a21\u5757\u7684\u5404\u9879\u53c2\u6570\u3002\u53c2\u8003\u6b63\u70b9\u539f\u5b50\u7684\u6a21\u5757\u4f7f\u7528\u8d44\u6599\uff0c\u7ed3\u5408\u672c\u8eab\u9879\u76ee\u9700\u6c42\uff0c\u7b14\u8005\u9009\u62e9\u5c06\u6a21\u5757\u8bbe\u7f6e\u4e3aAP\u6a21\u5f0f\uff0c\u4f7f\u7528AP\u6a21\u5f0f\u4e0b\u7684\u900f\u4f20\u529f\u80fd\u5b9e\u73b0\u5927\u91cf\u6570\u636e\u7684\u900f\u660e\u4f20\u8f93\u3002\u914d\u7f6e\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n
<\/p>\n
\u6211\u4eec\u9700\u8981\u6309\u4e0a\u8ff0\u6d41\u7a0b\u5b8c\u6210\u6a21\u5757\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u90a3\u4e48\uff0c\u6211\u4eec\u9700\u8981\u5b8c\u6210\u5982\u4e0b\u51e0\u4ef6\u4e8b\u8bf7\uff1a<\/p>\n
\n- \u5411\u6a21\u5757\u53d1\u9001\u7b2c\u4e00\u4e2aAT\u6307\u4ee4\uff1b<\/li>\n
- \u7b49\u5f85\u6a21\u5757\u7684\u8fd4\u56de\u5185\u5bb9\u5e76\u5224\u65ad\u662f\u5426\u914d\u7f6e\u6210\u529f\uff1b<\/li>\n
- \u5982\u679c\u6210\u529f\uff0c\u53d1\u9001\u4e0b\u4e00\u4e2aAT\u6307\u4ee4\uff1b\u5982\u679c\u4e0d\u6210\u529f\uff0c\u5219\u518d\u53d1\u9001\u4e00\u6b21\u5f53\u524dAT\u6307\u4ee4\uff1b<\/li>\n
- \u76f4\u81f3\u6700\u540e\u5f00\u59cb\u53d1\u9001\u6570\u636e\u7684AT\u6307\u4ee4\u53d1\u9001\u5e76\u914d\u7f6e\u6210\u529f<\/li>\n<\/ul>\n
\u53d1\u9001\u6307\u4ee4\u6bd4\u8f83\u7b80\u5355\uff0c\u4f7f\u7528HAL\u5e93\u7684\u4e32\u53e3\u53d1\u9001\u51fd\u6570\u5373\u53ef\uff1a<\/p>\n
HAL_UART_Transmit<\/span>(<\/span>&<\/span>huart3,<\/span> (<\/span>uint8_t<\/span> *<\/span>)<\/span>AT_RESTORE,<\/span> sizeof<\/span>(<\/span>AT_RESTORE)<\/span>,<\/span> 0xFFFF<\/span>)<\/span>\n<\/code><\/pre>\n\u5176\u4e2d\uff0cAT_RESTORE\u8868\u793aAT\u6307\u4ee4\u4e2d\u7684\u201c\u91cd\u542f\u201d\u6307\u4ee4\u3002\u8be5\u6307\u4ee4\u53d1\u9001\u5b8c\u6210\u540e\uff0c\u5411\u4e32\u53e3\u53d1\u9001\u68c0\u67e5\u6307\u4ee4\u201cAT\\r\\n\u201d\u3002\u7ecf\u7b14\u8005\u6d4b\u8bd5\uff0c\u6a21\u5757\u4f1a\u5bf9\u68c0\u67e5\u6307\u4ee4\u8fd4\u56de\u5b57\u7b26\u4e32<\/strong>\u201cAT\\r\\n\\r\\nOK\\r\\n\u201d\uff08\u5728CubeMX\u5de5\u7a0b\u4e2d\uff0c\u201cchar\u201d\u7c7b\u578b\u88ab\u5b9a\u4e49\u4e3a\u201cuint8_t\u201d\u7c7b\u578b\uff09\u3002\u540c\u6837\uff0c\u5176\u4ed6\u6307\u4ee4\u8fd4\u56de\u5185\u5bb9\u7684\u6570\u636e\u7c7b\u578b\u4e5f\u4e3a\u5b57\u7b26\u4e32\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u9700\u8981\u8bfb\u53d6\u5230\u4e32\u53e33\u7684\u8fd4\u56de\u503c\u5e76\u8bc6\u522b\u662f\u5426\u662f\u91cd\u542f\u6210\u529f\u7684\u8fd4\u56de\u503c\u3002\u58f0\u660euint8_t\u7c7b\u578b\uff1a<\/p>\nuint8_t<\/span> AT[<\/span>]<\/span> =<\/span> \"AT\\r\\n\"<\/span>;<\/span>\/\/\u68c0\u67e5\u6307\u4ee4<\/span>\nuint8_t<\/span> ATRE[<\/span>]<\/span> =<\/span> \"AT\\r\\n\\r\\nOK\\r\\n\"<\/span>;<\/span>\/\/\u68c0\u67e5\u6307\u4ee4\u7684\u6b63\u786e\u8fd4\u56de\u503c<\/span>\n<\/code><\/pre>\n\u5176\u4e2d\u201cAT\u201d\u548c\u201cATRE\u201d\u5747\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\uff0cAT\u662fMCU\u5411\u4e32\u53e33\uff08\u4e5f\u5c31\u662f\u6a21\u5757\uff09\u53d1\u9001\u7684\u68c0\u67e5\u6307\u4ee4\uff0c\u800cATRE\u4e3a\u8be5\u6307\u4ee4\u7684\u6b63\u786e\u8fd4\u56de\u503c\u3002\u5982\u679c\u8fd4\u56de\u503c\u4e0d\u662fATRE\u7684\u5185\u5bb9\uff0c\u5219\u9700\u8981\u91cd\u65b0\u53d1\u9001AT\u6307\u4ee4\u3002<\/p>\n
\u68c0\u67e5\u8fd4\u56de\u503c\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n
int<\/span> checkResponse<\/span>(<\/span>uint8_t<\/span>*<\/span> response)<\/span>{ \n <\/span>\n\tfor<\/span>(<\/span>int<\/span> i =<\/span> 0<\/span>;<\/span>i <<\/span> ATResRecCount;<\/span>i ++<\/span>)<\/span>{ \n <\/span>\n\t\tif<\/span>(<\/span>ATCmdRxBuffer[<\/span>i]<\/span> !=<\/span> response[<\/span>i]<\/span>)<\/span>{ \n <\/span>\n\t\t\treturn<\/span> 0<\/span>;<\/span>\n\t\t}<\/span>\n\t}<\/span>\n\treturn<\/span> 1<\/span>;<\/span>\n}<\/span>\n<\/code><\/pre>\n\u5728\u4e0a\u9762\u7684\u51fd\u6570\u4e2d\uff0c\u8f93\u5165\u53c2\u6570\u662f\u6b63\u786e\u7684\u8fd4\u56de\u503c\u3002ATCmdRxBuffer\u4e2d\u662f\u4e32\u53e3\u63a5\u6536\u5230\u7684\u5b9e\u9645\u7684\u8fd4\u56de\u503c\u3002\u5728\u8fd9\u4e2a\u51fd\u6570\u4e2d\uff0c\u6309\u7167\u987a\u5e8f\u4f9d\u6b21\u5c06\u5b9e\u9645\u7684\u8fd4\u56de\u503c\u548c\u6b63\u786e\u7684\u8fd4\u56de\u503c\u6bd4\u8f83\uff0c\u5982\u679c\u5b9e\u9645\u8fd4\u56de\u503c\u4e0e\u6b63\u786e\u8fd4\u56de\u503c\u4e0d\u4e00\u81f4\uff0c\u5219\u51fd\u6570\u8fd4\u56de\u6574\u578b0\uff0c\u5426\u5219\u8fd4\u56de1\u3002\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u8fd4\u56de\u503c\u6765\u5224\u65ad\u6a21\u5757\u662f\u5426\u8fd4\u56de\u4e86\u6b63\u786e\u7684\u8fd4\u56de\u503c\uff0c\u8fdb\u800c\u51b3\u5b9a\u662f\u5426\u8fdb\u884c\u4e0b\u4e00\u6b65\u3002<\/p>\n
1.3.2 DMA\u7a7a\u95f2\u4e2d\u65ad\u63a5\u6536\u4e0d\u5b9a\u957f\u6570\u636e\u4e0e\u6a21\u5757\u9a71\u52a8\u4ee3\u7801<\/h5>\n
\u6839\u636e\u6b63\u70b9\u539f\u5b50\u7684\u6a21\u5757\u8d44\u6599\uff1a\u300aATK-ESP8266 WIFI\u7528\u6237\u624b\u518c_V1.5\u300b\uff08\u4e0b\u8f7d\u94fe\u63a5\uff1aWIFI\u6a21\u5757ATK-ESP8266(ESP 01) \u2014 \u6b63\u70b9\u539f\u5b50\u8d44\u6599\u4e0b\u8f7d\u4e2d\u5fc3 1.0.0 \u6587\u6863 (openedv.com)\uff09\uff0c\u4e0d\u540c\u7684AT\u6307\u4ee4\u7684\u8fd4\u56de\u503c\u957f\u5ea6\u662f\u4e0d\u540c\u7684\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u5728\u4e32\u53e3\u5411\u6a21\u5757\u53d1\u9001\u6307\u4ee4\u540e\uff0c\u4e32\u53e3\u9700\u8981\u63a5\u6536\u4e0d\u5b9a\u957f\u7684\u6570\u636e\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528DMA\u7a7a\u95f2\u4e2d\u65ad\u6765\u63a5\u6536\u4e0d\u5b9a\u957f\u6570\u636e\uff0c\u5e76\u5224\u65ad\u8fd4\u56de\u503c\u662f\u5426\u662f\u914d\u7f6e\u6210\u529f\u7684\u8fd4\u56de\u503c\u3002<\/p>\n
1.\u6211\u4eec\u5df2\u7ecf\u5728CubeMX\u4e2d\u914d\u7f6e\u4e86\u4e32\u53e33\u7684DMA\u4f20\u8f93\uff0c\u8fd9\u91cc\u4e0d\u518d\u8d58\u8ff0\u3002\u751f\u6210\u4ee3\u7801\u540e\uff0c\u754c\u9762\u5982\u4e0b\uff1a<\/p>\n
<\/p>\n
\u70b9\u51fb\u5de6\u4e0a\u89d2\u7ea2\u8272\u65b9\u6846\u6846\u67f1\u7684\u56fe\u6807\uff0c\u5bf9\u8f6f\u4ef6\u751f\u6210\u7684\u5de5\u7a0b\u4ee3\u7801\u8fdb\u884c\u7f16\u8bd1\uff0c\u68c0\u67e5\u662f\u5426\u5b58\u5728\u95ee\u9898\u3002\u7f16\u8bd1\u5b8c\u6210\u540e\uff0c\u63a7\u5236\u53f0\u663e\u793a\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n
<\/p>\n
\u51fa\u73b0\u5b57\u6837\u201c0 Error(s)\uff0c0 Warning(s)\u201d\uff0c\u8fd9\u8bf4\u660e\u751f\u6210\u7684\u4ee3\u7801\u4e2d\u4e0d\u5b58\u5728\u95ee\u9898\u3002\u7136\u540e\uff0c\u70b9\u51fb\u201c\u9b54\u672f\u68d2\u201d\uff1a<\/p>\n
<\/p>\n
\u51fa\u73b0\u5982\u4e0b\u754c\u9762\uff1a<\/p>\n
<\/p>\n
\u5c06\u201cTarget\u201d \u2192 \\rightarrow <\/span><\/span>\u2192<\/span><\/span><\/span><\/span><\/span> \u201cUse MicroLIB\u201d\u52fe\u9009\u4e0a\u3002\u8fd9\u91cc\u82e5\u4e0d\u52fe\u9009\uff0c\u5219\u4e32\u53e3\u65e0\u6cd5\u4f7f\u7528\u3002\u52fe\u9009\u540e\uff0c\u9700\u8981\u91cd\u65b0\u8fdb\u884c\u7f16\u8bd1\u3002<\/p>\n2.\u5728\u5de5\u7a0b\u6587\u4ef6\u7684\u6587\u4ef6\u6811\u4e2d\u627e\u5230\u201cstm32f1xx_it.c\u201d\u6587\u4ef6\uff0c\u627e\u5230\u5982\u4e0b\u4ee3\u7801\u5757\u5e76\u5728\u4ee3\u7801\u5757\u4e2d\u7684* USER CODE BEGIN USART3_IRQn 1 \/\u548c\/<\/em> USER CODE END USART3_IRQn 1 *\/\u4e2d\u95f4\u6dfb\u52a0\u4ee3\u7801\uff0c\u6700\u7ec8\u4ee3\u7801\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\/** * @brief This function handles USART3 global interrupt. *\/<\/span>\nvoid<\/span> USART3_IRQHandler<\/span>(<\/span>void<\/span>)<\/span>\n{ \n <\/span>\n \/* USER CODE BEGIN USART3_IRQn 0 *\/<\/span>\n\n \/* USER CODE END USART3_IRQn 0 *\/<\/span>\n HAL_UART_IRQHandler<\/span>(<\/span>&<\/span>huart3)<\/span>;<\/span>\n \/* USER CODE BEGIN USART3_IRQn 1 *\/<\/span>\n\tif<\/span>(<\/span>__HAL_UART_GET_FLAG<\/span>(<\/span>&<\/span>huart3,<\/span> UART_FLAG_IDLE)<\/span> !=<\/span> RESET)<\/span>{ \n <\/span>\n\t\t__HAL_UART_CLEAR_IDLEFLAG<\/span>(<\/span>&<\/span>huart3)<\/span>;<\/span>\n\t\tHAL_UART_IdleCpltCallback<\/span>(<\/span>&<\/span>huart3)<\/span>;<\/span>\n\t}<\/span>\n \/* USER CODE END USART3_IRQn 1 *\/<\/span>\n}<\/span>\n\n<\/code><\/pre>\n3.\u7531\u4e8e\u5728\u9879\u76ee\u4e2d\u6d89\u53ca\u5230\u63a5\u6536\u673a\u548c\u9065\u63a7\u5668\u4e4b\u95f4\u7684\u4fe1\u606f\u4ea4\u6362\uff0c\u6709\u5173WiFi\u9a71\u52a8\u7684\u4ee3\u7801\u8f83\u4e3a\u590d\u6742\uff0c\u7b14\u8005\u5c06\u9a71\u52a8WiFi\u7684\u76f8\u5173\u4ee3\u7801\u7edf\u4e00\u653e\u5728\u4e00\u4e2a\u5934\u6587\u4ef6\u5f53\u4e2d\u3002\u5728\u8fd9\u91cc\uff0c\u7b14\u8005\u5148\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4f55\u5728Cube\u5de5\u7a0b\u4e2d\u6dfb\u52a0.h\u6587\u4ef6\u3002<\/p>\n
\u6253\u5f00\u9879\u76ee\u6587\u4ef6\u5939\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n
<\/p>\n
\u6253\u5f00\u4e0a\u56fe\u4e2d\u7ea2\u6846\u6846\u51fa\u7684\u201cCore\u201d\u6587\u4ef6\u5939\uff1a<\/p>\n
<\/p>\n
\u6253\u5f00\u201cInc\u201d\u6587\u4ef6\u5939\uff1a<\/p>\n
<\/p>\n
\u53ef\u4ee5\u770b\u5230\uff0c\u8fd9\u4e2a\u4f4d\u7f6e\u5c31\u662f\u9879\u76ee\u4e2d\u7684\u5934\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e\u4e86\u3002\u5728\u8fd9\u4e2a\u6587\u4ef6\u5939\u4e0b\uff0c\u65b0\u5efa\u4e00\u4e2a\u6587\u672c\u6587\u6863\uff0c\u547d\u540d\u4e3a\u201cesp8266\u201d\uff0c\u5e76\u5c06\u6587\u4ef6\u540e\u7f00\u4fee\u6539\u4e3a\u201c.h\u201d\u3002\u521b\u5efa\u597d\u540e\uff0c\u6253\u5f00keil\u5de5\u7a0b\uff0c\u627e\u5230\u5982\u4e0b\u4ee3\u7801\u5757\u5e76\u6dfb\u52a0\u4ee3\u7801\uff1a<\/p>\n
\/* Private includes ----------------------------------------------------------*\/<\/span>\n\/* USER CODE BEGIN Includes *\/<\/span>\n#<\/span>include<\/span> \"esp8266.h\"<\/span> <\/span>\n#<\/span>include<\/span> \"stdio.h\"<\/span><\/span>\n\/* USER CODE END Includes *\/<\/span>\n<\/code><\/pre>\n\u7136\u540e\u7f16\u8bd1\u3002\u7f16\u8bd1\u5b8c\u6210\u540e\uff0c\u5c55\u5f00\u201cmain.c\u201d\u6587\u4ef6\u7684\u6587\u4ef6\u6811\uff0c\u53ef\u4ee5\u770b\u5230\u201cesp8266.h\u201d\u6587\u4ef6\u5df2\u7ecf\u6dfb\u52a0\u81f3\u6587\u4ef6\u6811\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728esp8266.h\u6587\u4ef6\u4e2d\u6dfb\u52a0\u6211\u4eec\u7684\u4e1a\u52a1\u4ee3\u7801\u4e86\uff1a<\/p>\n
<\/p>\n
4.\u6dfb\u52a0\u597d\u5934\u6587\u4ef6\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5f00\u59cb\u7740\u624b\u7f16\u5199ESP8266\u6a21\u5757\u7684\u9a71\u52a8\u4ee3\u7801\u4e86\u3002\u9996\u5148\uff0c\u5934\u6587\u4ef6\u7684\u9996\u5c3e\u90e8\u5206\u9700\u8981\u6dfb\u52a0\u5982\u4e0b\u4fe1\u606f\uff1a<\/p>\n
#<\/span>ifndef<\/span> __ESP8266_H__<\/span><\/span>\n#<\/span>define<\/span> __ESP8266_H__<\/span> <\/span>\n\n\/** \u4e1a\u52a1\u4ee3\u7801 *\/<\/span>\n\n#<\/span>endif<\/span><\/span>\n\n<\/code><\/pre>\n\u6ce8\u610f\uff0c\u5728\u201c#endif\u201d\u8fd9\u4e00\u884c\uff0c\u8981\u6309\u56de\u8f66\u952e\u518d\u6dfb\u52a0\u4e00\u884c\u7a7a\u767d\u884c\uff0c\u5426\u5219\u7f16\u8bd1\u65f6\u4f1a\u62a5\u9519\u3002<\/p>\n
5.\u5728\u201cstm32f1xx_it.c\u201d\u6587\u4ef6\u4e2d\uff0c\u627e\u5230\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n
\/* External variables --------------------------------------------------------*\/<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart1_rx;<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart1_tx;<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart2_rx;<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart2_tx;<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart3_rx;<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart3_tx;<\/span>\nextern<\/span> UART_HandleTypeDef huart1;<\/span>\nextern<\/span> UART_HandleTypeDef huart2;<\/span>\nextern<\/span> UART_HandleTypeDef huart3;<\/span>\n<\/code><\/pre>\n\u5c06\u7b2c\u5341\u884c\u590d\u5236\u5e76\u7c98\u8d34\u5230\u201cesp8266.h\u201d\u6587\u4ef6\u4e2d\u3002<\/p>\n
6.\u5b8c\u6210\u4e0a\u4e00\u6b65\u9aa4\u540e\uff0c\u5728\u201cesp8266.h\u201d\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\u3002\u6bcf\u884c\u4ee3\u7801\u7684\u610f\u4e49\u4ee5\u53ca\u4f5c\u7528\u7b14\u8005\u5c06\u5728\u4ee3\u7801\u6ce8\u91ca\u4e2d\u52a0\u4ee5\u8bf4\u660e\u3002<\/p>\n
\/** * @brief \u9879\u76ee\u4e2d\u9700\u8981\u7684AT\u6307\u4ee4 * @note * @param * @retval *\/<\/span>\nextern<\/span> DMA_HandleTypeDef hdma_usart3_rx;<\/span>\n\n#<\/span>define<\/span> ATRELENGTH<\/span> 256<\/span> <\/span>\/\/\u63a5\u6536\u7f13\u51b2\u533a\u7684\u5927\u5c0f\u3002\u8fd9\u4e2a\u5927\u5c0f\u9700\u8981\u5927\u4e8e\u4e00\u7ec4\u6570\u636e\u7684\u957f\u5ea6<\/span><\/span>\n\nuint8_t<\/span> ATCmdRxBuffer[<\/span>ATRELENGTH]<\/span>;<\/span> \/\/\u63a5\u6536\u7f13\u51b2\u533a<\/span>\nuint8_t<\/span> ATResRecCount =<\/span> 0<\/span>;<\/span> \/\/\u6bcf\u6b21\u63a5\u6536\u5230\u7684\u5b57\u8282\u6570<\/span>\nuint8_t<\/span> ATCmdRxFlag =<\/span> 0<\/span>;<\/span> \/\/\u63a5\u6536\u72b6\u6001\u6807\u5fd7<\/span>\n<\/code><\/pre>\n7.\u5728\u201cmain.c\u201d\u6587\u4ef6\u4e2d\u627e\u5230\u5982\u4e0b\u5bf9\u5e94\u7684\u4f4d\u7f6e\u5e76\u6dfb\u52a0\u4ee3\u7801\uff1a<\/p>\n
\/* USER CODE BEGIN 2 *\/<\/span>\n\t__HAL_UART_ENABLE_IT<\/span>(<\/span>&<\/span>huart3,<\/span> UART_IT_IDLE)<\/span>;<\/span>\/\/\u4f7f\u80fd\u4e32\u53e33 IDLE\u4e2d\u65ad<\/span>\n\tHAL_Delay<\/span>(<\/span>100<\/span>)<\/span>;<\/span>\n\/* USER CODE END 2 *\/<\/span>\n\n\/** ...... *\/<\/span>\n\n\/* USER CODE BEGIN 4 *\/<\/span>\n\/* \u4e2d\u65ad\u63a5\u6536\u56de\u8c03\u51fd\u6570 *\/<\/span>\nvoid<\/span> HAL_UART_RxCpltCallback<\/span>(<\/span>UART_HandleTypeDef *<\/span>huart)<\/span>{ \n <\/span>\n\tif<\/span>(<\/span>huart -><\/span> Instance ==<\/span> USART3)<\/span>{ \n <\/span>\n \/\/\u91cd\u65b0\u542f\u52a8DMA\u63a5\u6536<\/span>\n\t\tHAL_UART_Receive_DMA<\/span>(<\/span>&<\/span>huart3,<\/span>(<\/span>uint8_t<\/span>*<\/span>)<\/span>ATCmdRxBuffer,<\/span>ATRELENGTH)<\/span>;<\/span>\n\t}<\/span>\n}<\/span>\n\/* IDLE\u7a7a\u95f2\u4e2d\u65ad\u56de\u8c03\u51fd\u6570 *\/<\/span>\nvoid<\/span> HAL_UART_IdleCpltCallback<\/span>(<\/span>UART_HandleTypeDef *<\/span>huart)<\/span>{ \n <\/span>\n\tATCmdRxFlag