{"id":336823,"date":"2022-08-09T21:00:19","date_gmt":"2022-08-09T21:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336823"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336823","title":{"rendered":"<span>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b Megawin \u0441\u0435\u0440\u0438\u0438 MG32F02: \u043c\u043e\u0434\u0443\u043b\u0438 UART \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u043a\u043e\u0434\u0430 \u0432 \u041e\u0417\u0423<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Megawin \u043d\u0430 \u044f\u0434\u0440\u0435 Cortex-M0. \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/675776\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b: \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 gcc \u0438 OpenOCD, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 flash-\u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 GPIO. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b: \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 UART, \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u041e\u0417\u0423 \u041c\u041a \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e flash-\u043f\u0430\u043c\u044f\u0442\u0438, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u041c\u041a \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/p>\n<h3>\u041c\u043e\u0434\u0443\u043b\u0438 UART \u041c\u041a MG32F02<\/h3>\n<h4>\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0441\u0435\u0440\u0438\u0438 MG32F02 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 UART: <em>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439<\/em> (URT0-URT2) \u0438 <em>\u0431\u0430\u0437\u043e\u0432\u044b\u0439<\/em> (URT4-URT7). \u0412 \u041c\u041a MG32F02A032 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f URT0 \u0438 URT1. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0435\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c USART, \u0442.\u0435. \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439-\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><em>\u0412\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART<\/em> \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u0443\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u043e 6 \u041c\u0431\u0438\u0442\/\u0441,<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u0438\u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 7 \u0438\u043b\u0438 8 \u0431\u0438\u0442,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f (oversampling) \u043f\u0440\u0438 \u043f\u0440\u0438\u0451\u043c\u0435 \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c 4-32,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438\/\u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430,<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 RX \u0438 TX,<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RX \u0438 TX.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0440\u0435\u0436\u0438\u043c\u0435 SPI (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART) \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0430 URTx_CLK \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 16 \u041c\u0413\u0446 \u0434\u043b\u044f MG32F02A032, 18 \u041c\u0413\u0446 \u0434\u043b\u044f MG32F02A128\/A064 \u0438 MG32F02U128\/U064.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u043c\u043e\u0434\u0443\u043b\u0438 URT0-URT2)<\/h4>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p><em>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 UART<\/em> (\u043c\u043e\u0434\u0443\u043b\u0438 URT0-URT2) \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0436\u0438\u043c\u044b SPI master \u0438 slave, SmartCard, LIN, \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439,<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0438\u0442 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u0435 (MSB \u0438\u043b\u0438 LSB),<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430 0.5, 1, 1.5 \u0438\u043b\u0438 2,<\/p>\n<\/li>\n<li>\n<p>\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 RX \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u043b\u0438 \u0442\u0440\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c,<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 Idle\/RX\/Break\/Calibration,<\/p>\n<\/li>\n<li>\n<p>&#171;\u0432\u0445\u043e\u0434&#187; \u0438 &#171;\u0432\u044b\u0445\u043e\u0434&#187; \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 &#171;mute&#187; \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 4 \u0431\u0430\u0439\u0442\u0430 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440\u0443 \u043a\u0430\u043a 32-\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c (\u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0435\u0439) \u0432 \u0440\u043e\u0434\u0438 \u0432\u0435\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u043b\u0438 \u0432\u0435\u0434\u043e\u043c\u043e\u0433\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 IrDA,<\/p>\n<\/li>\n<li>\n<p>\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RTS \u0438 CTS,<\/p>\n<\/li>\n<li>\n<p>\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u043b\u044f \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RS-485),<\/p>\n<\/li>\n<li>\n<p>\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SmartCard,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 DMA,<\/p>\n<\/li>\n<li>\n<p>\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430 XON\/XOFF.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART \u0432 \u041c\u041a MG32F02A032 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART \u041c\u041a MG32F02A128\/U128\/A064\/U064 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e4d\/1ea\/556\/e4d1ea5563734567e87e07d3000a0590.png\" alt=\"\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART\" title=\"\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART\" width=\"828\" height=\"734\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e4d\/1ea\/556\/e4d1ea5563734567e87e07d3000a0590.png\"\/><figcaption>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 <em>\u0432\u043d\u0435\u0448\u043d\u0438\u0435<\/em> \u0441\u0438\u0433\u043d\u0430\u043b\u044b:<\/p>\n<ul>\n<li>\n<p>URTx_CLK \u2014 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e UART \u0438\u043b\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 SPI,<\/p>\n<\/li>\n<li>\n<p>URTx_RX \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 RX \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 UART \u0438\u043b\u0438 MISO \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI master,<\/p>\n<\/li>\n<li>\n<p>URTx_TX \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 TX \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 UART \u0438\u043b\u0438 MOSI \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI master,<\/p>\n<\/li>\n<li>\n<p>URTx_NSS \u2014 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439\/\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 (chip select) \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI slave\/master \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e,<\/p>\n<\/li>\n<li>\n<p>URTx_CTS \u2014 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c UART CTS,<\/p>\n<\/li>\n<li>\n<p>URTx_RTS \u2014 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c UART RTS,<\/p>\n<\/li>\n<li>\n<p>URTx_DE \u2014 \u0441\u0438\u0433\u043d\u0430\u043b &#171;\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430&#187; \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430,<\/p>\n<\/li>\n<li>\n<p>URTx_BRO \u2014 \u0432\u044b\u0445\u043e\u0434 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430,<\/p>\n<\/li>\n<li>\n<p>URTx_TMO \u2014 \u0432\u044b\u0445\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 TMO.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0443\u0437\u0435\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c <em>Clock Control<\/em>, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b <em>Baud-Rate Generator<\/em>. \u0411\u043b\u043e\u043a <em>Mode Control<\/em> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0436\u0438\u043c\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f. \u0411\u043b\u043e\u043a <em>Data Control<\/em> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u0435\u043c\u043e\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0431\u0449\u0435\u0439 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439. \u0411\u043b\u043e\u043a <em>Receiver Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IrDA. \u0411\u043b\u043e\u043a <em>Transmitter Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IrDA. \u041f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Event Detector<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0431\u043b\u043e\u043a <em>Interrupt Control<\/em> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT_URTx. \u041e\u0431\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0434\u0430\u043b\u0435\u0435. 16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 <em>TMO<\/em> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0436\u0438\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c. \u0422\u0430\u0439\u043c\u0435\u0440 TMO \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f UART, \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c UART \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d.<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Hardware Flow Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RTS\/CTS. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 XON\/XOFF \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0431\u0438\u0442 <code>URTx_TX_HALT<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR2<\/code>).<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Drive Enable Timing Control<\/em>  \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RS-485). \u0411\u043b\u043e\u043a <em>SPI NSS Timing Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c NSS \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SPI. \u0411\u043b\u043e\u043a <em>Multi-Processor Control<\/em> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0430 \u0431\u043b\u043e\u043a <em>Baud-Rate Calibration<\/em> \u0437\u0430 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f UART.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f URTx \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CSC_APB0<\/code> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430 <code>CSC_URTx_EN<\/code> (\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>CSC_KEY<\/code>),<\/p>\n<\/li>\n<li>\n<p>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 <code>URTx_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR0<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/h3>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c <em>Clock Control<\/em> \u041c\u041a MG32F02A128\/U128\/A064\/U064 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4ca\/bfc\/5cc\/4cabfc5cc1fd934d3353b62bd0103d86.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART\" width=\"812\" height=\"598\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4ca\/bfc\/5cc\/4cabfc5cc1fd934d3353b62bd0103d86.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0445 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u043b\u044f <code>URTx_CK_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code> \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445:<\/p>\n<ul>\n<li>\n<p>\u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_PR \u0441 \u0432\u044b\u0445\u043e\u0434\u0430 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f CSC,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0449\u0435\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b CK_LS \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TM00 TM00_TRGO,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044f NCO (Numerically Controlled Oscillator) NCO_P0 (\u043a\u0440\u043e\u043c\u0435 \u041c\u041a MG32F02A032).<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u0433\u043d\u0430\u043b CK_URTx_PR \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_APB \u0438\u043b\u0438 CK_AHB \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u0430 <code>CSC_URTx_CKS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CKS1<\/code>. \u0421\u0438\u0433\u043d\u0430\u043b CK_LS \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 CK_ILRCO, CK_XOSC \u0438\u043b\u0438 CK_EXT \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f <code>CSC_LS_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CR0<\/code> (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/post\/674788\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u0446\u0438\u043a\u043b\u0430).<\/p>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u043a CK_URTx) \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u0430 \u0431\u043b\u043e\u043a <em>BR (Baud-Rate Generator)<\/em>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 6-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b (4-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u041c\u041a MG32F02A032) \u0438 8-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430. \u041f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b URTx_CKO, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_RLR<\/code> \u0432 \u043f\u043e\u043b\u0435 <code>URTx_PSR<\/code> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f <em>Kp<\/em>, \u0430 \u0432 \u043f\u043e\u043b\u0435 <code>URTx_RLR<\/code> \u2014 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 <em>Kc<\/em>. \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0431\u043e\u043b\u044c\u0448\u0435. 8-\u0431\u0438\u0442\u043d\u044b\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a CNT \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_INT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043e\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 TM01_TRGO \u0438\u043b\u0438 TM10_TRGO, \u0438 \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0430 URTx_ECK. \u0412\u044b\u0431\u043e\u0440 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 CK_URTx_TX \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u043c <code>URTx_TX_CKS<\/code>, \u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 CK_URTx_RX \u2014 \u043f\u043e\u043b\u0435\u043c <code>URTx_RX_CKS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code>. \u0414\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_RX \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u0435\u0440\u0435\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (oversampling), \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u043e\u0442\u0441\u0447\u0435\u0442\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u0430 RX \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0448\u0443\u043c\u0430 \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043c\u0435\u043d\u0430 Btx \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <em>Ktxos<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 5-\u0431\u0438\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c <code>URTx_TXOS_NUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR1<\/code>. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043c\u0435\u043d\u0430 Brx \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <em>Krxos<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 5-\u0431\u0438\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c <code>URTx_RXOS_NUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR1<\/code>.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 <em>Btx<\/em> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a<\/p>\n<p><em>Btx<\/em> = <em>Furt<\/em> \/ ( (<em>Kp<\/em>+1)\u00b7(<em>Kc<\/em>+1)\u00b7(<em>Ktxos<\/em>+1) ),<\/p>\n<p>\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 <em>Brx<\/em> \u043a\u0430\u043a<\/p>\n<p><em>Brx<\/em> = <em>Furt<\/em> \/ ( (<em>Kp<\/em>+1)\u00b7(<em>Kc<\/em>+1)\u00b7(<em>Krxos<\/em>+1) ),<\/p>\n<p>\u0433\u0434\u0435 <em>Furt<\/em> \u2014 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_URTx.<\/p>\n<p>\u0411\u043b\u043e\u043a BR \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f UART \u043a\u0430\u043a \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c UART \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 <em>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435<\/em> \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0441\u0447\u0435\u0442\u0447\u0438\u043a (\u0431\u0438\u0442 <code>URTx_BR_MDS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code> \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 1). \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a BR \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0431\u0438\u0442 <code>URTx_BR_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CLK<\/code>.<\/p>\n<h3>\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u0444\u043b\u0430\u0433\u0438, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT_URTx.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p>\u0424\u043b\u0430\u0433\u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0424\u043b\u0430\u0433\u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041e\u0431\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>ERRF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Error flag<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Parity Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">PEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438\/\u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Frame Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">FEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Data Overrun<\/p>\n<\/td>\n<td>\n<p align=\"left\">ROVRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Noised Character<\/p>\n<\/td>\n<td>\n<p align=\"left\">NCEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0448\u0443\u043c \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0431\u0438\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">TX Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">TXEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043a\u0430\u0434\u0440\u0430 (\u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430) \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u043e\u0432 SmartCard \u0438 LIN<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Transmit data underrun<\/p>\n<\/td>\n<td>\n<p align=\"left\">TUDRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SPI<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TMO<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>ERRF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Error flag<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">RXTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043f\u0440\u0438\u0435\u043c\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_RXTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Idle Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">IDTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043b\u0438\u043d\u0438\u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_IDTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Break Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">BKTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#171;Break&#187; \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_BKTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Calibration Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">CALTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_CALTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041e\u0431\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>UGF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">UART general event<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Slave Address Match<\/p>\n<\/td>\n<td>\n<p align=\"left\">SADRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0438\u043d\u044f\u0442 \u043a\u0430\u0434\u0440 \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Baud-Rate Timer Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">BRTF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 BR (Baud-Rate Timer)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Timeout Timer Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">TMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TMO (Timeout Timer)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Calibration Complete<\/p>\n<\/td>\n<td>\n<p align=\"left\">CALCF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u0442\u0430\u0442\u0443\u0441 \u043b\u0438\u043d\u0438\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>LSF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Line status<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Break Condition Detect<\/p>\n<\/td>\n<td>\n<p align=\"left\">BKF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 &#171;Break&#187; (\u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0431\u0438\u0442\u043e\u0432)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Idle Line Detect<\/p>\n<\/td>\n<td>\n<p align=\"left\">IDLF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0434\u0435\u0440\u0436\u0430\u043d &#171;Idle&#187; \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CTS Change<\/p>\n<\/td>\n<td>\n<p align=\"left\">CTSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CTS \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">NSS Change<\/p>\n<\/td>\n<td>\n<p align=\"left\">NSSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 NSS \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SPI slave<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Receive Data<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>RXF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0438\u043d\u044f\u0442\u044b \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_RDAT<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Transmit Data<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>TXF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_TDAT<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Transfer Complete<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>TCF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0435\u043d\u0435\u0432\u043e\u0439 \u0431\u0443\u0444\u0435\u0440<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0441\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT_URTx <em>Interrupt Control<\/em> \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 UART, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0444\u043b\u0430\u0433\u043e\u0432 (\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 <code>URTx_STA<\/code> \u0438 <code>URTx_STA2<\/code>).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/23b\/8bb\/f68\/23b8bbf6879e7ff6d7991362d8ce3fde.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART\" width=\"725\" height=\"614\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/23b\/8bb\/f68\/23b8bbf6879e7ff6d7991362d8ce3fde.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART<\/figcaption><\/figure>\n<p>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f <em>UART General Event<\/em> (UG), <em>Line Status Event<\/em> (LS) \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 <em>Error Event<\/em> (ERR), \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6b7\/1ba\/0fa\/6b71ba0fa316d7ea00ff90d59e0a47f3.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f UART General\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f UART General\" width=\"694\" height=\"570\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6b7\/1ba\/0fa\/6b71ba0fa316d7ea00ff90d59e0a47f3.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f UART General<\/figcaption><\/figure>\n<p>\u0421\u0442\u0430\u0442\u0443\u0441\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044e, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_STA<\/code>. \u0421\u0442\u0430\u0442\u0443\u0441\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438, \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f\u043c, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_STA2<\/code>, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u043b\u0430\u0433\u0430 <code>RXDF<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_STA<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0444\u043b\u0430\u0433\u043e\u0432, \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0434\u0432\u0435 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0442\u0440\u0435\u0445\u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435: <code>TX_LVL<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442 \u0432 \u0431\u0443\u0444\u0435\u0440\u0435, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0438 <code>RX_LVL<\/code> \u2014 \u0447\u0438\u0441\u043b\u043e \u043d\u0435\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430. \u041e\u0431\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 <code>URTx_STA2<\/code>.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (\u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f) \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_INT<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e \u043f\u0440\u0438\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 <code>URTx_RX_IE<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0431\u0438\u0442\u0430 <code>URTx_IEA<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_INT<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 IRQ \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f URTx \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 NVIC \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CPU_ISER<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u0442 URT0 (IRQ#20) \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 20.<\/p>\n<\/li>\n<\/ol>\n<h3>\u041f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e UART. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432 \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0411\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e26\/575\/acf\/e26575acf8586afcf60051d8bc853bea.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART\" width=\"783\" height=\"690\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e26\/575\/acf\/e26575acf8586afcf60051d8bc853bea.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART<\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430 <em>\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/em> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 <code>URTx_TX_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR2<\/code>. \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_TDAT<\/code>. \u0412 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u044d\u0442\u043e\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 32-\u0431\u0438\u0442\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e 1, 2 \u0438\u043b\u0438 \u0441\u0440\u0430\u0437\u0443 4 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 (\u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>STRB<\/code>, <code>STRH<\/code> \u0438\u043b\u0438 <code>STR<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e). \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0442\u0440\u0435\u0445 \u0431\u0430\u0439\u0442 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c <code>URTx_TDAT3<\/code> (\u0442\u043e\u043b\u044c\u043a\u043e \u0432 32-\u0431\u0438\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0442.\u0435. \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>STR<\/code>).<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0432 \u043b\u0438\u043d\u0438\u044e TX \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 &#171;\u0442\u0435\u043d\u0435\u0432\u043e\u0439&#187; \u0431\u0443\u0444\u0435\u0440 <em>TX Shadow Buffer<\/em>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 <strong>TXF<\/strong>, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u043f\u0440\u043e\u0441\u0430 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438. \u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_TDAT<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433. \u041e\u0441\u0442\u0430\u0432\u0448\u0435\u0435\u0441\u044f \u0447\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442, \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_TDAT<\/code> \u0432 \u0442\u0435\u043d\u0435\u0432\u043e\u0439 \u0431\u0443\u0444\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u043e\u043b\u044f <code>URTx_TNUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR4<\/code>. \u0427\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442, \u0435\u0449\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043b\u0438\u043d\u0438\u044e TX \u0438\u0437 \u0442\u0435\u043d\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <code>URTx_TX_LVL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_STA2<\/code>. \u041a\u043e\u0433\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_TDAT<\/code> \u0438 \u0442\u0435\u043d\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 <strong>TCF<\/strong>, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0432 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_TDAT<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <code>URTx_TNUM<\/code> \u0438\u043b\u0438 <code>URTx_TX_LVL<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0444\u043b\u0430\u0433 <strong>TXF<\/strong> \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 (\u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f) \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0431\u0440\u043e\u0448\u0435\u043d. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043f\u0443\u0441\u0442\u0443\u044e \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430 <em>\u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/em> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 <code>URTx_RX_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR2<\/code>. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441 \u043b\u0438\u043d\u0438\u0438 RX \u0438\u0437 \u0441\u0434\u0432\u0438\u0433\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <em>RX Shuft Buffer<\/em> \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u0435\u043c\u043d\u044b\u0439 \u0442\u0435\u043d\u0435\u0432\u043e\u0439 \u0431\u0443\u0444\u0435\u0440 <em>RX Shadow Buffer<\/em>. \u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u2014 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_RDAT<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 <strong>RXF<\/strong>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u043c \u0442\u0435\u043d\u0435\u0432\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 <strong>ROVRF<\/strong> (\u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430). \u0427\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0438\u0437 \u0442\u0435\u043d\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <code>URTx_RX_LVL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_STA2<\/code>. \u0427\u0438\u0441\u043b\u043e \u0431\u0430\u0439\u0442, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0442\u0435\u043d\u0435\u0432\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_RDAT<\/code> \u0438 \u0435\u0449\u0435 \u043d\u0435\u0432\u043e\u0441\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <code>URTx_RNUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR4<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0434\u0443\u043b\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442 \u0444\u043b\u0430\u0433 <strong>RXF<\/strong> \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_RDAT<\/code>. \u0412 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u044d\u0442\u043e\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0442\u0430\u043a\u0436\u0435 32-\u0431\u0438\u0442\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c 1, 2 \u0438\u043b\u0438 4 \u0431\u0430\u0439\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0444\u043b\u0430\u0433 <strong>RXF<\/strong> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u0442 \u043a\u0430\u0434\u0440\u0430 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR1<\/code>. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0435\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435. \u0421\u0438\u043c\u0432\u043e\u043b\u043e\u043c &#171;*&#187; \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u0444\u043e\u0440\u043c\u0430\u0442 8N1).<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/p>\n<\/th>\n<th>\n<p>\u041f\u0440\u0438\u0435\u043c\u043d\u0438\u043a<\/p>\n<\/th>\n<th>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a<\/p>\n<\/th>\n<th>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440, \u0431\u0438\u0442<\/p>\n<\/th>\n<th>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u043b\u0438\u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_RXDSIZE<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_TXDSIZE<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">0(*) &#8212; 8 \u0431\u0438\u0442,1 &#8212; 7 \u0431\u0438\u0442,2,3 &#8212; \u0440\u0435\u0437\u0435\u0440\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\/\u043d\u0435\u0447\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_RXPAR_EN<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_TXPAR_EN<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0(*) &#8212; \u043d\u0435\u0442,1 &#8212; \u0435\u0441\u0442\u044c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u043e\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\/\u043d\u0435\u0447\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_RXPAR_POL<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_TXPAR_POL<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">1<\/p>\n<\/td>\n<td>\n<p align=\"left\">0(*) &#8212; \u0447\u0435\u0442,1 &#8212; \u043d\u0435\u0447\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0414\u043b\u0438\u043d\u0430 \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_RXSTP_LEN<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>URTx_TXSTP_LEN<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">0 &#8212; 0.5 \u0431\u0438\u0442,1(*) &#8212; 1 \u0431\u0438\u0442,2 &#8212; 1.5 \u0431\u0438\u0442\u0430,3 -2 \u0431\u0438\u0442\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u043c\u043e\u0434\u0443\u043b\u0438 URT4-URT7)<\/h4>\n<p><em>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 UART<\/em> (URT4-URT7) \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b UART,<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430 1 \u0438\u043b\u0438 2,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 1 \u0431\u0430\u0439\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/88f\/fe8\/6e6\/88ffe86e6e7faaa0278a74c9586aa3e1.png\" alt=\"\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART\" title=\"\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART\" width=\"772\" height=\"496\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/88f\/fe8\/6e6\/88ffe86e6e7faaa0278a74c9586aa3e1.png\"\/><figcaption>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442:<\/p>\n<ul>\n<li>\n<p>\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RTS\/CTS,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430,<\/p>\n<\/li>\n<li>\n<p>\u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 TMO \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432,<\/p>\n<\/li>\n<li>\n<p>\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 DMA.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa4\/7a5\/c06\/aa47a5c06d0a6bb5c11eb98d09340b27.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART\" width=\"816\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa4\/7a5\/c06\/aa47a5c06d0a6bb5c11eb98d09340b27.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u0418\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b <em>Baud-Rate Generator<\/em>. \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443 UART.<\/p>\n<p>\u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044e: <strong>UGF<\/strong>, <strong>TCF<\/strong>, <strong>ERRF<\/strong>,  <strong>RXF<\/strong>, <strong>TXF<\/strong>, <strong>BRTF<\/strong>, <strong>PEF<\/strong>, <strong>FEF<\/strong>, <strong>ROVRF<\/strong>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 <strong>PAR<\/strong> \u0438 <strong>BUSYF<\/strong>.<\/p>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f23\/9d8\/e3c\/f239d8e3cd27dd75ec5923a4f4f7659c.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART\" width=\"781\" height=\"354\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f23\/9d8\/e3c\/f239d8e3cd27dd75ec5923a4f4f7659c.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART<\/figcaption><\/figure>\n<p>\u0411\u043b\u043e\u043a\u0438 \u043f\u0440\u0438\u0435\u043c\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0442\u0435\u043d\u0435\u0432\u044b\u0435 \u0431\u0443\u0444\u0435\u0440\u044b, \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0444\u043b\u0430\u0433\u0438, \u0441 \u043d\u0438\u043c\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044b <code>URTx_TDAT<\/code> \u0438 <code>URTx_RDAT<\/code> 8-\u0431\u0438\u0442\u043d\u044b\u0435 \u0438 \u0438\u043c\u0435\u044e\u0442 \u043b\u0438\u0448\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f. \u0424\u043e\u0440\u043c\u0430\u0442 \u043a\u0430\u0434\u0440\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443.<\/p>\n<p>\u0412\u0441\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u043f\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0443, \u0430\u0434\u0440\u0435\u0441\u0443 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 UART.<\/p>\n<h3>\u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h3>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0435 \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u041c\u041a MG32F02A032 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 D2 \u0434\u043b\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#171;Hard Fault&#187;. \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u043e\u0433\u043e \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 Z1 \u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 12 \u041c\u0413\u0446 (\u0442\u0438\u043f HC49S, \u0421=30 \u043f\u0424). \u041d\u043e\u043c\u0438\u043d\u0430\u043b\u044b \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440\u043e\u0432 C5,C6 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u0443 \u043d\u0430 \u041c\u041a. \u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432\u044b\u0432\u043e\u0434\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u0430 UART. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u041f\u041a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 UART-USB \u0430\u0434\u0430\u043f\u0442\u0435\u0440, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 FTDI, CH340, \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043f\u0430\u044f\u0442\u044c \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0441\u0442\u0430 MA112 \u043e\u0442 Megawin (\u0435\u0441\u0442\u044c \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 SOP16). \u041f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043b\u043e\u0433. &#171;1&#187; \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0435 RXD \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u041c\u041a 3,3 \u0412. \u0412\u044b\u0432\u043e\u0434 \u041c\u041a RXD \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u0432\u044b\u0445\u043e\u0434\u0443 TX \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u043e\u0440\u0442\u0430, \u0430 \u0432\u044b\u0432\u043e\u0434 \u041c\u041a TXD \u2014 \u043a \u0432\u0445\u043e\u0434\u0443 RX \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1f9\/18d\/fec\/1f918dfecf334e897962ec666416587a.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u041c\u041a MG32F02A032\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u041c\u041a MG32F02A032\" width=\"890\" height=\"438\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f9\/18d\/fec\/1f918dfecf334e897962ec666416587a.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u041c\u041a MG32F02A032<\/figcaption><\/figure>\n<h3>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c UART<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 UART \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0431\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u041c\u041a MG32F02A032, \u0432 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 UART. \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043d\u0430 \u0431\u0430\u0437\u043e\u0432\u043e\u043c UART \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u041c\u041a.<\/p>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0440\u0442\u0430 UART \u0441 \u043d\u043e\u043c\u0435\u0440\u043e\u043c <code>port_no<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>uart_init()<\/code>:<\/p>\n<pre><code class=\"cpp\">void uart_init(uint8_t port_no) {   register uint32_t da=(uint32_t)port_no*0x10000;    \/\/ Pins:   switch (port_no) {     case 0:       *(volatile uint16_t*)PC_CR0_h0 = (0xA &lt;&lt; 12) | 2; \/\/ PC0 -> URT0_TX, push pull output       *(volatile uint16_t*)PC_CR1_h0 = (0xA &lt;&lt; 12) | (1 &lt;&lt; 5) | 3; \/\/ PC1 -> URT0_RX, pull-up resister enable, digital input       break;     case 1:       *(volatile uint16_t*)PB_CR10_h0 = (0x7 &lt;&lt; 12) | 2; \/\/ PB10 -> URT1_TX, push pull output       *(volatile uint16_t*)PB_CR11_h0 = (0x7 &lt;&lt; 12) | (1 &lt;&lt; 5) | 3; \/\/ PB11 -> URT1_RX, pull-up resister enable, digital input       break;   }    \/\/ Clock source:   *((volatile uint16_t*)CSC_KEY_h0) = 0xA217; \/\/ unlock access to CSC regs   \/\/ (0x4C010022)   *(volatile uint16_t*)CSC_APB0_h1 = (1 &lt;&lt; port_no); \/\/ CSC_URTx_EN = 1    \/\/ Leave default APB clock settings: CSC_URTx_CKS (bit 16) = CK_APB (0)   \/\/*(volatile uint32_t*)CSC_CKS1_w = 0;   *((volatile uint16_t*)CSC_KEY_h0) = 0x1111; \/\/ lock access to CSC regs    \/\/ UART Global Enable (0x52000010)   *(volatile uint32_t*)(URT0_CR0_w+da) = 1; \/\/ URTx_EN = 1    \/\/ Frame format (0x52000014)   *(volatile uint32_t*)(URT0_CR1_w+da) =       (3 &lt;&lt; 24) | \/\/ URT0_TXOS_NUM --- TX data oversampling samples select. The valid value is from 3 to 31 for oversampling samples from 4 to 32.       (3 &lt;&lt; 8) | \/\/ URT0_RXOS_NUM --- RX data oversampling samples select. The valid value is from 3 to 31 for oversampling samples from 4 to 32.       (1 &lt;&lt; 22) | (0 &lt;&lt; 18) | (0 &lt;&lt; 17) | (1 &lt;&lt; 6); \/\/ tx_stopbit=1, parity=off, 8 bits, rx_stopbit=1    \/\/ Baud (assume CK_URT0 = 12 MHz ) (0x52000024)   *(volatile uint16_t*)(URT0_RLR_w+da) =        (1 &lt;&lt; 8) | \/\/ URT0_PSR        12; \/\/ URT0_RLP    \/\/ Result: 115200 baud    \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c Baud-Rate Generator, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 \u043d\u0435\u0433\u043e (CK_URTx_INT)   *(volatile uint32_t*)(URT0_CLK_w+da) = (1 &lt;&lt; 24); \/\/ URT0_BR_EN = 1    \/\/ Settings (0x52000018)   *(volatile uint32_t*)(URT0_CR2_w+da) = (1 &lt;&lt; 3) | (1 &lt;&lt; 2) ; \/\/ URT0_TX_EN=1 , URT0_RX_EN=1  } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0441\u0435\u0440\u0438\u0438 MG32F02 \u0432\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 URT \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c 0x520n0000, \u0433\u0434\u0435 n \u2014 \u043d\u043e\u043c\u0435\u0440 URTn, \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0441 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 n=0-2,4-7 (URT3 \u0432 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u041c\u041a \u0441\u0435\u0440\u0438\u0438 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u0435\u0435 \u0432 \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c \u0432\u0438\u0434\u0430 <code>(URT0_CR0_w+da)<\/code>, \u0433\u0434\u0435 <code>da=port_no*0x10000<\/code>.<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 RXD (\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0432\u0445\u043e\u0434 \u0441 \u043f\u043e\u0434\u0442\u044f\u0436\u043a\u043e\u0439) \u0438 TXD (push-pull \u0432\u044b\u0445\u043e\u0434). \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043c\u043e\u0434\u0443\u043b\u044f 0 \u0438 1. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c. \u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0432\u044b\u0432\u043e\u0434\u044b RXD0 \u0438 TXD0. \u0412\u044b\u0432\u043e\u0434\u044b \u043c\u043e\u0434\u0443\u043b\u044f 1 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435: RXD1 \u2014 PB11, TXD1 \u2014 PB10.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CSC_APB0<\/code>. \u0417\u0434\u0435\u0441\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <code>(1 &lt;&lt; port_no)<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0431\u0438\u0442\u044b, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f URT0-URT7, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_PR \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_APB \u0448\u0438\u043d\u044b APB, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u043e\u043b\u0435 <code>URTx_CK_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code> \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 0, \u0432 \u043f\u043e\u043b\u0435 <code>CSC_URTx_CKS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CKS1<\/code> \u0442\u0430\u043a\u0436\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR0<\/code> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0431\u0438\u0442\u0430 0. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430. \u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u0445 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>URTx_PSR<\/code> ( <em>Kp<\/em> ) \u2014 0-15 \u0434\u043b\u044f MG32F02A032, 0-63 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u041c\u041a;<\/p>\n<\/li>\n<li>\n<p><code>URTx_RLR<\/code> ( <em>Kc<\/em> ) \u2014 0-255;<\/p>\n<\/li>\n<li>\n<p><code>URTx_TXOS_NUM<\/code> ( <em>Ktxos<\/em> ) \u0438 <code>URTx_RXOS_NUM<\/code> ( <em>Krxos<\/em> ) \u2014 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 3-31.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 User Guide (\u0441. 290) \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0445 \u0447\u0430\u0441\u0442\u043e\u0442 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 DFP \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>MID_URT_SetConfig()<\/code> \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 runtime, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0443\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f 12 \u041c\u0413\u0446 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430 115200 \u0431\u0438\u0442\/\u0441: <em>Kp<\/em>= 1, <em>Kc<\/em>= 12, <em>Ktxos<\/em>= 3, <em>Krxos<\/em>= 3. \u0420\u0430\u0441\u0447\u0435\u0442\u043d\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 115385 \u0431\u0438\u0442\/\u0441, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e 0,16 %. \u0414\u0430\u043b\u0435\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u043b\u043e\u043a BR  \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0431\u0438\u0442\u0430 <code>URTx_BR_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CLK<\/code>.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0443\u0437\u043b\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR2<\/code>. \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043a\u0430\u0434\u0440\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (8N1).<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"cpp\">void uart_tx(uint8_t port_no, uint8_t d) {   register uint32_t da=(uint32_t)port_no*0x10000;   while ( (*(volatile uint8_t*)(URT0_STA2_b3+da) &amp; 0x70)); \/\/ \u0436\u0434\u0435\u043c, \u043f\u043e\u043a\u0430 URT0_TX_LVL != 0   *(volatile uint8_t*)(URT0_TDAT_b0+da) = d;   \/\/ \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0431\u0430\u0439\u0442 (0x52000034) &lt;= d } <\/code><\/pre>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u043d\u0435\u0432\u043e\u0439 \u0431\u0443\u0444\u0435\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c (\u043f\u043e\u043b\u0435 <code>URTx_TX_LVL<\/code>), \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>URTx_TDAT<\/code>. \u042d\u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0430 \u043d\u0435 \u0444\u0430\u043a\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0431\u0430\u0439\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"cpp\">uint8_t uart_rx(uint8_t port_no) {   register uint32_t da=(uint32_t)port_no*0x10000;   while ( (*(volatile uint8_t*)(URT0_STA_b0+da) &amp; 0x40) ==0); \/\/ waiting URT0_RXF==1   return *(volatile uint8_t*)(URT0_RDAT_b0+da); } <\/code><\/pre>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0430\u043a\u0442\u0438\u0432\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433 <strong>RXF<\/strong>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_RDAT<\/code>. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0435 \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0438 \u043f\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044e \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0433\u043e\u0442\u043e\u0432\u0430. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"cpp\">void uart_send(uint8_t port_no, void* buf, uint32_t len) {   uint32_t i;   for (i=0; i&lt;len; i++) uart_tx(port_no, *((uint8_t*)buf+i)); }   void uart_puts(uint8_t port_no, const char* s, uint32_t newline) {   uint32_t i;   uint8_t b;   for (i=0; s[i]!=0; i++) {     uart_tx(port_no, s[i]);   }   for (i=2; i; i--) {     b=(newline &amp; 0xFF);     if (b) uart_tx(port_no, b); else break;     newline >>= 8;   } } <\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>uart_send()<\/code> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 UART \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0435\u0435 \u0434\u043b\u0438\u043d\u044b. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>uart_puts()<\/code> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0421\u0438-\u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u043c \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u0438\u043c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437 1-2 \u0431\u0430\u0439\u0442 (\u0441\u0438\u043c\u0432\u043e\u043b &#171;\u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438&#187;) \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c (\u0441\u043c. \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b <code>uart.h<\/code>):<\/p>\n<pre><code class=\"cpp\">#define UART_NEWLINE_NONE 0x00000000 #define UART_NEWLINE_LF   0x0000000A #define UART_NEWLINE_CR   0x0000000D #define UART_NEWLINE_CRLF 0x00000A0D #define UART_NEWLINE_LFCR 0x00000D0A <\/code><\/pre>\n<h3>\u041c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u041e\u0417\u0423<\/h3>\n<p>\u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432\u043e flash-\u043f\u0430\u043c\u044f\u0442\u044c \u041c\u041a \u0432\u0441\u0435\u0439 &#171;\u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438&#187;, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0438\u043b\u0438 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442. \u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430 \u2014 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u043d\u0435 \u043d\u0430\u0434\u043e \u043e\u0441\u043e\u0431\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0434 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u043e\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432 IDE (Compile\/Build\/Flash) \u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043d\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u0430\u0436\u0435\u043d\u043d\u0430\u044f &#171;\u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430&#187;, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0438\u0437\u0434\u0435\u043b\u0438\u0435.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 &#171;\u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435&#187; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u0435\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0447\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0438\u0437\u043d\u043e\u0441 flash-\u043f\u0430\u043c\u044f\u0442\u0438. \u0418\u0437\u043d\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043d\u0438\u0437\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432 \u041f\u041e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u043d\u043e\u0432\u043e\u0439 \u0438 \u0432\u044b\u0434\u0430\u0447\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0430 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u0434, \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u0442\u0435\u0440\u0442\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442. \u041f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 &#171;\u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438&#187; \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0438 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0445\u043e\u0442\u044f \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 ARM-\u044f\u0434\u0440\u0430\u0445 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0438\u0437-\u0437\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 JTAG\/SWD.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0426\u041f\u0423 Cortex-M0 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 flash-\u043f\u0430\u043c\u044f\u0442\u0438, \u043d\u043e \u0438 \u0438\u0437 \u041e\u0417\u0423, \u043d\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u041e\u0417\u0423. \u0421\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u0432\u043e flash-\u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c &#171;\u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438&#187;, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0443\u0436\u0435 \u043e\u0442\u043b\u0430\u0436\u0435\u043d\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430. \u041f\u043e\u0441\u043b\u0435 \u0441\u0431\u0440\u043e\u0441\u0430 \u041c\u041a \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438 \u0432 \u041e\u0417\u0423 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0451 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435. \u041e\u0431\u0440\u0430\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u041e\u0417\u0423 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 SWD-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0432 \u041c\u041a \u043e\u0431\u0440\u0430\u0437\u0430:<\/p>\n<ul>\n<li>\n<p>\u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c <em>supervisor<\/em> (\u043a\u0440\u0430\u0442\u043a\u043e <code>svr<\/code>),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c <em>application<\/em> (\u043a\u0440\u0430\u0442\u043a\u043e <code>app<\/code>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 AP \u0438\u043b\u0438 ISP, \u043c\u043e\u0436\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0432\u043e flash-\u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0443\u0442\u043b\u043e\u0430\u0434\u0435\u0440\u0430 (\u043a\u043e\u0434\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 ISP). \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u041c\u041a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u0432 \u0447\u0430\u0441\u0442\u0438 <code>svr<\/code>, \u0442\u0430\u043a \u0438 \u0432 <code>app<\/code>.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u041e\u0417\u0423 \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ul>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0438\u0437\u043d\u043e\u0441 flash-\u043f\u0430\u043c\u044f\u0442\u0438 \u041c\u041a \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u041c\u041a),<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438,<\/p>\n<\/li>\n<li>\n<p>\u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0438 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c &#171;\u0441 \u0437\u0430\u043f\u0430\u0441\u043e\u043c&#187; \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u041e\u0417\u0423.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u0447\u0430\u0441\u0442\u0435\u0439 <code>svr<\/code> \u0438 <code>app<\/code> \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u0436\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432) \u0438 \u043f\u0440\u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0435 \u043e\u0434\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0430\u0434\u0440\u0435\u0441\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>svr<\/code> \u0438\u0437 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <code>app<\/code> \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0437\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438),<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c <code>svr<\/code> \u0447\u0430\u0441\u0442\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b <code>app<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c <code>app<\/code> \u0447\u0430\u0441\u0442\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b <code>svr<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u041e\u0417\u0423 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u0435\u0438\u043c\u0438 \u0447\u0430\u0441\u0442\u044f\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0435\u043a\u043e\u043c \u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e DMA.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<h4>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c (Supervisor)<\/h4>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0437\u0430\u0434\u0430\u0447\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 <em>\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/em>, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u043a\u043d\u0438\u0433\u0435 \u0414\u0436\u043e\u0437\u0435\u0444\u0430 \u042e &#171;The Definitive Guide to ARM \u00ae Cortex \u00ae -M0 and Cortex-M0+ Processors. Second Edition&#187;. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f SVCall. \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0443\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0448\u0438\u043d\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>SVC<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0442 0 \u0434\u043e 255. \u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0438\u043b\u0438 \u0441\u0442\u0435\u043a.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 megawin, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/675776\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0446\u0438\u043a\u043b\u0430. \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c <code>svr<\/code> \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<ul>\n<li>\n<p><code>startup.c<\/code> \u2014 \u043a\u043e\u0434 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0438 \u0447\u0430\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>init.c<\/code> \u2014 \u043a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u041c\u041a;<\/p>\n<\/li>\n<li>\n<p><code>svr.c<\/code> \u2014 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 (\u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439);<\/p>\n<\/li>\n<li>\n<p><code>main.c<\/code> \u2014 \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>main()<\/code>;<\/p>\n<\/li>\n<li>\n<p><code>ulib.h<\/code> \u0438 <code>ulib.c<\/code> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>api.h<\/code> \u2014 \u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (API), \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0424\u0430\u0439\u043b\u044b <code>startup.c<\/code> \u0438 <code>init.c<\/code> \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0440\u0430\u043d\u0435\u0435 \u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 (\u0441\u0443\u043f\u0435\u0440\u0432\u0438\u0437\u043e\u0440\u0430) <code>svr.c<\/code>:<\/p>\n<pre><code class=\"cpp\">#include \"svr.h\" #include \"api.h\" #include \"ulib.h\" #include \"MG32x02z__RegAddress.h\"   \/\/\/ IRQ Handler type typedef void(*handler_t)();  \/\/\/ IRQ Handlers volatile handler_t hdlr[32];   __attribute__ ((naked)) void HardFault_Handler() {   \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c \u043d\u0430 PB3   *(volatile uint16_t*)PB_CR3_h0 = 0x0002; \/\/ PB3 -> push-pull output   while (1) {     *(volatile uint16_t*)PB_SC_h0 = 0x0008; \/\/ set bit 3     delay_ms(100);     *(volatile uint16_t*)PB_SC_h1 = 0x0008; \/\/ clear bit 3     delay_ms(100);   } }   __attribute__ ((naked)) void SVC_Handler() { \/\/ From Yiu J.: \/\/ Stack frame contains: \/\/ r0, r1, r2, r3, r12, r14, the return address and xPSR \/\/ - Stacked R0 = svc_args[0] \/\/ - Stacked R1 = svc_args[1] \/\/ - Stacked R2 = svc_args[2] \/\/ - Stacked R3 = svc_args[3] \/\/ - Stacked R12 = svc_args[4] \/\/ - Stacked LR = svc_args[5] \/\/ - Stacked PC = svc_args[6] \/\/ - Stacked xPSR= svc_args[7]   \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e MSP, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0431\u0438\u0442\u0430 2 LR \u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c   asm(     \"mrs    r0,msp\\n\"     \"b      SVC_Handler_main\\n\"   ); }   \/\/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 __attribute__ ((interrupt)) void SVC_Handler_main(uint32_t* sp) {   switch ( ((uint8_t*)sp[6])[-2] ) {     case SVC_HANDLER_UNSET:   hdlr[sp[0]]=0; break;     case SVC_HANDLER_SET:     hdlr[sp[0]]=sp[1]; break;   } }   __attribute__ ((interrupt)) void URT0_IRQHandler() {   if (hdlr[20]) hdlr[20](); }   __attribute__ ((interrupt)) void URT123_IRQHandler() {   if (hdlr[21]) hdlr[21](); } <\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f <code>handler_t<\/code> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 <code>hdlr<\/code> \u0438\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 ISR (32). \u0422\u0438\u043f \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 <code>svr.c<\/code>.<\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>SVC im8<\/code> ( <code>im8<\/code> \u2014 8-\u0431\u0438\u0442\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u0432\u044b\u0437\u043e\u0432\u0430) \u044f\u0434\u0440\u043e Cortex-M0 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 <em>\u0444\u0440\u0435\u0439\u043c \u0441\u0442\u0435\u043a\u0430<\/em>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 <code>R0<\/code>, <code>R1<\/code>, <code>R2<\/code>, <code>R3<\/code>, <code>R12<\/code>, <code>LR<\/code> (<code>R14<\/code>), <code>PC<\/code> \u0438 <code>xPSR<\/code> (\u0444\u043b\u0430\u0433\u043e\u0432\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>LR<\/code> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u0434\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EXC_RETURN, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <code>SVC_Handler()<\/code>. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0444\u043b\u0430\u0433\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0442 2, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>0 \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0435\u043a \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e <code>MSP<\/code> (Main Stack Pointer),<\/p>\n<\/li>\n<li>\n<p>1 \u2014 \u0441\u0442\u0435\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e <code>PSP<\/code> (Process Stack Pointer).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>PC<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>LR<\/code>: \u0426\u041f\u0423, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 EXC_RETURN, &#171;\u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442&#187;, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0430 0xFFFFFFF*, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438), \u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u0438\u0437 <em>\u0444\u0440\u0435\u0439\u043c\u0430 \u0441\u0442\u0435\u043a\u0430<\/em>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>PC<\/code>, \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u0435\u0440\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f. \u0422\u0430\u043a\u043e\u0439 &#171;\u0442\u0440\u044e\u043a&#187; \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0444\u043e\u0440\u043c\u043b\u044f\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043d\u0430 \u0421\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0442\u0435\u043a \u0437\u0430\u0434\u0430\u0447 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>SVC_Handler()<\/code> (\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a <code>naked<\/code>) \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f <em>\u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e<\/em> \u0441\u0442\u0435\u043a\u0430 <code>MSP<\/code> \u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0421\u0438-\u043a\u043e\u0434\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>R0<\/code> (\u0431\u0435\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0431\u0438\u0442\u0430 2 \u0432 EXC_RETURN) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f SVCall \u2014  \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>SVC_Handler_main(uint32_t* sp)<\/code>. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>R0<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u0442\u0435\u043a\u0430, \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u043d\u0430\u0434\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0444\u0440\u0435\u0439\u043c\u0443 \u0441\u0442\u0435\u043a\u0430. \u041d\u043e\u043c\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 Thumb \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043c\u043b\u0430\u0434\u0448\u0438\u043c \u0431\u0430\u0439\u0442\u043e\u043c \u043a\u043e\u0434\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>SVC<\/code> \u0438 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043a\u0430\u043a <code>sp[6])[-2]<\/code>. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0432\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>api.h<\/code>:<\/p>\n<pre><code class=\"cpp\">#include &lt;stdint.h>  #define APP_ORIGIN      0x20000000 #define APP_SIGNATURE   0x46c046c0  #define SVC1(no,arg0)                 asm(\"mov r0,%0\\n\" \"svc %1\\n\" :: \"r\"(arg0), \"I\"(no) : \"r0\") #define SVC2(no,arg0,arg1)            asm(\"mov r0,%0\\n\" \"mov r1,%1\\n\" \"svc %2\\n\" :: \"r\"(arg0), \"r\"(arg1), \"I\"(no) : \"r0\",\"r1\") #define SVC3(no,arg0,arg1,arg2)       asm(\"mov r0,%0\\n\" \"mov r1,%1\\n\" \"mov r2,%2\\n\" \"svc %3\\n\" :: \"r\"(arg0), \"r\"(arg1), \"r\"(arg2), \"I\"(no) : \"r0\",\"r1\",\"r2\") #define SVC4(no,arg0,arg1,arg2,arg3)  asm(\"mov r0,%0\\n\" \"mov r1,%1\\n\" \"mov r2,%2\\n\" \"mov r3,%3\\n\" \"svc %4\\n\" :: \"r\"(arg0), \"r\"(arg1), \"r\"(arg2), \"r\"(arg3), \"I\"(no) : \"r0\",\"r1\",\"r2\",\"r3\")   \/\/\/ syscalls enum IOSystemCalls {   SVC_HANDLER_UNSET =                  0,   SVC_HANDLER_SET   =                  1 }; <\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 <code>SVC_HANDLER_UNSET<\/code> (0) \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0439. \u041d\u043e\u043c\u0435\u0440 IRQ \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>R0<\/code>. \u0412\u044b\u0437\u043e\u0432 <code>SVC_HANDLER_SET<\/code> (1) \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>R1<\/code>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043c\u0430\u043a\u0440\u043e\u0441\u044b <code>SVC1()<\/code> &#8212; <code>SVC4()<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 1-4 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>svr.c<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 <code>URT0_IRQHandler()<\/code> \u0438 <code>URT123_IRQHandler()<\/code>. \u0415\u0441\u043b\u0438 \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u0437\u0430\u0434\u0430\u043d \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u0438\u0437 \u0447\u0430\u0441\u0442\u0438 <code>app<\/code>), \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432. <em>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/em> \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438 <code>.bss<\/code> \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f (\u043d\u0443\u043b\u0435\u043c), \u0442\u0430\u043a \u0447\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u0434\u043e \u0434\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0434\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f).<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 <code>svr.c<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f HardFault, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 D2 \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 5 \u0413\u0446, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043f\u0440\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0424\u0430\u0439\u043b <code>main.c<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>main()<\/code>:<\/p>\n<pre><code class=\"cpp\">#include \"MG32x02z__RegAddress.h\" #include \"api.h\" #include \"ulib.h\"   __attribute__ ((noreturn))  __attribute__ ((naked)) \/\/ omit prologue\/epilogue sequences (garbage push\/pop instructions) void main (void) {    if (*((volatile uint32_t*)(APP_ORIGIN)) == APP_SIGNATURE) {     asm(\"BX %0\" : : \"r\"((APP_ORIGIN+4) | 1)); \/\/ Set bit 0 for Thumb !!!   }    *(volatile uint16_t*)PB_CR3_h0 = 0x0002; \/\/ PB3 -> push-pull output   while (1) {     *(volatile uint16_t*)PB_SC_h0 = 0x0008; \/\/ set bit 3     delay_ms(100);     *(volatile uint16_t*)PB_SC_h1 = 0x0008; \/\/ clear bit 3     delay_ms(900);   }  } <\/code><\/pre>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432 \u041e\u0417\u0423. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>BX<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 D2 \u0441 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c 1 \u0441 \u0438 \u0441\u043a\u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c\u044e 10.<\/p>\n<h4>\u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c (Application)<\/h4>\n<p>\u0427\u0430\u0441\u0442\u044c <code>app<\/code> \u0438\u043c\u0435\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 ld-\u0441\u043a\u0440\u0438\u043f\u0442 <code>mg32f02a032_app.ld<\/code>:<\/p>\n<pre><code>SECTIONS { . = 0x20000000; .text : {   KEEP(*(.app_sign))   KEEP(*(.app))   *(.text)   }   . = 0x20000800;   .data : {     *(.data)   }   .bss : {     *(.bss)   } } <\/code><\/pre>\n<p>\u041c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 (\u0441\u0435\u043a\u0446\u0438\u044f <code>.text<\/code>) \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u041e\u0417\u0423 \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0x20000000 \u0438 \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 2048 \u0431\u0430\u0439\u0442. \u0412 \u0441\u0430\u043c\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>app_sign<\/code>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <code>app.c<\/code> \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <code>uint32_t<\/code>. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 4-\u0431\u0430\u0439\u0442\u043e\u0432\u0443\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432 \u041e\u0417\u0423 \u0447\u0430\u0441\u0442\u0438 <code>app<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b 0x46c046c0 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0443\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c <code>NOP<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0435\u043a\u0446\u0438\u0438 <code>.text<\/code> \u0438\u043b\u0438 \u043e\u0442\u0441\u0442\u0443\u043f\u0438\u0432 4 \u0431\u0430\u0439\u0442\u0430, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>app()<\/code>.<\/p>\n<p>\u0421\u0435\u043a\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 <code>.data<\/code> \u0438 <code>.bss<\/code> \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0x20000800 \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u0435\u0440\u0445\u0443 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <code>RAM<\/code> \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <code>svr<\/code> \u0441 \u0430\u0434\u0440\u0435\u0441\u0430 0x20000A00, \u0442.\u0435. \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0438 <code>app<\/code> \u0432 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 512 \u0431\u0430\u0439\u0442 (\u0441\u043c. ld-\u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0446\u0438\u043a\u043b\u0430).<\/p>\n<p>\u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u044c <code>app<\/code> \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<ul>\n<li>\n<p><code>app.c<\/code> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>app()<\/code>;<\/p>\n<\/li>\n<li>\n<p><code>api.h<\/code> \u2014 \u0444\u0430\u0439\u043b \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b;<\/p>\n<\/li>\n<li>\n<p><code>ulib.h<\/code> \u0438 <code>ulib.c<\/code> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p><code>uart.h<\/code> \u0438 <code>uart.c<\/code> \u2014 \u0431\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 UART.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b <code>app.c<\/code>:<\/p>\n<pre><code class=\"cpp\">#include \"MG32x02z__RegAddress.h\" #include \"ulib.h\" #include \"api.h\" #include \"uart.h\"  #define PORT 0   \/\/ Mark first word with signature \"Application is present\" (nop; nop: 0x46c046c0) __attribute__ ((section (\".app_sign\"))) __attribute__ ((__used__)) static uint32_t  app_sign=APP_SIGNATURE;   \/\/ First function in application __attribute__ ((section(\".app\"))) \/\/ put function in the begin of .text after signature word \"app_sign\" __attribute__ ((noreturn)) void app() {   char s[4]=\"&lt; >\";    uart_init(PORT);   uart_puts(PORT,\"Hello\",UART_NEWLINE_CRLF);   while (1) {     s[1]=uart_rx(PORT);     uart_puts(PORT,s,UART_NEWLINE_CRLF);   }  }  <\/code><\/pre>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>app_sign<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 <code>APP_SIGNATURE<\/code>, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432 \u0444\u0430\u0439\u043b\u0435 <code>api.h<\/code>. \u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442 \u0435\u0451 \u0432 \u0441\u0430\u043c\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <code>.text<\/code>. \u0414\u0430\u043b\u0435\u0435 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>app()<\/code>. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0435\u0451 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>naked<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0435\u043a\u043e\u043c \u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u0432 \u043d\u0451\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043a\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u0442\u0435\u0440\u0435\u0439 \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 4 \u0431\u0430\u0439\u0442 \u0432\u043e flash, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>PUSH<\/code> \u0438 <code>POP<\/code> &#171;\u043f\u0440\u043e\u043b\u043e\u0433\u0430&#187; \u0438 &#171;\u044d\u043f\u0438\u043b\u043e\u0433\u0430&#187;, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 32-\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u041e\u0417\u0423 (\u0432 \u0441\u0442\u0435\u043a\u0435).<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438: \u0432 \u0446\u0438\u043a\u043b\u0435 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f UART, \u043f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043e\u0431\u0440\u0430\u043c\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u0443\u0433\u043b\u043e\u0432\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438 <code>&lt;<\/code> \u0438 <code>><\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 UART, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 CR (0x0D) \u0438 LF (0x0A).<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>app()<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0440\u0442\u0430 <code>uart_init()<\/code>, \u0437\u0430\u0442\u0435\u043c \u0432 UART \u043e\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f <code>\"Hello\"<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432 \u0446\u0438\u043a\u043b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0441\u0438\u043c\u0432\u043e\u043b \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>uart_rx()<\/code> \u0438 \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 <code>uart_puts()<\/code>.<\/p>\n<h4>\u0421\u0431\u043e\u0440\u043a\u0430 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b <code>premake5.lua<\/code>. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0441\u043d\u0443\u043b\u0438\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0446\u0435\u043b\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>project<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e \u0434\u0432\u0435:<\/p>\n<pre><code class=\"lua\">project \"svr\"   kind \"ConsoleApp\"   language \"C\"   files {\"src\/init.c\", \"src\/startup.c\", \"src\/main.c\", \"src\/svr.c\", \"src\/ulib.c\"}   linkoptions {\"-nostdlib\"}   linkoptions { \"-Wl,--gc-sections\"}   linkoptions {\"-T mg32f02a032_svr.ld\"}  project \"app\"   kind \"ConsoleApp\"   language \"C\"   files {\"src\/app.c\", \"src\/uart.c\", \"src\/ulib.c\"}   linkoptions {\"-nostdlib\"}   linkoptions { \"-Wl,--gc-sections\"}   linkoptions {\"-T mg32f02a032_app.ld\"} <\/code><\/pre>\n<p>\u041e\u0431\u0435 \u0447\u0430\u0441\u0442\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043e\u043f\u0446\u0438\u044f \u043b\u0438\u043d\u043a\u0435\u0440\u0430 <code>-nostdlib<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 <code>-Os<\/code> \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u043c \u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>workspace<\/code> \u043f\u043e\u043d\u0438\u0436\u0435\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e <code>-O3<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043e\u043f\u0446\u0438\u044f <code>-ffreestanding<\/code>:<\/p>\n<pre><code class=\"lua\">buildoptions {\"-mthumb\", \"-mcpu=\"..MCPU, \"-Wall\", \"-O3\", \"-g\", \"-fno-common\", \"-ffunction-sections\", \"-fdata-sections\", \"-ffreestanding\"} <\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f make-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439<\/p>\n<pre><code class=\"bash\">premake5 gmake <\/code><\/pre>\n<p>\u0421\u0431\u043e\u0440\u043a\u0430 \u0447\u0430\u0441\u0442\u0435\u0439 <code>svr<\/code> \u0438 <code>app<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438<\/p>\n<pre><code class=\"bash\">make svr make app <\/code><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>make clean<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043e\u0431\u0435\u0438\u0445 \u0446\u0435\u043b\u0435\u0439.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u043a\u0446\u0438\u0439 <code>.text<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439: \u0447\u0430\u0441\u0442\u044c <code>srv<\/code> \u2014 472 \u0431\u0430\u0439\u0442\u0430 , \u0447\u0430\u0441\u0442\u044c <code>app<\/code> \u2014 386 \u0431\u0430\u0439\u0442. &#171;\u041f\u0440\u043e\u0448\u0438\u0432\u043a\u0430&#187; \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c AP flash \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 telnet-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0438 OpenOCD \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>mg32f02_mem_ap.tcl<\/code>)<\/p>\n<pre><code>mem_ap_flash $DIR\/bin\/svr.bin 0x18000000 <\/code><\/pre>\n<p>\u0433\u0434\u0435 <code>$DIR<\/code> \u2014 <em>\u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u043f\u0443\u0442\u044c<\/em> \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e OpenOCD).<\/p>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0432 \u041e\u0417\u0423 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0442\u0430\u0442\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b OpenOCD <code>load_image<\/code> \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u0431\u0440\u043e\u0441\u043e\u043c \u041c\u041a:<\/p>\n<pre><code>halt load_image $DIR\/bin\/app.bin 0x20000000 bin reset <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 (<code>bin<\/code>).<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c shell-\u0441\u043a\u0440\u0438\u043f\u0442\u044b <code>run_svr<\/code>:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash TELNET=\"telnet 127.0.0.1 4444\" DIR=`pwd` (echo \"mem_ap_flash $DIR\/bin\/svr.bin 0x18000000\"; sleep 3;) | $TELNET <\/code><\/pre>\n<p>\u0438 <code>run_app<\/code>:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash TELNET=\"telnet 127.0.0.1 4444\" DIR=`pwd` (echo \"halt\"; sleep 0.2; echo \"load_image $DIR\/bin\/app.bin 0x20000000 bin\"; sleep 0.2; echo \"reset\"; sleep 0.2;) | $TELNET <\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u041c\u041a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u041f\u041a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>minicom<\/code> \u0432 \u041e\u0421 Linux. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 115200 \u0431\u0438\u0442\/\u0441, \u0434\u043b\u0438\u043d\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 8 \u0431\u0438\u0442, \u0444\u043e\u0440\u043c\u0430\u0442 \u0431\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438 \u0441 \u043e\u0434\u043d\u0438\u043c \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u043e\u043c.<br \/> \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5d5\/969\/b0c\/5d5969b0c2fb081f2d6f76f346ab7a8e.png\" alt=\"\u041e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u041c\u041a \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c\" title=\"\u041e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u041c\u041a \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c\" width=\"726\" height=\"476\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5d5\/969\/b0c\/5d5969b0c2fb081f2d6f76f346ab7a8e.png\"\/><figcaption>\u041e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u041c\u041a \u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u043c<\/figcaption><\/figure>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c URT1. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">#define PORT 1 <\/code><\/pre>\n<p>\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c <code>app<\/code>.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043c\u043e\u0434\u0443\u043b\u044f URT0. \u0412 \u0444\u0430\u0439\u043b\u0435 <code>app.c<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f <code>uart_hdl()<\/code> \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>app()<\/code>:<\/p>\n<pre><code class=\"cpp\">void uart_hdl() {   char s[4]=\"&lt; >\";   s[1]=uart_rx(PORT);   uart_puts(PORT,s,UART_NEWLINE_CRLF); }   __attribute__ ((section(\".app\"))) \/\/ put function in the begin of .text after signature word \"app_sign\" __attribute__ ((noreturn)) void app() {    *(volatile uint16_t*)PB_CR2_h0 = 0x0002; \/\/ PB2 -> push-pull output    uart_init(PORT);   SVC2(SVC_HANDLER_SET,20,uart_hdl);    \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 URT0   *(volatile uint8_t*)URT0_INT_b0 = 0x40 | 0x01; \/\/ URT0_RX_IE | URT0_IEA   \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 NVIC   *(volatile uint32_t*)CPU_ISER_w = (1 &lt;&lt; 20); \/\/ SETENA 20    uart_puts(PORT,\"Hello\",UART_NEWLINE_CRLF);    while (1) {     *(volatile uint16_t*)PB_SC_h0 = 0x0004; \/\/ set bit 2     delay_ms(250);     *(volatile uint16_t*)PB_SC_h1 = 0x0004; \/\/ clear bit 2     delay_ms(250);   }  } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0442\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b\u0438 \u0432 \u0446\u0438\u043a\u043b\u0435, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <code>uart_hdl()<\/code>. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0436\u0435 \u0446\u0438\u043a\u043b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c D1. \u041f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>SVC_HANDLER_SET<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f URT0 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e  <code>uart_hdl()<\/code>, \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u041e\u0417\u0423.<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0447\u0430\u0441\u0442\u044c <code>app<\/code>. \u0412 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e UART \u041c\u041a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043c\u0438\u0433\u0430\u0435\u0442 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 D1, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438 ISR \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u044f\u0434\u0440\u043e \u041c\u041a \u043d\u0430 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>app()<\/code> \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f URT1 (\u043c\u0430\u043a\u0440\u043e\u0441 <code>PORT<\/code> \u043d\u0443\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 1):<\/p>\n<pre><code class=\"cpp\">  uart_init(PORT);   SVC2(SVC_HANDLER_SET,21,uart_hdl);    \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 URT1   *(volatile uint8_t*)URT1_INT_b0 = 0x40 | 0x01; \/\/ URT1_RX_IE | URT1_IEA   \/\/ \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 NVIC   *(volatile uint32_t*)CPU_ISER_w = (1 &lt;&lt; 21); \/\/ SETENA 21 <\/code><\/pre>\n<h3>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u041c\u041a<\/h3>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u041c\u041a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/674788\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0446\u0438\u043a\u043b\u0430.<\/p>\n<p>\u041c\u041a \u0441\u0435\u0440\u0438\u0438 MG32F02 \u0438\u043c\u0435\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 ICKO (\u0432\u0441\u0435\u0433\u0434\u0430 PC0). \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u043e\u0440\u043e\u043c \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043f\u043e\u043b\u044f <code>CSC_CKO_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CKO<\/code>. \u0427\u0430\u0441\u0442\u043e\u0442\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0438\u0436\u0435 \u0432 1, 2, 4 \u0438\u043b\u0438 8 \u0440\u0430\u0437, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0432 \u043f\u043e\u043b\u0435 <code>CSC_CKO_DIV<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CKO<\/code>. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_MAIN \u0431\u0435\u0437 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b:<\/p>\n<pre><code class=\"cpp\">\/\/ CK_ICKO output through PC0 pin void setup_icko() {   *(volatile uint16_t*)PC_CR0_h0 = (0x1 &lt;&lt; 12) | 2; \/\/ PC0 -> ICKO, push pull output   *(volatile uint16_t*)CSC_KEY_h0 = 0xA217; \/\/ unlock access to CSC regs   *(volatile uint32_t*)CSC_CKO_w = (0x0 &lt;&lt; 4) | 1; \/\/ CK_MAIN, DIV=1, CSC_CKO_EN = 1   *(volatile uint16_t*)CSC_KEY_h0 = 0x1111; \/\/ lock access to CSC regs } <\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0437 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u041c\u041a \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442.\u0435. \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e RC-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 IHRCO \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 12,0000 \u041c\u0413\u0446. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c UART \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043b\u0438\u0436\u0435 \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442 IHRCO \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 11,0592 \u041c\u0413\u0446, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0442\u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 11059200\/115200 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e \u0446\u0435\u043b\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 96, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u0439 ( <em>Kp<\/em>= 1, <em>Kc<\/em>= 11, <em>Ktxos<\/em>= 3). \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 IHRCO \u043d\u0430 11,0592 \u041c\u0413\u0446:<\/p>\n<pre><code class=\"cpp\">void setup_ihrco() {   *(volatile uint16_t*)CSC_KEY_h0 = 0xA217; \/\/ unlock access to CSC regs   *(volatile uint32_t*)CSC_CR0_w |= (1 &lt;&lt; 18); \/\/ CSC_IHRCO_SEL = 1 (11.0592 MHz)   *(volatile uint16_t*)CSC_KEY_h0 = 0x1111; \/\/ lock access to CSC regs } <\/code><\/pre>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c RC-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b \u043d\u0435\u0432\u044b\u0441\u043e\u043a\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u044b. \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043d\u043e\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u0432\u0430\u0440\u0446\u0435\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 XOSC \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0435, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u043e\u043c \u043a \u0432\u044b\u0432\u043e\u0434\u0430\u043c XIN \u0438 XOUT \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u0441\u0445\u0435\u043c\u0435:<\/p>\n<pre><code class=\"cpp\">void setup_xosc() {   uint32_t d;   \/\/ Setup pins XIN (PC13) &amp; XOUT (PC14):   *(volatile uint16_t*)PC_CR13_h0 = (1 &lt;&lt; 12); \/\/ PC13 -> XIN   *(volatile uint16_t*)PC_CR14_h0 = (1 &lt;&lt; 12); \/\/ PC14 -> XOUT   while (! (*(volatile uint8_t*)CSC_STA_b3 &amp; 2)); \/\/ waiting CSC_XOSCF == 1 (XOSC ready)   *(volatile uint16_t*)CSC_KEY_h0 = 0xA217; \/\/ unlock access to CSC regs   d=*(volatile uint32_t*)CSC_CR0_w;   d &amp;= ~(3 &lt;&lt; 10); \/\/ clear bits 10,11   d |= (1 &lt;&lt; 10); \/\/ set CSC_HS_SEL = 0b01 (XOSC)   *(volatile uint32_t*)CSC_CR0_w = d;   *(volatile uint16_t*)CSC_KEY_h0 = 0x1111; \/\/ lock access to CSC regs } <\/code><\/pre>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 XIN \u0438 XOUT \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u043e\u043d\u0430\u0442\u043e\u0440\u0430 PC13 \u0438 PC14. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 XOSC \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f (\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u0438\u0442\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e). \u0417\u0430\u0442\u0435\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 (\u0430\u043a\u0442\u0438\u0432\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043b\u0430\u0433\u0430 <code>CSC_XOSCF<\/code>). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CSC_CR0<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f XOSC \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f CK_HS (\u043f\u043e\u043b\u0435 <code>CSC_HS_SEL<\/code> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 1).<\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 XOSC \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0430\u0445 \u0434\u043e 24 \u041c\u0413\u0446. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0442\u0430\u043a\u0442\u043e\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0432\u044b\u0448\u0435, \u0447\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u0430 XOSC, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 PLL. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 PLL c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0432 2 \u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"cpp\">\/\/ \u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 PLL (x2) void setup_pll() {   uint16_t d;   *(volatile uint16_t*)CSC_KEY_h0 = 0xA217; \/\/ unlock access to CSC regs    \/\/ CSC_PLLI_DIV = 2, CK_PLLI = 6 MHz (CK_HS\/2)   \/\/ CSC_PLLO_DIV = 0 , CK_PLLO = 24 MHz (CK_PLL\/4)   *(volatile uint8_t*)CSC_DIV_b0 = 0b00000001;    \/\/ CSC_PLL.CSC_PLL_MUL = 0, PLL_MULL = 16 (DEFAULT), CK_PLL = 96 MHz (CK_PLII*16)    *(volatile uint8_t*)CSC_CR0_b0 |= (1 &lt;&lt; 5); \/\/ CSC_PLL_EN = 1    while (! (*(volatile uint8_t*)CSC_STA_b0 &amp; (1 &lt;&lt; 6))); \/\/ waiting CSC_PLLF == 1 (PLL ready)    d=*(volatile uint16_t*)CSC_CR0_h0;   d &amp;= ~(3 &lt;&lt; 14); \/\/ clear bits 14,15   d |= (2 &lt;&lt; 14); \/\/ CSC_MAIN_SEL = 2 (CK_PLLO)   *(volatile uint16_t*)CSC_CR0_h0 = d;    *(volatile uint16_t*)CSC_KEY_h0 = 0x1111; \/\/ lock access to CSC regs } <\/code><\/pre>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f CK_HS \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 12 \u041c\u0413\u0446. \u0412\u0445\u043e\u0434\u043d\u043e\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0431\u043b\u043e\u043a\u0430 PLL \u0434\u0435\u043b\u0438\u0442 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043d\u0430 2 (\u043f\u043e\u043b\u0435 <code>CSC_PLLI_DIV<\/code>), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0439 \u0434\u043b\u044f PLL \u041c\u041a MG32F02A032 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 5-7 \u041c\u0413\u0446. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 6 \u041c\u0413\u0446 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 16 \u0432 \u0431\u043b\u043e\u043a\u0435 PLL. \u0421\u0438\u0433\u043d\u0430\u043b CK_PLL \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 96 \u041c\u0413\u0446 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0430 4 (\u043f\u043e\u043b\u0435 <code>CSC_PLLO_DIV<\/code>) \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b CK_PLLO \u0441 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439 24 \u041c\u0413\u0446 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 (CK_MAIN) \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CSC_CR0<\/code>.<\/p>\n<p>\u0412\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c (\u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>app.c<\/code>) \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u0437 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <code>svr<\/code>, \u0442\u0430\u043a \u0438 \u0438\u0437 \u041e\u0417\u0423 \u0438\u0437 \u0447\u0430\u0441\u0442\u0438 <code>app<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u041c\u041a \u0431\u0435\u0437 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f flash-\u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u0430 \u0447\u0430\u0441\u0442\u0435\u0439 <code>svr<\/code> \u0438 <code>app<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 <code>lst_svr<\/code> \u0438 <code>lst_app<\/code>. \u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b, \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u043c <a href=\"https:\/\/disk.yandex.ru\/d\/oamZd7q9IWYp3g\" rel=\"noopener noreferrer nofollow\">\u0430\u0440\u0445\u0438\u0432\u0435<\/a>.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0442\u0440\u0435\u0442\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u0446\u0438\u043a\u043b\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u041c\u041a \u0441\u0435\u0440\u0438\u0438 MG32F02: \u0410\u0426\u041f \u0438 \u043a\u043e\u043c\u043f\u0430\u0440\u0430\u0442\u043e\u0440, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u043d\u044b\u0439 \u0434\u0430\u0442\u0447\u0438\u043a.<\/p>\n<h3>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/189484\/\" rel=\"noopener noreferrer nofollow\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/190032\/\" rel=\"noopener noreferrer nofollow\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445: \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/191058\/\" rel=\"noopener noreferrer nofollow\">ARM-\u044b \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445: \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><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:\/\/habr.com\/ru\/post\/681702\/\"> https:\/\/habr.com\/ru\/post\/681702\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Megawin \u043d\u0430 \u044f\u0434\u0440\u0435 Cortex-M0. \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/675776\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0431\u044b\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b: \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 gcc \u0438 OpenOCD, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 flash-\u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 GPIO. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b: \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439 UART, \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u041e\u0417\u0423 \u041c\u041a \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e flash-\u043f\u0430\u043c\u044f\u0442\u0438, \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432, \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u041c\u041a \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432.<\/p>\n<h3>\u041c\u043e\u0434\u0443\u043b\u0438 UART \u041c\u041a MG32F02<\/h3>\n<h4>\u041e\u0431\u0449\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0441\u0435\u0440\u0438\u0438 MG32F02 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 UART: <em>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439<\/em> (URT0-URT2) \u0438 <em>\u0431\u0430\u0437\u043e\u0432\u044b\u0439<\/em> (URT4-URT7). \u0412 \u041c\u041a MG32F02A032 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f URT0 \u0438 URT1. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0435\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c USART, \u0442.\u0435. \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439-\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u0451\u043c\u043e\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><em>\u0412\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART<\/em> \u0438\u043c\u0435\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u0443\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u043e 6 \u041c\u0431\u0438\u0442\/\u0441,<\/p>\n<\/li>\n<li>\n<p>\u0434\u043b\u0438\u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 7 \u0438\u043b\u0438 8 \u0431\u0438\u0442,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044f (oversampling) \u043f\u0440\u0438 \u043f\u0440\u0438\u0451\u043c\u0435 \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c 4-32,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438\/\u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430,<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 RX \u0438 TX,<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RX \u0438 TX.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0440\u0435\u0436\u0438\u043c\u0435 SPI (\u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART) \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0430 URTx_CLK \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 16 \u041c\u0413\u0446 \u0434\u043b\u044f MG32F02A032, 18 \u041c\u0413\u0446 \u0434\u043b\u044f MG32F02A128\/A064 \u0438 MG32F02U128\/U064.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 (\u043c\u043e\u0434\u0443\u043b\u0438 URT0-URT2)<\/h4>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p><em>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 UART<\/em> (\u043c\u043e\u0434\u0443\u043b\u0438 URT0-URT2) \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0436\u0438\u043c\u044b SPI master \u0438 slave, SmartCard, LIN, \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439,<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u0438\u0442 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u0435 (MSB \u0438\u043b\u0438 LSB),<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430 0.5, 1, 1.5 \u0438\u043b\u0438 2,<\/p>\n<\/li>\n<li>\n<p>\u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 RX \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u043b\u0438 \u0442\u0440\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c,<\/p>\n<\/li>\n<li>\n<p>\u0442\u0430\u0439\u043c\u0435\u0440 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 Idle\/RX\/Break\/Calibration,<\/p>\n<\/li>\n<li>\n<p>&#171;\u0432\u0445\u043e\u0434&#187; \u0438 &#171;\u0432\u044b\u0445\u043e\u0434&#187; \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 &#171;mute&#187; \u0432 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 4 \u0431\u0430\u0439\u0442\u0430 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440\u0443 \u043a\u0430\u043a 32-\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c (\u0441 \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0435\u0439) \u0432 \u0440\u043e\u0434\u0438 \u0432\u0435\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u043b\u0438 \u0432\u0435\u0434\u043e\u043c\u043e\u0433\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 IrDA,<\/p>\n<\/li>\n<li>\n<p>\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RTS \u0438 CTS,<\/p>\n<\/li>\n<li>\n<p>\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u043b\u044f \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RS-485),<\/p>\n<\/li>\n<li>\n<p>\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SmartCard,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 DMA,<\/p>\n<\/li>\n<li>\n<p>\u0447\u0430\u0441\u0442\u0438\u0447\u043d\u0430\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043f\u043e\u0442\u043e\u043a\u0430 XON\/XOFF.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 UART \u0432 \u041c\u041a MG32F02A032 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 UART \u041c\u041a MG32F02A128\/U128\/A064\/U064 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><figcaption>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 <em>\u0432\u043d\u0435\u0448\u043d\u0438\u0435<\/em> \u0441\u0438\u0433\u043d\u0430\u043b\u044b:<\/p>\n<ul>\n<li>\n<p>URTx_CLK \u2014 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e UART \u0438\u043b\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 SPI,<\/p>\n<\/li>\n<li>\n<p>URTx_RX \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 RX \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 UART \u0438\u043b\u0438 MISO \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI master,<\/p>\n<\/li>\n<li>\n<p>URTx_TX \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 TX \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 UART \u0438\u043b\u0438 MOSI \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI master,<\/p>\n<\/li>\n<li>\n<p>URTx_NSS \u2014 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439\/\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0430 (chip select) \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 SPI slave\/master \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e,<\/p>\n<\/li>\n<li>\n<p>URTx_CTS \u2014 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c UART CTS,<\/p>\n<\/li>\n<li>\n<p>URTx_RTS \u2014 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u043c UART RTS,<\/p>\n<\/li>\n<li>\n<p>URTx_DE \u2014 \u0441\u0438\u0433\u043d\u0430\u043b &#171;\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430&#187; \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430,<\/p>\n<\/li>\n<li>\n<p>URTx_BRO \u2014 \u0432\u044b\u0445\u043e\u0434 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430,<\/p>\n<\/li>\n<li>\n<p>URTx_TMO \u2014 \u0432\u044b\u0445\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0430 TMO.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0443\u0437\u0435\u043b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c <em>Clock Control<\/em>, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b <em>Baud-Rate Generator<\/em>. \u0411\u043b\u043e\u043a <em>Mode Control<\/em> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0436\u0438\u043c\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f. \u0411\u043b\u043e\u043a <em>Data Control<\/em> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0438\u0435\u043c\u043e\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0431\u0449\u0435\u0439 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439. \u0411\u043b\u043e\u043a <em>Receiver Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IrDA. \u0411\u043b\u043e\u043a <em>Transmitter Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 IrDA. \u041f\u0440\u0438\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Event Detector<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0431\u043b\u043e\u043a <em>Interrupt Control<\/em> \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT_URTx. \u041e\u0431\u0430 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0434\u0430\u043b\u0435\u0435. 16-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0430\u0439\u043c\u0435\u0440 <em>TMO<\/em> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u043e\u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u0440\u0435\u0436\u0438\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c. \u0422\u0430\u0439\u043c\u0435\u0440 TMO \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f UART, \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c UART \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d.<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Hardware Flow Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 RTS\/CTS. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 XON\/XOFF \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0431\u0438\u0442 <code>URTx_TX_HALT<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR2<\/code>).<\/p>\n<p>\u0411\u043b\u043e\u043a <em>Drive Enable Timing Control<\/em>  \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c \u0434\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RS-485). \u0411\u043b\u043e\u043a <em>SPI NSS Timing Control<\/em> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c NSS \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SPI. \u0411\u043b\u043e\u043a <em>Multi-Processor Control<\/em> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u0430 \u0431\u043b\u043e\u043a <em>Baud-Rate Calibration<\/em> \u0437\u0430 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0443 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f UART.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f UART \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ul>\n<li>\n<p>\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f URTx \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>CSC_APB0<\/code> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430 <code>CSC_URTx_EN<\/code> (\u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 <code>CSC_KEY<\/code>),<\/p>\n<\/li>\n<li>\n<p>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0442 <code>URTx_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CR0<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c<\/h3>\n<p>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c <em>Clock Control<\/em> \u041c\u041a MG32F02A128\/U128\/A064\/U064 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e UART<\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0445 \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f UART \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u043b\u044f <code>URTx_CK_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code> \u0438\u0437 \u0447\u0438\u0441\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445:<\/p>\n<ul>\n<li>\n<p>\u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_PR \u0441 \u0432\u044b\u0445\u043e\u0434\u0430 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f CSC,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0449\u0435\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b CK_LS \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TM00 TM00_TRGO,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043c\u043e\u0434\u0443\u043b\u044f NCO (Numerically Controlled Oscillator) NCO_P0 (\u043a\u0440\u043e\u043c\u0435 \u041c\u041a MG32F02A032).<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0438\u0433\u043d\u0430\u043b CK_URTx_PR \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_APB \u0438\u043b\u0438 CK_AHB \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u0430 <code>CSC_URTx_CKS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CKS1<\/code>. \u0421\u0438\u0433\u043d\u0430\u043b CK_LS \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 CK_ILRCO, CK_XOSC \u0438\u043b\u0438 CK_EXT \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f <code>CSC_LS_SEL<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>CSC_CR0<\/code> (\u0441\u043c. <a href=\"https:\/\/habr.com\/ru\/post\/674788\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u0446\u0438\u043a\u043b\u0430).<\/p>\n<p>\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b (\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u043a CK_URTx) \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u0430 \u0431\u043b\u043e\u043a <em>BR (Baud-Rate Generator)<\/em>, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 6-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b (4-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u041c\u041a MG32F02A032) \u0438 8-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430. \u041f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b URTx_CKO, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043c\u0435\u043d\u0430. \u0412 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_RLR<\/code> \u0432 \u043f\u043e\u043b\u0435 <code>URTx_PSR<\/code> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f <em>Kp<\/em>, \u0430 \u0432 \u043f\u043e\u043b\u0435 <code>URTx_RLR<\/code> \u2014 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 <em>Kc<\/em>. \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0431\u043e\u043b\u044c\u0448\u0435. 8-\u0431\u0438\u0442\u043d\u044b\u0439 \u0441\u0447\u0435\u0442\u0447\u0438\u043a CNT \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_INT, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0430\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430.<\/p>\n<p>\u0422\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0438 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043e\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0442\u0430\u0439\u043c\u0435\u0440\u043e\u0432 TM01_TRGO \u0438\u043b\u0438 TM10_TRGO, \u0438 \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u0430 URTx_ECK. \u0412\u044b\u0431\u043e\u0440 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 CK_URTx_TX \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u043c <code>URTx_TX_CKS<\/code>, \u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 CK_URTx_RX \u2014 \u043f\u043e\u043b\u0435\u043c <code>URTx_RX_CKS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code>. \u0414\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u043b CK_URTx_RX \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u0435\u0440\u0435\u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 (oversampling), \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u043e\u0442\u0441\u0447\u0435\u0442\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u0430 RX \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0448\u0443\u043c\u0430 \u0438 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043c\u0435\u043d\u0430 Btx \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <em>Ktxos<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 5-\u0431\u0438\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c <code>URTx_TXOS_NUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR1<\/code>. \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u0442\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 \u0441\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043c\u0435\u043d\u0430 Brx \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <em>Krxos<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 5-\u0431\u0438\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c <code>URTx_RXOS_NUM<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CR1<\/code>.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 <em>Btx<\/em> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u043a<\/p>\n<p><em>Btx<\/em> = <em>Furt<\/em> \/ ( (<em>Kp<\/em>+1)\u00b7(<em>Kc<\/em>+1)\u00b7(<em>Ktxos<\/em>+1) ),<\/p>\n<p>\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430 <em>Brx<\/em> \u043a\u0430\u043a<\/p>\n<p><em>Brx<\/em> = <em>Furt<\/em> \/ ( (<em>Kp<\/em>+1)\u00b7(<em>Kc<\/em>+1)\u00b7(<em>Krxos<\/em>+1) ),<\/p>\n<p>\u0433\u0434\u0435 <em>Furt<\/em> \u2014 \u0447\u0430\u0441\u0442\u043e\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CK_URTx.<\/p>\n<p>\u0411\u043b\u043e\u043a BR \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f UART \u043a\u0430\u043a \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c UART \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 <em>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435<\/em> \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0441\u0447\u0435\u0442\u0447\u0438\u043a (\u0431\u0438\u0442 <code>URTx_BR_MDS<\/code> \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 <code>URTx_CLK<\/code> \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 1). \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0431\u043b\u043e\u043a BR \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0431\u0438\u0442 <code>URTx_BR_EN<\/code> \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 <code>URTx_CLK<\/code>.<\/p>\n<h3>\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0433\u0434\u0435 \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u0444\u043b\u0430\u0433\u0438, \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0435 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f INT_URTx.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p>\u0424\u043b\u0430\u0433\u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u0424\u043b\u0430\u0433\u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/th>\n<th>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041e\u0431\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>ERRF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Error flag<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Parity Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">PEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0431\u0438\u0442\u0430 \u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438\/\u043d\u0435\u0447\u0435\u0442\u043d\u043e\u0441\u0442\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Frame Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">FEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Data Overrun<\/p>\n<\/td>\n<td>\n<p align=\"left\">ROVRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Noised Character<\/p>\n<\/td>\n<td>\n<p align=\"left\">NCEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0414\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0448\u0443\u043c \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0431\u0438\u0442\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">TX Error<\/p>\n<\/td>\n<td>\n<p align=\"left\">TXEF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0448\u0438\u0431\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043a\u0430\u0434\u0440\u0430 (\u0441\u0442\u043e\u043f-\u0431\u0438\u0442\u0430) \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u043e\u0432 SmartCard \u0438 LIN<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Transmit data underrun<\/p>\n<\/td>\n<td>\n<p align=\"left\">TUDRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 SPI<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TMO<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>ERRF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Error flag<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Receive Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">RXTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043f\u0440\u0438\u0435\u043c\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_RXTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Idle Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">IDTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u043b\u0438\u043d\u0438\u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_IDTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Break Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">BKTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0435\u0432\u044b\u0448\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#171;Break&#187; \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_BKTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Calibration Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">CALTMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">ERRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0431\u0438\u0442\u0435 <code>URTx_CALTMO_EN<\/code><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041e\u0431\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>UGF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">UART general event<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Slave Address Match<\/p>\n<\/td>\n<td>\n<p align=\"left\">SADRF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u0438\u043d\u044f\u0442 \u043a\u0430\u0434\u0440 \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Baud-Rate Timer Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">BRTF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 BR (Baud-Rate Timer)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Timeout Timer Timeout<\/p>\n<\/td>\n<td>\n<p align=\"left\">TMOF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0430\u0439\u043c\u0430\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0430 TMO (Timeout Timer)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Calibration Complete<\/p>\n<\/td>\n<td>\n<p align=\"left\">CALCF<\/p>\n<\/td>\n<td>\n<p align=\"left\">UGF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0421\u0442\u0430\u0442\u0443\u0441 \u043b\u0438\u043d\u0438\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\"><strong>LSF<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Line status<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Break Condition Detect<\/p>\n<\/td>\n<td>\n<p align=\"left\">BKF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 &#171;Break&#187; (\u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u0434\u043b\u0438\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0431\u0438\u0442\u043e\u0432)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Idle Line Detect<\/p>\n<\/td>\n<td>\n<p align=\"left\">IDLF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0434\u0435\u0440\u0436\u0430\u043d &#171;Idle&#187; \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CTS Change<\/p>\n<\/td>\n<td>\n<p align=\"left\">CTSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">LSF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 CTS \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-336823","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336823","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=336823"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336823\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}