{"id":285834,"date":"2017-05-03T07:35:50","date_gmt":"2017-05-03T03:35:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285834"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285834","title":{"rendered":"\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 STM32CubeMX. \u0427\u0430\u0441\u0442\u044c 3"},"content":{"rendered":"<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b \u043f\u0440\u043e \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u044b STM32MXCube \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 STM32.<br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/310742\/\">\u0427\u0430\u0441\u0442\u044c 1.<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/312810\/\">\u0427\u0430\u0441\u0442\u044c 2.<\/a><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ee3\/d7e\/3d3\/ee3d7e3d325e4952ab61b4ee9446f619.jpg\"\/><br \/>  \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043c\u044b \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 GPIO, \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u043c, DMA \u0438 DAC. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 ADC \u0438 USB.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043a \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438<\/h2>\n<p>  \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0445\u043e\u0447\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0441 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 NUCLEO-F767ZI. \u042d\u0442\u0430 \u043f\u043b\u0430\u0442\u0430 \u0431\u043e\u043b\u0435\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430, \u0447\u0435\u043c STM32F746G Discovery, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 LQFP144, \u0430 \u043d\u0435 BGA, \u0438 \u0441\u0430\u043c\u0430 \u043f\u043b\u0430\u0442\u0430 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u0430 \u0434\u043b\u044f \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 DIY-\u043f\u0440\u043e\u0435\u043a\u0442\u044b. \u041e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 Ethernet \u0438 USB, \u0430 \u0442\u0430\u043a\u0436\u0435 JTAG-\u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a. \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u043f\u043b\u0430\u0442\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 LCD, \u043d\u043e \u043e\u043d \u043d\u0430\u043c \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<p>  \u0425\u043e\u0442\u044f \u043f\u043b\u0430\u0442\u0430 \u0438\u043c\u0435\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0432\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0451 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (\u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u043e\u0432). \u0422\u0430\u043a\u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0442\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c 8 \u041c\u0413\u0446. \u041a\u0432\u0430\u0440\u0446 \u0434\u043b\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0441\u0445\u0435\u043c\u043e\u0439, \u043d\u043e \u043d\u0435 \u0440\u0430\u0441\u043f\u0430\u044f\u043d, \u0441\u0438\u0433\u043d\u0430\u043b 8 \u041c\u0413\u0446 \u0441\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441 JTAG-\u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 USB, \u0442\u043e \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 HSE, \u0430 \u043d\u0435 \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e RC-\u043e\u0441\u0446\u0438\u043b\u043b\u044f\u0442\u043e\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a RC-\u043e\u0441\u0446\u0438\u043b\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u044b. \u041f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c RC-\u043e\u0441\u0446\u0438\u043b\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 USB, STM32CubeMX \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 HSE (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f). \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 USB-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0434\u0430\u0436\u0435 \u043e\u0442 RC, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u0442\u044c. <\/p>\n<p>  \u042f \u043f\u0435\u0440\u0435\u0432\u0451\u043b \u043d\u0430 \u044d\u0442\u0443 \u043f\u043b\u0430\u0442\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u0437\u0430\u043b\u0438\u043b \u0438\u0445 \u043d\u0430 <a href=\"https:\/\/github.com\/arktur04\/stm32-habr\">\u0433\u0438\u0442\u0445\u0430\u0431 <\/a>.<\/p>\n<p>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0447\u0430\u0441\u0442\u044f\u043c \u0431\u044b\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 IDE. STM32CubeMX \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 IDE: IAR (EWARM), MDK ARM v4, MDK ARM v5, Atollic TRUEStudio, SW4STM32 \u0438 \u0434\u0440. \u042f \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c Atollic TRUEStudio, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u0432\u043d\u0451\u0441 \u0440\u044f\u0434 \u043f\u043e\u043f\u0440\u0430\u0432\u043e\u043a.<br \/>  \u0425\u043e\u0447\u0443 \u043f\u043e\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u0442\u044c <a href=\"https:\/\/habrahabr.ru\/users\/shamrel\/\" class=\"user_link\">Shamrel<\/a> \u0437\u0430 \u0446\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<h2>USB VCP<\/h2>\n<p>  \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b USB \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0436\u0438\u043c VCP \u2014 Virtual COM Port. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442 \u0432\u0430\u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439.<\/p>\n<p>  \u0412 STM32CubeMX \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0435 Pinout \u0440\u0430\u0437\u0434\u0435\u043b USB_OTG_FS \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Mode=Device_Only:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/da5\/ddf\/044\/da5ddf0442dd4628bbe80e024386bca0.jpg\"\/><\/p>\n<p>  \u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 USB_DEVICE \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Class For FS IP \u0432 \u0440\u0435\u0436\u0438\u043c CDC VCP (Communication Device Class Virtual Com Port):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4f7\/f3a\/a26\/4f7f3aa26e9b4ba3a2729fc1cac667a0.jpg\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0447\u0430\u0441\u0442\u043e\u0442\u0430 USB \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0430 48 MHz:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2fe\/c76\/c46\/2fec76c463924182b81bc1d12b388c4c.jpg\"\/><\/p>\n<p>  \u0418\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Configuration, \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 VBUS Sensing:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/459\/0f9\/83a\/4590f983a0a34148b1fdc7de7d9b398d.jpg\"\/><\/p>\n<p>  \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434 \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 IDE.<\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0444\u0430\u0439\u043b usbd_cdc_if.c \u0438 \u0432 \u043d\u0435\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"cpp\">static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len) {   \/* USER CODE BEGIN 6 *\/   USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);   CDC_Transmit_FS(Buf, *Len);   USBD_CDC_ReceivePacket(&hUsbDeviceFS);   return (USBD_OK);   \/* USER CODE END 6 *\/  }<\/code><\/pre>\n<p>  \u0438<\/p>\n<pre><code class=\"cpp\">uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len) {   uint8_t result = USBD_OK;   \/* USER CODE BEGIN 7 *\/    USBD_CDC_SetTxBuffer(&hUsbDeviceFS, Buf, Len);   result = USBD_CDC_TransmitPacket(&hUsbDeviceFS);   \/* USER CODE END 7 *\/    return result; }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0440\u0435\u0436\u0438\u043c \u044d\u0445\u0430: \u0432\u0441\u0451, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u043e\u0440\u0442, \u043c\u044b \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u0430\u0435\u043c \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0430\u0437\u044a\u0451\u043c User USB \u043f\u043b\u0430\u0442\u044b \u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 COM-\u043f\u043e\u0440\u0442.<\/p>\n<p>  \u0414\u043b\u044f Linux: \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c ls \/dev\/tty*, \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \/dev\/ttyACM0. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0438 \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0436\u0434\u0443\u0442 \u0435\u0449\u0451 \u0441\u044e\u0440\u043f\u0440\u0438\u0437: \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435. \u041d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 dialout:  <\/p>\n<pre><code class=\"bash\">sudo adduser user dialout<\/code><\/pre>\n<p>  (\u0433\u0434\u0435 user \u2014 \u0432\u0430\u0448\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f)<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0432 Windows \u0432\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"http:\/\/www.st.com\/content\/st_com\/en\/products\/development-tools\/software-development-tools\/stm32-software-development-tools\/stm32-utilities\/stsw-stm32102.html\">\u0434\u0440\u0430\u0439\u0432\u0435\u0440<\/a>. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 OS X \u0438 Linux \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440) Putty, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0440\u0442\u0430. \u041e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u043f\u043e\u0440\u0442\u0430 (\u0441\u043c. \u00ab\u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\/\u043f\u043e\u0440\u0442\u044b\u00bb).<\/p>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u043e\u0440\u0442 \u0432 Putty \u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0432 \u043f\u043e\u0440\u0442:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2ec\/c43\/af0\/2ecc43af0a4c4c0caf75a2bd02fa98da.jpg\"\/><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u0442 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 IDE \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u043b\u0430\u0442\u0443. \u0412\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 USB \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e COM-\u043f\u043e\u0440\u0442\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u2014 \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 USB \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Full Speed \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e 12 \u041c\u0431\u0438\u0442\/c, \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 High Speed \u2014 \u0434\u043e 480 \u041c\u0431\u0438\u0442\/c, \u043d\u043e VCP \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0436\u0430\u043b\u043a\u0438\u043c\u0438 128 \u043a\u0431\u0438\u0442\/c. <br \/>  \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043f\u043e\u043a\u0430 \u043e\u0442\u043b\u043e\u0436\u0438\u043c \u044d\u0442\u043e \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0430.<\/p>\n<h2>\u0410\u0426\u041f<\/h2>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0410\u0426\u041f, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 (\u0438 \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439) \u00ab\u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u0444\u00bb. \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043c\u044b \u043f\u043e\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u0410\u0426\u041f \u0441\u0438\u043d\u0443\u0441\u043e\u0438\u0434\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0426\u0410\u041f. \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u044e \u043a\u043e\u0434 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 (\u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u043e\u043b\u0438 \u043d\u0435 \u0438\u0433\u0440\u0430\u044e\u0442).<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431 \u0410\u0426\u041f, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 STM32F767ZI \u0438\u043c\u0435\u0435\u0442 \u0442\u0440\u0438 12-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0445 \u0410\u0426\u041f, \u0442\u0438\u043f\u0430 SAR (\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f), \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e 2 MSPS (\u043c\u043b\u043d. \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443). \u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u0410\u0426\u041f \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e, \u0447\u0435\u043c \u0441\u0438\u0433\u043c\u0430-\u0434\u0435\u043b\u044c\u0442\u0430 \u0410\u0426\u041f. \u0412\u0445\u043e\u0434 \u043e\u043f\u043e\u0440\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f VREF \u0441\u043e\u0435\u0434\u0438\u043d\u0451\u043d \u0441 VDDA, \u0438, \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u0441 VDD. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u043f\u043e\u0440\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0432\u043d\u043e 3,3\u0412. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e SAR ADC \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0441\u0445\u0435\u043c\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0438-\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440. \u0412 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u043e \u0432\u0445\u043e\u0434\u0443 \u0438 \u0437\u0430\u0440\u044f\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u0415\u0441\u043b\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440 \u043d\u0435 \u0443\u0441\u043f\u0435\u0435\u0442 \u0437\u0430\u0440\u044f\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0437\u0430\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u042d\u0442\u043e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0410\u0426\u041f \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u0432 [1].<\/p>\n<p>  \u0410\u0426\u041f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b [2], \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0441 \u0434\u0432\u0443\u0445 \u0410\u0426\u041f, \u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 DMA.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0438\u043d\u0443\u0441\u043e\u0438\u0434\u044b \u043d\u0430 DAC \u0438 \u0434\u043b\u044f USB VCP (\u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440). \u0414\u0430\u043b\u0435\u0435 (\u043f\u0440\u043e\u0432\u043e\u0434\u0430\u043c\u0438) \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u044b\u0445\u043e\u0434 \u0426\u0410\u041f \u0441 \u0432\u0445\u043e\u0434\u0430\u043c\u0438 \u0410\u0426\u041f1 \u0438 \u0410\u0426\u041f2. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a-\u0442\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u043d\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u0432\u0445\u043e\u0434\u0430\u0445, \u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043b \u0410\u0426\u041f1 c \u0426\u0410\u041f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0430 \u0410\u0426\u041f2 \u2014 \u0447\u0435\u0440\u0435\u0437 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0430\u043c\u043f\u043b\u0438\u0442\u0443\u0434\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u0430.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u0445\u0435\u043c\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0430!<\/b><\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0410\u0426\u041f \u0441\u0438\u0433\u043d\u0430\u043b \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u043b \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0432\u0445\u043e\u0434\u0435 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 0 \u2014 Vcc, \u0447\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0434\u0432\u0438\u0433\u0430 \u0438 \u0443\u0441\u0438\u043b\u0435\u043d\u0438\u044f (\u0438\u043b\u0438 \u043e\u0441\u043b\u0430\u0431\u043b\u0435\u043d\u0438\u044f) \u0441\u0438\u0433\u043d\u0430\u043b\u0430. <br \/>  \u0422\u0430\u043a\u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 STM32 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0410\u0426\u041f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u044f (SAR), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u043e\u043a \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0441 \u043d\u0438\u0437\u043a\u0438\u043c \u0438\u043c\u043f\u0435\u0434\u0430\u043d\u0441\u043e\u043c. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a92\/e4e\/285\/a92e4e2854fb46e8beb1fd4eac91eaa4.jpg\"\/><br \/>  \u0420\u0438\u0441. 1. \u0421\u0445\u0435\u043c\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438-\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f SAR ADC (\u043d\u0435 \u0438\u0437 STM32, \u043d\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439)<\/p>\n<p>  \u0412 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440\u044b (\u0440\u0438\u0441. 1) \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u043e \u0432\u0445\u043e\u0434\u0443 \u0410\u0426\u041f \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0440\u044f\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0437\u0430 \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u043e\u043a. \u0415\u0441\u043b\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u043e\u043d\u0438 \u043d\u0435 \u0443\u0441\u043f\u0435\u044e\u0442 \u0437\u0430\u0440\u044f\u0434\u0438\u0442\u044c\u0441\u044f, \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0410\u0426\u041f \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u043c\u0438. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 \u0437\u0430\u0434\u0430\u0447\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u044f, \u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0435\u0437 \u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0410\u0426\u041f \u0431\u0443\u0434\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u044b, \u0438 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043e\u043d \u043d\u0443\u0436\u0435\u043d.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/523\/9d5\/31d\/5239d531dba44e85ba97ce04a7892719.jpg\"\/><br \/>  \u0420\u0438\u0441. 2. \u0421\u0445\u0435\u043c\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438-\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0430\u043b\u044b \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0410\u0426\u041f.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 STM32 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0441\u043b\u0430\u0431\u043e, \u043d\u043e \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e [3].<br \/>  \u0415\u0441\u043b\u0438 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u044f \u043c\u043e\u0433\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u0445\u0435\u043c\u043e\u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0445 \u0443\u0437\u043b\u043e\u0432 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0441 \u0410\u0426\u041f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/div>\n<\/div>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u0432\u0430 \u0442\u0430\u0439\u043c\u0435\u0440\u0430. \u041e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u044b \u0426\u0410\u041f, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0410\u0426\u041f. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u043e-\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0434\u0432\u0443\u0445\u043a\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439. \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443 TIM2. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e DMA. <\/p>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b DMA (\u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u0441 \u043d\u0438\u043c \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0426\u0410\u041f). \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u0443\u0444\u0435\u0440 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441 \u0410\u0426\u041f, \u043c\u044b \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0443\u0444\u0435\u0440 (\u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439), \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 USB \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043d\u043e\u0432\u0430. \u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0432\u0430 \u043f\u043e\u0440\u0442\u0430 GPIO, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u044b.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0441\u043e\u0437\u0434\u0430\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 DAC \u0438 \u0442\u0430\u0439\u043c\u0435\u0440 TIM1. \u0415\u0449\u0451 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c ADC1 (\u0432\u0445\u043e\u0434 IN9), ADC2 (\u0432\u0445\u043e\u0434 IN12) \u0438 \u0442\u0430\u0439\u043c\u0435\u0440 TIM2. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f USB_OTG_FS.<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c ADC1 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443 2:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/43a\/7a0\/0a6\/43a7a00a6d19488ba7804c66f9fdfe4f.jpg\"\/><\/p>\n<p>  ADC2 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/94e\/310\/ba2\/94e310ba294b40d18272c2f7d2516b8f.jpg\"\/><\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c DMA:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/192\/b38\/974\/192b3897413b4115a126080880a1fb9f.jpg\"\/><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0449\u0430\u0435\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 Word, \u0430 \u043d\u0435 Half Word, \u0442.\u043a. \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0434\u0432\u0443\u0445 \u0410\u0426\u041f, \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 32-\u0431\u0438\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e.<br \/>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0442\u0430\u0439\u043c\u0435\u0440 TIM2:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d74\/ca2\/db4\/d74ca2db4cac4fccb50ebe92a71e78e1.jpg\"\/><\/p>\n<p>  USB \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u043c\u044b \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0435\u043b\u0430\u043b\u0438. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434.<\/p>\n<p>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0437\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043b\u0438\u0448\u044c \u043d\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445. \u0417\u0430\u043f\u0443\u0441\u043a \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0442\u0430\u0439\u043c\u0435\u0440-ADC-DMA:  <\/p>\n<pre><code class=\"cpp\">  \/\/start adc   HAL_ADC_Start(&hadc2);   HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)adc_buf, ADC_BUF_SIZE);   HAL_TIM_Base_Start_IT(&htim2);<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cpp\">void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) { \tHAL_TIM_Base_Stop(&htim2); \tHAL_ADC_Stop(&hadc2); \tHAL_ADCEx_MultiModeStop_DMA(&hadc1); \tconst int threshold = (1 &lt;&lt; 11); \t\/\/find a trigger condition \tif(state == STARTED) \t{ \t\tHAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, 1); \t\tfor(int i = 0; i &lt; (ADC_BUF_SIZE - VCP_BUF_SIZE); i++) \t\t{ \t\t\tuint32_t sample0_0 = adc_buf[i] & 0x00000FFF; \t\t\tuint32_t sample0_1 = adc_buf[i + 1] & 0x00000FFF; \t\t\tif(sample0_0 &lt; threshold && sample0_1 &gt;= threshold) \/\/the trigger condition \t\t\t{ \t\t\t\tmemcpy(vcp_buf, adc_buf + i + 1, VCP_BUF_SIZE * sizeof(uint32_t)); \t\t\t\tvcp_buf[0] |= 0x80000000;  \/\/mark the first sample in the frame \t\t\t\tCDC_Transmit_FS((uint8_t*)vcp_buf, VCP_BUF_SIZE * sizeof(uint32_t)); \t\t\t} \t\t} \t\tHAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, 0); \t} \t\/\/restart adc \t  HAL_ADC_Start(&hadc2); \t  HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t*)adc_buf, ADC_BUF_SIZE); \t  HAL_TIM_Base_Start_IT(&htim2); \t  \/\/led flashing \t  static int cnt = 0; \t  if((cnt++) % 128 == 0) \t  { \t\t  HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_14); \/\/Toggle the state of pin \t  } }<\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 USB \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430? \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c VCP \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u0430, \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0410\u0426\u041f. \u041c\u044b \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0441\u043e\u043a \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0435\u0433\u043e \u00ab\u043d\u0430\u0432\u0435\u0440\u0445\u00bb, \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u0443\u0441\u043e\u043a \u0438 \u0442. \u0434. \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043c\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440, \u0442\u043e \u0432 \u043f\u043e\u0440\u0442 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u00ab\u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430\u00bb, \u043a\u0430\u043a \u0443 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u0444\u0430. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0440\u0442 \u043d\u0435 \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442, \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0410\u0426\u041f, \u0430 \u043a\u0443\u0441\u043e\u043a \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f. \u0422\u0430\u043a\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445: sample0_0 &lt; threshold &#038;&#038; sample0_1 &gt;= threshold, \u0433\u0434\u0435 threshold \u2014 \u043f\u043e\u0440\u043e\u0433 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0410\u0426\u041f \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 VCP, \u0438 \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0434\u043e \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f. \u0415\u0441\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u043b\u043e, \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043f\u043e\u0440\u0442 \u043d\u0438\u0447\u0435\u0433\u043e, \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0446\u0438\u043a\u043b \u0410\u0426\u041f.<\/p>\n<p>  DMA \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u044b \u0441 \u0434\u0432\u0443\u0445 \u0410\u0426\u041f \u0432 \u043e\u0434\u043d\u043e 32-\u0431\u0438\u0442\u043d\u043e\u0435 \u0441\u043b\u043e\u0432\u043e. \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u0442\u0447\u0451\u0442\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u041f\u041e \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043c\u043e\u0433\u043b\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u043e \u00ab\u043a\u0430\u0434\u0440\u0430\u00bb: <\/p>\n<pre><code class=\"cpp\">vcp_buf[0] |= 0x80000000;<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 C#:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b03\/2b5\/d97\/b032b5d976b042139ec4a6cf288e6a7e.jpg\"\/><\/p>\n<p>  \u041e\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u0430 \u0438\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0432 Visual Studio \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u043e\u0434\u0430.<br \/>  \u0415\u0451 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 Github.<\/p>\n<h2>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h2>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Ethernet \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 FreeRTOS.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/10e\/ce4\/594\/10ece459409f4f1795aad5b901d23dc4.jpg\"\/><\/p>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043a \u0432\u0441\u0435\u043c\u0443 \u0446\u0438\u043a\u043b\u0443 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/arktur04\/stm32-habr\">github<\/a>. \u0412\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u044b Nucleo F767ZI \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 IDE Atollic TRUEStudio.<\/p>\n<p>  [1] <a href=\"http:\/\/www.st.com\/content\/ccc\/resource\/technical\/document\/application_note\/group0\/3f\/4c\/a4\/82\/bd\/63\/4e\/92\/CD00211314\/files\/CD00211314.pdf\/jcr:content\/translations\/en.CD00211314.pdf\">AN2834 Application note. How to get the best ADC accuracy in STM32 microcontrollers<\/a><br \/>  [2] <a href=\"http:\/\/www.st.com\/content\/ccc\/resource\/technical\/document\/application_note\/c4\/63\/a9\/f4\/ae\/f2\/48\/5d\/CD00258017.pdf\/files\/CD00258017.pdf\/jcr:content\/translations\/en.CD00258017.pdf\">AN3116 Application note. STM32\u2019s ADC modes and their applications<\/a><br \/>  [3] <a href=\"https:\/\/developer.mbed.org\/media\/uploads\/GregC\/an4373-cookbook_for_sar_adc.pdf\">Cookbook for SAR ADC Measurements. Freescale Semiconductor. AN4373<\/a><\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430\u0445 \u043f\u0440\u043e\u0448\u0443 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u0432 \u043b\u0438\u0447\u043a\u0443. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442.<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/323674\/\"> https:\/\/habrahabr.ru\/post\/323674\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b \u043f\u0440\u043e \u043e\u0441\u043d\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u044b STM32MXCube \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 STM32.<br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/310742\/\">\u0427\u0430\u0441\u0442\u044c 1.<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/312810\/\">\u0427\u0430\u0441\u0442\u044c 2.<\/a><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ee3\/d7e\/3d3\/ee3d7e3d325e4952ab61b4ee9446f619.jpg\"\/><br \/>  \u0412 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043c\u044b \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 GPIO, \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u043c, DMA \u0438 DAC. \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441 ADC \u0438 USB.<\/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-285834","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285834","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=285834"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285834\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}