{"id":269403,"date":"2015-12-01T16:09:02","date_gmt":"2015-12-01T13:09:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=269403"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=269403","title":{"rendered":"\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0444\u0438\u0441\u043d\u044b\u043c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e Wi-Fi. \u0427\u0430\u0441\u0442\u044c 1: Wi-Fi \u043c\u043e\u0434\u0443\u043b\u044c Atmel WINC1500"},"content":{"rendered":"<br \/>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e DIY \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0430-\u043b\u044f \u00ab\u0423\u043c\u043d\u044b\u0439 \u043e\u0444\u0438\u0441\u00bb \u0438\u043b\u0438 \u00ab\u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u043e\u043c\u00bb \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043a\u0443\u043f\u0438\u0442\u044c. \u0426\u0435\u043b\u044c\u044e \u0446\u0438\u043a\u043b\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0442\u0440\u0435\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c \u043d\u0435\u0431\u0435\u0437\u044b\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Atmel:  <\/p>\n<ul>\n<li>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 SAMD21 \u0441 \u044f\u0434\u0440\u043e\u043c Cortex-M0+<\/li>\n<li>Wi-Fi \u043c\u043e\u0434\u0443\u043b\u0435\u043c WINC1500<\/li>\n<li>\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a Q-touch <\/li>\n<\/ul>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0435, \u043c\u044b \u0434\u043b\u044f \u043f\u0443\u0449\u0435\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043c\u0438\u0433\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u0438\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043e\u0444\u0438\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 Wi-Fi \u0441\u0435\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 ModBus TCP, \u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u043e\u0432. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0443 \u043d\u0430\u0448\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 <a href=\"http:\/\/www.atmel.com\/tools\/ATSAMD21-XPRO.aspx?tab=overview\">SAMD21 Xplained Pro<\/a>, c 2-\u043c\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043a \u043d\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <a href=\"http:\/\/www.atmel.com\/tools\/ATWINC1500-XPRO.aspx\">ATWINC1500-XPRO<\/a> \u0438 <a href=\"http:\/\/www.atmel.com\/tools\/ATQT1-XPRO.aspx\">ATQT1-XPRO<\/a>. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432 \u043c\u043e\u0434\u0443\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7c0\/3f0\/e42\/7c03f0e429e84612b75612854e617a95.png\"\/><a name=\"habracut\"><\/a>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431 \u043e\u0442\u043b\u0430\u0434\u043a\u0430\u0445 \u0441\u0435\u0440\u0438\u0438 Xplained Pro<\/b><\/p>\n<div class=\"spoiler_text\"><a href=\"http:\/\/www.atmel.com\/products\/microcontrollers\/avr\/xplained.aspx\">Xplained Pro Kits<\/a> \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0438\u044f \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u043f\u043b\u0430\u0442 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0446\u0435\u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 (\u0441\u0430\u043c\u044b\u043c\u0438 \u0434\u0435\u0448\u0435\u0432\u044b\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0438\u0442\u044b \u0441\u0435\u0440\u0438\u0438 Xplained mini) \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 Atmel \u0438 \u043d\u0430\u0431\u043e\u0440 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a \u043d\u0438\u043c. \u041f\u0440\u0438\u0447\u0435\u043c, \u0437\u0430 \u0441\u0447\u0435\u0442 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u0440\u0430\u0435\u0432\u044b\u0445 \u0440\u0430\u0437\u044a\u0435\u043c\u043e\u0432 \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0430\u0445 \u043c\u043e\u0434\u0443\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043a \u043b\u044e\u0431\u043e\u0439 \u043f\u043b\u0430\u0442\u0435. \u0422.\u0435. \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f \u0430-\u043b\u044f Arduino. \u041d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0430\u0445 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a EDBG. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u044f \u043d\u0430 \u043f\u043b\u0430\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u043d\u0435\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.   <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>  \u0423 \u043d\u0430\u0441 \u0432 \u043e\u0444\u0438\u0441\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043d\u044b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 (\u0447\u0438\u0442\u0430\u0439 \u0434\u0438\u043c\u043c\u0438\u0440\u0443\u0435\u043c\u044b\u0435) \u0441\u0432\u0435\u0442\u0438\u043b\u044c\u043d\u0438\u043a\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 DALI. \u0414\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0448\u043b\u044e\u0437 ModBus-DALI \u043d\u0430\u0448\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0428\u043b\u044e\u0437 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 RS485 (ModBus RTU), \u0442\u0430\u043a \u0438 \u0447\u0435\u0440\u0435\u0437 Ethernet (ModBus TCP). \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u0448\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e Wi-Fi, \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430 \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0438\u0445 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 ModBus TCP. \u0422\u0435, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u044b DALI \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u0438\u043b\u044c\u043d\u0438\u043a\u0430\u043c.<br \/>  <i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0448\u043b\u044e\u0437 ModBus DALI \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439, \u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c (\u0421\u0423\u041e).<\/i><\/p>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Wi-Fi \u043c\u043e\u0434\u0443\u043b\u044f WINC1500<\/h4>\n<p>  Atmel, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438 \u043f\u043e\u043b\u0443\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u0438\u043a\u043e\u0432\u043e\u0439 \u0442\u0435\u0445\u043d\u0438\u043a\u0438, \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u0435\u0431\u0435 \u0442\u0435\u043f\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u0435\u0447\u043a\u043e \u0432 \u043c\u0430\u043b\u043e\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c, \u043d\u043e \u043d\u0430\u0431\u0438\u0440\u0430\u044e\u0449\u0435\u043c \u0441\u0438\u043b\u0443 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u043e\u043c \u00ab\u043f\u0443\u0437\u044b\u0440\u0435\u00bb \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c Internet Of Things. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0432\u043e\u0438 Wi-Fi \u0440\u0435\u0448\u0435\u043d\u0438\u044f Atmel \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a \u043c\u0430\u043b\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0449\u0438\u0435 \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0432\u0435\u0449\u0435\u0439. \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0434\u0443\u043b\u044c WINC1500 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0445\u043e\u0441\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u043f\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 UART\/SPI\/I2C. \u041c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0447\u0438\u043f-\u0430\u043d\u0442\u0435\u043d\u043d\u0443 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0440\u0430\u0442\u043a\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0437 \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>IEEE\u00ae802.11 b\/g\/n 20MHz (1&#215;1) solution<\/li>\n<li>Single spatial stream in 2.4GHz ISM band<\/li>\n<li>Integrated PA and T\/R Switch<\/li>\n<li>Integrated PCB antenna<\/li>\n<li>Superior Sensitivity and Range via advanced PHY signal processing<\/li>\n<li>Advanced Equalization and Channel Estimation<\/li>\n<li>Advanced Carrier and Timing Synchronization<\/li>\n<li>Wi-Fi Direct and Soft-AP support<\/li>\n<li>Supports IEEE 802.11 WEP, WPA, WPA2 Security<\/li>\n<li>Supports China WAPI security<\/li>\n<li>Superior MAC throughput via hardware accelerated two-level A-MSDU\/A-MPDU frame aggregation and block acknowledgement<\/li>\n<li>On-chip memory management engine to reduce host load<\/li>\n<li>SPI, UART, and I2C host interfaces<\/li>\n<li>2- or 3-wire Bluetooth\u00ae coexistence interface<\/li>\n<li>Operating temperature range of -40\u00b0C to +85\u00b0C<\/li>\n<li>I\/O operating voltage of 2.7V to 3.6V<\/li>\n<li>Integrated Flash memory for system software<\/li>\n<li>Power Save Modes<\/li>\n<li>Integrated Network IP stack to minimize host CPU requirements<\/li>\n<li>Network features TCP, UDP, DHCP, ARP, HTTP, SSL, and DNS<\/li>\n<li>Small footprint host driver (4KB flash \u2013 less than 1KB RAM)<\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h4>\n<p>  \u041e\u0442\u043b\u0430\u0434\u043a\u0430 SAMD21 Xplained \u0438\u043c\u0435\u0435\u0442 3 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0440\u0430\u0437\u044a\u0435\u043c\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u043b\u0430\u0442\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0441 WINC1500 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043a \u0440\u0430\u0437\u044a\u0435\u043c\u0443 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 EXT1. \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0451 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0440\u0430\u0437\u044a\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 conf_winc.h \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u0442\u044b:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0435\u0444\u0430\u0439\u043d\u044b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f EXT3<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/  ---------- PIN settings --------- #define CONF_WINC_PIN_RESET\t\t\t\tPIN_PA27 #define CONF_WINC_PIN_CHIP_ENABLE\t\tPIN_PA28 #define CONF_WINC_PIN_WAKE\t\t\t\tPIN_PB08  \/\/    ---------- SPI settings --------- #define CONF_WINC_USE_SPI\t\t\t\t(1)  \/** SPI pin and instance settings. *\/ #define CONF_WINC_SPI_MODULE\t\t\tSERCOM2 #define CONF_WINC_SPI_SERCOM_MUX\t\tSPI_SIGNAL_MUX_SETTING_D #define CONF_WINC_SPI_PINMUX_PAD0\t\tPINMUX_PA12C_SERCOM2_PAD0 \/* out *\/ #define CONF_WINC_SPI_PINMUX_PAD1\t\tPINMUX_PA13C_SERCOM2_PAD1 \/* sck  *\/ #define CONF_WINC_SPI_PINMUX_PAD2\t\tPINMUX_UNUSED \/* cs driven from software *\/ #define CONF_WINC_SPI_PINMUX_PAD3\t\tPINMUX_PA15C_SERCOM2_PAD3 \/* in  *\/ #define CONF_WINC_SPI_CS_PIN\t\t\tPIN_PA14  \/** SPI interrupt pin. *\/ #define CONF_WINC_SPI_INT_PIN\t\t\tPIN_PB09A_EIC_EXTINT9 #define CONF_WINC_SPI_INT_MUX\t\t\tMUX_PB09A_EIC_EXTINT9 #define CONF_WINC_SPI_INT_EIC\t\t\t(9) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d \u0441 \u0445\u043e\u0441\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u043f\u043e SPI, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043a \u043c\u043e\u0434\u0443\u043b\u044e \u0438\u0434\u0435\u0442 \u043f\u043e\u0440\u0442 \u0432\u0432\u043e\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u00ab\u0434\u0435\u0440\u0433\u0430\u0435\u0442\u00bb \u043f\u0440\u0438 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 (\u043f\u0440\u0438\u0435\u043c\u0435\/\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043f\u0430\u043a\u0435\u0442\u0430). \u0412 \u043a\u043e\u0434\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u0438\u043d\u0435. \u041f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0435\u0431\u0430\u0436\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 COM-\u043f\u043e\u0440\u0442<\/h4>\n<p>  \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a EDBG \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u043a\u0430\u043a \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a \u0438 \u043a\u0430\u043a \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 COM-port, \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 SERCOM&#8217;\u043e\u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 COM-\u043f\u043e\u0440\u0442 \u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0442 \u0436\u0435 \u0440\u0430\u0437\u044a\u0435\u043c USB-micro, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">static void configure_console(void) { \tstruct usart_config usart_conf;  \tusart_get_config_defaults(&usart_conf); \tusart_conf.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING; \tusart_conf.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0; \tusart_conf.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1; \tusart_conf.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX_PAD2; \tusart_conf.pinmux_pad3 = EDBG_CDC_SERCOM_PINMUX_PAD3; \tusart_conf.baudrate    = 115200;  \tstdio_serial_init(&cdc_uart_module, EDBG_CDC_MODULE, &usart_conf); \tusart_enable(&cdc_uart_module); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>Callback&#8217;\u0438 \u043d\u0430\u0448\u0435 \u0432\u0441\u0451<\/h4>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c WINC1500 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 Callback&#8217;\u043e\u0432, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u043c\u044b \u0447\u0442\u043e-\u0442\u043e \u0445\u043e\u0442\u0438\u043c \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 Wi-Fi \u0441\u0435\u0442\u0435\u0439 \u0432 \u0440\u0430\u0434\u0438\u043e\u044d\u0444\u0438\u0440\u0435), \u0442\u043e \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c) \u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0443\u0445\u043e\u0434\u0438\u0442 \u00ab\u0434\u0443\u043c\u0430\u0442\u044c\u00bb. \u041a\u043e\u0433\u0434\u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u043d \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0438\u043d\u0430 INT, \u0432\u044b\u0437\u0432\u0430\u0432 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u043d\u0435\u0448\u043d\u0435\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 m2m_wifi_handle_events(NULL); \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b (\u0442\u0438\u043f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435) \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u044d\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0444\u0438\u0440\u0430 \u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0434\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439) \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f (Callback), \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/698\/6e0\/698\/6986e06989f44865ab136add166bb7b0.png\"\/><\/p>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u0432\u044f\u0437\u0438 \u0441 WINC1500 \u043f\u043e SPI<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 Callback&#8217;\u0438. \u0414\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044f callback \u043d\u0435 \u043d\u0443\u0436\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043a\u0430 \u0435\u0433\u043e \u043d\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0438 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u043c.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">int main(void) { \ttstrWifiInitParam settings; \tint8_t ret;  \t\/\/ Initialize the board. \tsystem_init();  \t\/\/ Initialize the UART console. \tconfigure_console(); \tprintf(STRING_HEADER);  \t\/\/ Initialize the BSP. \tnm_bsp_init();  \t\/\/ Initialize Wi-Fi parameters structure. \tmemset((uint8_t *)&settings, 0, sizeof(tstrWifiInitParam));  \t\/\/Initialize Wi-Fi driver with data and status callbacks. \tret = m2m_wifi_init(&settings); \tif (M2M_SUCCESS != ret)          { \t\tprintf(&quot;main: m2m_wifi_init call error!(%d)\\r\\n&quot;, ret); \t\twhile (1); \t}  \t\/\/ Display WINC1500 chip information. \tprintf(&quot;Chip ID : \\r\\t\\t\\t%x\\r\\n&quot;, (unsigned int)nmi_get_chipid()); \tprintf(&quot;RF Revision ID : \\r\\t\\t\\t%x\\r\\n&quot;, (unsigned int)nmi_get_rfrevid()); \tprintf(&quot;Done.\\r\\n\\r\\n&quot;);  \twhile (1); \treturn 0; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h4>\n<p>  WINC1500 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u0440\u0430\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u043c\u0441\u044f \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e DHCP. \u041d\u0430\u0447\u0430\u043b\u043e main \u0442\u0430\u043a\u043e\u0435 \u0436\u0435, \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f callback \u043f\u0435\u0440\u0435\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f:  <\/p>\n<pre><code class=\"cpp\">\/\/ Initialize Wi-Fi parameters structure. \tmemset((uint8_t *)&settings, 0, sizeof(tstrWifiInitParam));  \t\/\/ Initialize Wi-Fi driver with data and status callbacks.  \tsettings.pfAppWifiCb = wifi_cb; \tret = m2m_wifi_init(&settings); \tif (M2M_SUCCESS != ret)  \t{ \t\tprintf(&quot;main: m2m_wifi_init call error!(%d)\\r\\n&quot;, ret); \t\twhile (1); \t} <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 WINC1500 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438 WEP \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (WPA \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f), \u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u0430\u044f Wi-Fi \u0441\u0435\u0442\u044c. \u0422\u0430\u043a \u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 1 \u043a\u043b\u0438\u0435\u043d\u0442.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 main:  <\/p>\n<pre><code class=\"cpp\">\t\/\/ Initialize AP mode parameters structure with SSID, channel and OPEN security type.  \tmemset(&strM2MAPConfig, 0x00, sizeof(tstrM2MAPConfig)); \tstrcpy((char *)&strM2MAPConfig.au8SSID, MAIN_WLAN_SSID); \tstrM2MAPConfig.u8ListenChannel = MAIN_WLAN_CHANNEL; \tstrM2MAPConfig.u8SecType = MAIN_WLAN_AUTH;  \tstrM2MAPConfig.au8DHCPServerIP[0] = 192; \tstrM2MAPConfig.au8DHCPServerIP[1] = 168; \tstrM2MAPConfig.au8DHCPServerIP[2] = 1; \tstrM2MAPConfig.au8DHCPServerIP[3] = 1;  #if USE_WEP \tstrcpy((char *)&strM2MAPConfig.au8WepKey, MAIN_WLAN_WEP_KEY); \tstrM2MAPConfig.u8KeySz = strlen(MAIN_WLAN_WEP_KEY); \tstrM2MAPConfig.u8KeyIndx = MAIN_WLAN_WEP_KEY_INDEX; #endif  \t\/* Bring up AP mode with parameters structure. *\/ \tret = m2m_wifi_enable_ap(&strM2MAPConfig); \tif (M2M_SUCCESS != ret)  \t{ \t\tprintf(&quot;main: m2m_wifi_enable_ap call error!\\r\\n&quot;); \t\twhile (1); \t}  \tprintf(&quot;AP mode started. You can connect to %s.\\r\\n&quot;, (char *)MAIN_WLAN_SSID);  \twhile (1)  \t{  \t\twhile (m2m_wifi_handle_events(NULL) != M2M_SUCCESS);\t\t\/\/ Handle pending events from network controller. }\t  \/\/ \u041a\u043e\u0434 callback  static void wifi_cb(uint8_t u8MsgType, void *pvMsg) { \tswitch (u8MsgType) { \tcase M2M_WIFI_RESP_CON_STATE_CHANGED: \t{ \t\ttstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg; \t\tif (pstrWifiState-&gt;u8CurrState == M2M_WIFI_CONNECTED) { \t\t} else if (pstrWifiState-&gt;u8CurrState == M2M_WIFI_DISCONNECTED) { \t\t\tprintf(&quot;Station disconnected\\r\\n&quot;); \t\t}  \t\tbreak; \t}  \tcase M2M_WIFI_REQ_DHCP_CONF: \t{ \t\tuint8_t *pu8IPAddress = (uint8_t *)pvMsg; \t\tprintf(&quot;Station connected\\r\\n&quot;); \t\tprintf(&quot;Station IP is %u.%u.%u.%u\\r\\n&quot;, \t\t\t\tpu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]); \t\tbreak; \t}  \tdefault: \t{ \t\tbreak; \t} \t} }   \u0424\u0430\u0439\u043b main.h: \/** Security mode *\/ #define USE_WEP\t\t\t\t\t (1) \/*&lt; Set to (1) to use WEP, and (0) to use OPEN *\/  \/** AP mode Settings *\/ #define MAIN_WLAN_SSID           &quot;WINC1500_AP&quot; \/* &lt; SSID *\/ #if USE_WEP #define MAIN_WLAN_AUTH           M2M_WIFI_SEC_WEP \/* &lt; Security manner *\/ #define MAIN_WLAN_WEP_KEY        &quot;1234567890&quot; \/* &lt; Security Key in WEP Mode *\/ #define MAIN_WLAN_WEP_KEY_INDEX  (1) #else #define MAIN_WLAN_AUTH           M2M_WIFI_SEC_OPEN \/* &lt; Security manner *\/ #endif #define MAIN_WLAN_CHANNEL        (6) \/* &lt; Channel number *\/ <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0440\u0435\u0436\u0438\u043c\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b WINC1500, \u0430 \u0441\u043b\u0443\u0436\u0438\u0442 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 \u0442\u043e\u0447\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432 \u0412\u0430\u0448\u0435\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043d\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0435\u0442\u0438 (SSID \u0438 \u043f\u0430\u0440\u043e\u043b\u044c), \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043d\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u0438.<br \/>  \u041a\u0441\u0442\u0430\u0442\u0438 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c: \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0438\u043c\u043e \u0441\u0442\u0430\u0440\u0442\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c WEB-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043d\u0435\u043c\u0443 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0441\u0435\u0442\u0438.<\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u0443\u0435\u043c \u044d\u0444\u0438\u0440 \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u044f Wi-Fi \u0441\u0435\u0442\u0435\u0439 \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0438\u0445 \u0441\u043f\u0438\u0441\u043e\u043a \u0432 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u044b\u0439 \u043f\u043e\u0440\u0442.<br \/>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e m2m_wifi_request_scan(M2M_WIFI_CH_ALL), \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f  <\/p>\n<pre><code class=\"cpp\">\t\/* Initialize Wi-Fi parameters structure. *\/ \tmemset((uint8_t *)&settings, 0, sizeof(tstrWifiInitParam)); \t\/* Initialize Wi-Fi driver with data and status callbacks. *\/ \tsettings.pfAppWifiCb = wifi_cb; \tret = m2m_wifi_init(&settings); \tif (M2M_SUCCESS != ret)         { \t\tprintf(&quot;main: m2m_wifi_init call error!(%d)\\r\\n&quot;, ret); \t\twhile (1); \t} \t\/* Request scan. *\/ \tm2m_wifi_request_scan(M2M_WIFI_CH_ALL); <\/code><\/pre>\n<p>  \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043f\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432 callback wifi_cb  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 wifi_cb \u0434\u043b\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">static void wifi_cb(uint8_t u8MsgType, void *pvMsg) { \tswitch (u8MsgType) { \tcase M2M_WIFI_RESP_SCAN_DONE: \t{ \t\ttstrM2mScanDone *pstrInfo = (tstrM2mScanDone *)pvMsg; \t\tscan_request_index = 0; \t\tif (pstrInfo-&gt;u8NumofCh &gt;= 1)  \t\t{ \t\t\tm2m_wifi_req_scan_result(scan_request_index); \t\t\tscan_request_index++; \t\t}  \t\telse  \t\t{ \t\t\tm2m_wifi_request_scan(M2M_WIFI_CH_ALL); \t\t}  \t\tbreak; \t}  \tcase M2M_WIFI_RESP_SCAN_RESULT: \t{ \t\ttstrM2mWifiscanResult *pstrScanResult = (tstrM2mWifiscanResult *)pvMsg; \t\tuint16_t demo_ssid_len; \t\tuint16_t scan_ssid_len = strlen((const char *)pstrScanResult-&gt;au8SSID);  \t\t\/* display founded AP. *\/ \t\tprintf(&quot;[%d] SSID:%s\\r\\n&quot;, scan_request_index, pstrScanResult-&gt;au8SSID);  \t\tnum_founded_ap = m2m_wifi_get_num_ap_found(); \t\tif (scan_ssid_len) { \t\t\t\/* check same SSID. *\/ \t\t\tdemo_ssid_len = strlen((const char *)MAIN_WLAN_SSID); \t\t\tif(\t(demo_ssid_len == scan_ssid_len) &&\t(!memcmp(pstrScanResult-&gt;au8SSID, (uint8_t *)MAIN_WLAN_SSID, demo_ssid_len)))  \t\t\t{ \t\t\t\t\/* A scan result matches an entry in the preferred AP List. \t\t\t\t * Initiate a connection request. \t\t\t\t *\/ \t\t\t\tprintf(&quot;Found %s \\r\\n&quot;, MAIN_WLAN_SSID); \t\t\t\tm2m_wifi_connect((char *)MAIN_WLAN_SSID,sizeof(MAIN_WLAN_SSID),\tMAIN_WLAN_AUTH,(void *)MAIN_WLAN_PSK,M2M_WIFI_CH_ALL); \t\t\t\tbreak; \t\t\t} \t\t}  \t\tif (scan_request_index &lt; num_founded_ap)  \t\t{ \t\t\tm2m_wifi_req_scan_result(scan_request_index); \t\t\tscan_request_index++; \t\t} \t\telse  \t\t{ \t\t\tprintf(&quot;can not find AP %s\\r\\n&quot;, MAIN_WLAN_SSID); \t\t\tm2m_wifi_request_scan(M2M_WIFI_CH_ALL); \t\t}  \t\tbreak; \t}  \tcase M2M_WIFI_RESP_CON_STATE_CHANGED: \t{ \t\ttstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg; \t\tif (pstrWifiState-&gt;u8CurrState == M2M_WIFI_CONNECTED)                  { \t\t\tm2m_wifi_request_dhcp_client(); \t\t}                 else if (pstrWifiState-&gt;u8CurrState == M2M_WIFI_DISCONNECTED)                { \t\t\tprintf(&quot;Wi-Fi disconnected\\r\\n&quot;);  \t\t\t\/* Request scan. *\/ \t\t\tm2m_wifi_request_scan(M2M_WIFI_CH_ALL); \t\t}  \t\tbreak; \t}  \tcase M2M_WIFI_REQ_DHCP_CONF: \t{ \t\tuint8_t *pu8IPAddress = (uint8_t *)pvMsg; \t\tprintf(&quot;Wi-Fi connected\\r\\n&quot;); \t\tprintf(&quot;Wi-Fi IP is %u.%u.%u.%u\\r\\n&quot;, pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]); \t\tbreak; \t}  \tdefault: \t{ \t\tbreak; \t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e UDP\/TCP \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u0431\u0430\u0436\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0413\u0435\u0440\u043a\u0443\u043b\u0435\u0441\u043e\u043c)<br \/>  \u0414\u0435\u0431\u0430\u0436\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c7e\/39d\/45c\/c7e39d45c2a34d36ac27897f2f1e3248.png\"\/><\/p>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e DHCP<\/h4>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e WINC \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e DHCP, \u0438 \u043f\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u043c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0445 Atmel, \u043e\u043d\u0438 \u0445\u043e\u0442\u044f\u0442 \u043f\u0440\u0435\u043a\u0440\u044b\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c IP. <br \/>  \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043f\u043e DHCP \u043a\u043e\u0434 callback \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 wifi_cb \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 DHCP<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">static void wifi_cb(uint8_t u8MsgType, void *pvMsg) { \tswitch (u8MsgType) { \tcase M2M_WIFI_RESP_CON_STATE_CHANGED: \t{ \t\ttstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg; \t\tif (pstrWifiState-&gt;u8CurrState == M2M_WIFI_CONNECTED)                { \t\t\tprintf(&quot;wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: CONNECTED\\r\\n&quot;); \t\t\tm2m_wifi_request_dhcp_client(); \t\t}                 else if (pstrWifiState-&gt;u8CurrState == M2M_WIFI_DISCONNECTED)                 { \t\t\tprintf(&quot;wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: DISCONNECTED\\r\\n&quot;); \t\t\twifi_connected = 0; \t\t\tm2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL); \t\t}  \t\tbreak; \t}  \tcase M2M_WIFI_REQ_DHCP_CONF: \t{ \t\tuint8_t *pu8IPAddress = (uint8_t *)pvMsg; \t\twifi_connected = 1; \t\tprintf(&quot;wifi_cb: M2M_WIFI_REQ_DHCP_CONF: IP is %u.%u.%u.%u\\r\\n&quot;,pu8IPAddress[0], pu8IPAddress[1], pu8IPAddress[2], pu8IPAddress[3]); \t\tbreak; \t}  \tdefault: \t{ \t\tbreak; \t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/h4>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e dhcp \u0432 main \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f:  <\/p>\n<pre><code class=\"cpp\">\tm2m_wifi_enable_dhcp(0); <\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c callback:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 wifi_cb \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e IP<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">static void wifi_cb(uint8_t u8MsgType, void *pvMsg) { \t \tprintf(&quot;wifi_cb: u8MsgType= %d\\n&quot;,u8MsgType); \tswitch (u8MsgType) { \tcase M2M_WIFI_RESP_CON_STATE_CHANGED: \t{ \t\ttstrM2mWifiStateChanged *pstrWifiState = (tstrM2mWifiStateChanged *)pvMsg; \t\tif (pstrWifiState-&gt;u8CurrState == M2M_WIFI_CONNECTED)  \t\t{ \t\t\tprintf(&quot;wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: CONNECTED\\r\\n&quot;); \t\t\t\t \t\t\ttstrM2MIPConfig ip_client; \t\t\tip_client.u32StaticIP = _htonl(0xc0a8142d); \/\/corresponds to 192.168.20.45 \t\t\tip_client.u32DNS = _htonl(0xc0a80266); \/\/corresponds to 192.168.2.102 \t\t\tip_client.u32SubnetMask =_htonl(0xFFFFFF00); \/\/corresponds to 255.255.255.0 \t\t\tip_client.u32Gateway = _htonl(0xc0a81401);  \/\/corresponds to 192.168.20.1 \t\t\tm2m_wifi_set_static_ip(&ip_client); \t\t \t\t\twifi_connected = 1; \t\t} \t\telse \t\t{ \t\t\tif (pstrWifiState-&gt;u8CurrState == M2M_WIFI_DISCONNECTED)  \t\t\t{ \t\t\t   printf(&quot;wifi_cb: M2M_WIFI_RESP_CON_STATE_CHANGED: DISCONNECTED\\r\\n&quot;); \t\t\t   wifi_connected = 0; \t\t\t   m2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL); \t\t\t} \t\t} \t\tbreak; \t}  \tdefault: \t\tbreak; \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 TCP\/IP \u0441\u0442\u0435\u043a\u043e\u043c<\/h4>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e API \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 TCP\/IP \u0441\u0442\u0435\u043a\u043e\u043c \u0447\u0435\u0440\u0435\u0437 WINC1500 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0441\u043e\u043a\u0435\u0442\u0430\u043c \u0411\u0435\u0440\u043a\u043b\u0438.  <\/p>\n<table>\n<tr>\n<th>\u0411\u0435\u0440\u043a\u043b\u0438 API<\/th>\n<th>WINC API<\/th>\n<th>Server\/Client<\/th>\n<th>TCP\/UDP<\/th>\n<th>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th>\n<\/tr>\n<tr>\n<td>socket<\/td>\n<td>socket<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0441\u043e\u043a\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td>connect<\/td>\n<td>connect<\/td>\n<td>Client<\/td>\n<td>TCP<\/td>\n<td>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 TCP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c<\/td>\n<\/tr>\n<tr>\n<td>bind<\/td>\n<td>bind<\/td>\n<td>Server<\/td>\n<td>Both<\/td>\n<td>\u0411\u0438\u043d\u0434\u0438\u0442 \u0441\u043e\u043a\u0435\u0442 \u0441 IP \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0438 \u043f\u043e\u0440\u0442\u043e\u043c<\/td>\n<\/tr>\n<tr>\n<td>listen<\/td>\n<td>listen<\/td>\n<td>Server<\/td>\n<td>TCP<\/td>\n<td>\u0421\u043e\u0437\u0434\u0430\u0435\u0442 TCP \u0441\u0435\u0440\u0432\u0435\u0440<\/td>\n<\/tr>\n<tr>\n<td>send<\/td>\n<td>send<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043e\u043a\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td>sendto<\/td>\n<td>sendto<\/td>\n<td>Both<\/td>\n<td>UDP<\/td>\n<td>\u041f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442 \u043f\u043e UDP<\/td>\n<\/tr>\n<tr>\n<td>recv<\/td>\n<td>recv<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td>recvfrom<\/td>\n<td>recvfrom<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442<\/td>\n<\/tr>\n<tr>\n<td>close<\/td>\n<td>close<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/td>\n<\/tr>\n<tr>\n<td>gethostbyname<\/td>\n<td>gethostbyname<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 IP \u0430\u0434\u0440\u0435\u0441 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0445\u043e\u0441\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td>setsockopt<\/td>\n<td>setsockopt<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u043f\u0446\u0438\u0438 \u0441\u043e\u043a\u0435\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td>htons\/ntohs<\/td>\n<td>htons\/ntohs<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442 \u0432 2-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u043e\u0441\u0442\u0430 \u0432 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 <\/td>\n<\/tr>\n<tr>\n<td>htonl\/ntohl<\/td>\n<td>htonl\/ntohl<\/td>\n<td>Both<\/td>\n<td>Both<\/td>\n<td>\u041c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0430\u0439\u0442 \u0432 4-\u0431\u0430\u0439\u0442\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u043e\u0441\u0442\u0430 \u0432 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 <\/td>\n<\/tr>\n<\/table>\n<p><i>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: API \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0411\u0435\u0440\u043a\u043b\u0438 write, read, gethostbyaddr, select, poll, getsockopt \u0432 WINC1500 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f.<\/i><\/p>\n<h4>UDP \u0438 TCP<\/h4>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e UDP \u0438 TCP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u043a\u0435\u0442\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043e\u0442\u043a\u0440\u044b\u0442\u044c, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c callback \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u0435\u043c\u0430\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (UDP \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430\/\u043f\u0440\u0438\u0435\u043c, TCP \u043a\u043b\u0438\u0435\u043d\u0442\/\u0441\u0435\u0440\u0432\u0435\u0440), \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b.<br \/>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u043e\u043a\u0435\u0442\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0412 \u043d\u0435\u0439 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u0440\u0442, IP \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0432 \u0432\u0438\u0434\u0435 0xc0a814ff, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f 192.168.20.255)  <\/p>\n<pre><code class=\"cpp\">struct sockaddr_in src_addr;  \taddr.sin_family = AF_INET; \taddr.sin_port = _htons(MAIN_WIFI_M2M_SERVER_PORT); \taddr.sin_addr.s_addr = _htonl(MAIN_WIFI_M2M_SERVER_IP); <\/code><\/pre>\n<p>  \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u043a\u0435\u0442 \u0438 callback \u043a \u043d\u0435\u043c\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0442\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 addr:  <\/p>\n<pre><code class=\"cpp\">\tsocketInit(); \tregisterSocketCallback(socket_cb, NULL);  \t\/\/ Connect to router. \tm2m_wifi_connect((char *)MAIN_WLAN_SSID, sizeof(MAIN_WLAN_SSID), MAIN_WLAN_AUTH, (char *)MAIN_WLAN_PSK, M2M_WIFI_CH_ALL); \tprintf(&quot;m2m_wifi_connect!\\r\\n&quot;); <\/code><\/pre>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043e\u043a\u0435\u0442 \u0438 \u0431\u0438\u043d\u0434\u0438\u043c \u0435\u0433\u043e \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435). \u0418 \u0434\u043b\u044f UDP \u0438 \u0434\u043b\u044f TCP \u044d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f (SOCK_DGRAM UDP, SOCK_STREAM TCP).   <\/p>\n<pre><code class=\"cpp\">SOCKET rx_socket = -1; \u0412 while(1): \tif (rx_socket &lt; 0)         { \t\t   if ((rx_socket = socket(AF_INET, SOCK_DGRAM, 0)) &lt; 0)  \t\t   { \t\t          printf(&quot;main: failed to create RX UDP Client socket error!\\r\\n&quot;); \t\t\t  continue; \t\t   } \t\t   \/\/ Socket bind  \t\t   bind(rx_socket, (struct sockaddr *)&src_addr, sizeof(struct sockaddr_in));  \t} \tif (wifi_connected == M2M_WIFI_CONNECTED) \t{ \t\t\/\/ Open client socket.  \t\tif (rx_socket &lt; 0)  \t\t{ \t\t\tif ((rx_socket = socket(AF_INET, SOCK_STREAM, 0)) &lt; 0)  \t\t\t{ \t\t\t\tprintf(&quot;main: failed to create TCP client socket error!\\r\\n&quot;); \t\t\t\tcontinue; \t\t\t} \t\t\t\/\/ Connect server\t\t\t\t \t\t       printf(&quot;socket_number new connection: %d\\r\\n&quot;, rx_socket); \t\t       ret=connect(rx_socket, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); \t\t       printf(&quot;ret value: %d\\r\\n&quot;, ret);                        connected = FALSE; \t\t       if (ret &lt; 0)  \t\t       { \t\t\t\t\tclose(rx_socket); \t\t\t\t\trx_socket = -1; \t\t\t} \t\t} \t} <\/code><\/pre>\n<p>  Callback \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\/\u0431\u0438\u043d\u0434\u0430, \u043f\u0440\u0438\u0435\u043c\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 TCP: listen, accept.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 callback \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u043e UDP (rx_socket) \u0438 TCP (tcp_client_socket):  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">socket_cb \u0434\u043b\u044f UDP \u0438 TCP<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">static void socket_cb(SOCKET sock, uint8_t u8Msg, void *pvMsg) { \t\/\/ Check for socket event on RX socket.  \tif (sock == rx_socket) \t{ \t\tif (u8Msg == SOCKET_MSG_BIND)  \t\t{ \t\t\ttstrSocketBindMsg *pstrBind = (tstrSocketBindMsg *)pvMsg; \t\t\tif (pstrBind && pstrBind-&gt;status == 0)  \t\t\t{ \t\t\t\t\/\/ Prepare next buffer reception.  \t\t\t\tsock_bind_state = 1; \t\t\t\trecv(sock, udp_data_rx, MAIN_WIFI_M2M_BUFFER_SIZE, 0); \t\t\t}  \t\t\telse  \t\t\t{ \t\t\t\tprintf(&quot;socket_cb: bind error!\\r\\n&quot;); \t\t\t} \t\t}  \t\telse if (u8Msg == SOCKET_MSG_RECVFROM)  \t\t{ \t\t\ttstrSocketRecvMsg *pstrRx = (tstrSocketRecvMsg *)pvMsg; \t\t\tif (pstrRx-&gt;pu8Buffer && pstrRx-&gt;s16BufferSize)  \t\t\t{ \t\t\t\tdelay = 0; \t\t\t\tsock_rx_state = pstrRx-&gt;s16BufferSize; \t\t\t\tprintf(&quot;socket_cb udp recv!\\r\\n&quot;); \t\t\t\tprintf(&quot;rx packet length= %d\\n&quot;,pstrRx-&gt;s16BufferSize); \t\t\t}  \t\t\telse \t\t\t{ \t\t\t\tif (pstrRx-&gt;s16BufferSize == SOCK_ERR_TIMEOUT)  \t\t\t\t{ \t\t\t\t\t\/\/ Prepare next buffer reception.  \t\t\t\t       recv(sock, udp_data_rx, MAIN_WIFI_M2M_BUFFER_SIZE, 0); \t\t\t\t} \t\t\t} \t\t} \t\tif (u8Msg == SOCKET_MSG_SENDTO)  \t\t{ \t\t\trecv(sock, udp_data_rx, MAIN_WIFI_M2M_BUFFER_SIZE, 0); \t\t\tsock_tx_state = 1; \t\t} \t} \tif (sock == tcp_client_socket) \t{\t\t \t   switch (u8Msg)  \t   { \t\t   \/\/ Socket connected \t\t   case SOCKET_MSG_CONNECT: \t\t   { \t\t      tstrSocketConnectMsg *pstrConnect = (tstrSocketConnectMsg *)pvMsg; \t\t\t  if (pstrConnect && pstrConnect-&gt;s8Error &gt;= 0) \t\t\t  { \t\t\t\t  printf(&quot;socket_cb tcp connect!\\r\\n&quot;); \t\t\t\t  tcp_ready_to_send=1; \t\t\t  } \t\t\t  else \t\t\t  { \t\t\t\t  close(tcp_client_socket); \t\t\t\t  tcp_client_socket = -1; \t\t\t  } \t\t  } \t\t  break;  \t\t  \/\/ Message send \t\t  case SOCKET_MSG_SEND: \t\t  { \t\t\t   printf(&quot;socket_cb tcp send!\\r\\n&quot;); \t\t\t  recv(tcp_client_socket, tcp_data_rx, sizeof(tcp_data_rx), 0); \t\t\t  tcp_tx_ready=1; \t\t  } \t\t  break;  \t\t  \/\/ Message receive \t\t  case SOCKET_MSG_RECV: \t\t  { \t\t\t   \t\t\t  tstrSocketRecvMsg *pstrRecv = (tstrSocketRecvMsg *)pvMsg; \t\t\t  if (pstrRecv && pstrRecv-&gt;s16BufferSize &gt; 0) \t\t\t  { \t\t\t\t  tcp_rx_ready=pstrRecv-&gt;s16BufferSize; \t\t\t  } \t\t\t  else \t\t\t  { \t\t\t\t  close(tcp_client_socket); \t\t\t\t  tcp_client_socket = -1; \t\t\t  } \t\t  } \t\t  break;  \t\t  default: \t\t    break; \t   }\t\t \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0430\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432 while(1) \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f:  <\/p>\n<pre><code class=\"cpp\">m2m_wifi_handle_events(NULL); <\/code><\/pre>\n<p>  \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u043c\u044b \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 ModBus-DALI \u0448\u043b\u044e\u0437\u0443. \u0428\u043b\u044e\u0437 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f TCP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043d\u0430 502 \u043f\u043e\u0440\u0442\u0443. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0446\u0438\u043a\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 ModBus TCP \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u0430\u0448\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0414\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447.               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/geektimes.ru\/post\/266368\/\"> http:\/\/geektimes.ru\/post\/266368\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0441\u0442\u0430\u0442\u0435\u0439 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e DIY \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0430-\u043b\u044f \u00ab\u0423\u043c\u043d\u044b\u0439 \u043e\u0444\u0438\u0441\u00bb \u0438\u043b\u0438 \u00ab\u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043d\u043e\u043c\u00bb \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043a\u0443\u043f\u0438\u0442\u044c. \u0426\u0435\u043b\u044c\u044e \u0446\u0438\u043a\u043b\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0442\u0440\u0435\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u043c \u043d\u0435\u0431\u0435\u0437\u044b\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Atmel:  <\/p>\n<ul>\n<li>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 SAMD21 \u0441 \u044f\u0434\u0440\u043e\u043c Cortex-M0+<\/li>\n<li>Wi-Fi \u043c\u043e\u0434\u0443\u043b\u0435\u043c WINC1500<\/li>\n<li>\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0435\u0439 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a Q-touch <\/li>\n<\/ul>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0435, \u043c\u044b \u0434\u043b\u044f \u043f\u0443\u0449\u0435\u0439 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043c\u0438\u0433\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u0438\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043e\u0444\u0438\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 Wi-Fi \u0441\u0435\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 ModBus TCP, \u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0445 \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0441\u043b\u0430\u0439\u0434\u0435\u0440\u043e\u0432. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0443\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0443 \u043d\u0430\u0448\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 <a href=\"http:\/\/www.atmel.com\/tools\/ATSAMD21-XPRO.aspx?tab=overview\">SAMD21 Xplained Pro<\/a>, c 2-\u043c\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043a \u043d\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <a href=\"http:\/\/www.atmel.com\/tools\/ATWINC1500-XPRO.aspx\">ATWINC1500-XPRO<\/a> \u0438 <a href=\"http:\/\/www.atmel.com\/tools\/ATQT1-XPRO.aspx\">ATQT1-XPRO<\/a>. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432 \u043c\u043e\u0434\u0443\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043a \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7c0\/3f0\/e42\/7c03f0e429e84612b75612854e617a95.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-269403","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269403"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269403\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}