{"id":9148,"date":"2019-02-09T15:10:27","date_gmt":"2019-02-09T15:10:27","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=9148"},"modified":"2019-02-09T19:16:05","modified_gmt":"2019-02-09T19:16:05","slug":"nrf5-sdk-uart","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=9148","title":{"rendered":"nRF5 SDK: UART"},"content":{"rendered":"<p><a href=\"https:\/\/devzone.nordicsemi.com\/f\/nordic-q-a\/30997\/understand-uart-uarte-and-getting-it-to-work-with-ppi\">Understand UART, UARTE and getting it to work with PPI<\/a><\/p>\n<p><a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuart.html&#038;cp=2_1_0_49_9&#038;anchor=topic\">UART \u2014 Universal asynchronous receiver\/transmitter<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuart.html&#038;cp=2_1_0_49_9&#038;anchor=topic\">UARTE \u2014 Universal asynchronous receiver\/transmitter with EasyDMA<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__uart.html&#038;cp=4_0_0_6_9_0_30\">Peripheral drivers &#8211; UART<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__uarte.html&#038;cp=4_0_0_6_9_0_31\">Peripheral drivers &#8211; UARTE<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fhardware_driver_uart.html&#038;cp=4_0_0_2_18\">UART Driver<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fgroup__app__uart.html&#038;cp=4_0_0_6_11_52\">UART module<\/a><br \/>\n<a href=\"http:\/\/infocenter.nordicsemi.com\/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Flib_serial.html&#038;cp=4_0_0_3_37\">Serial port library<\/a><\/p>\n<pre class=\"brush: cpp; title: modules\/nrfx\/drivers\/src\/nrfx_uart.c; notranslate\" title=\"modules\/nrfx\/drivers\/src\/nrfx_uart.c\">\r\nnrfx_err_t nrfx_uart_init(nrfx_uart_t const *        p_instance,\r\n                          nrfx_uart_config_t const * p_config,\r\n                          nrfx_uart_event_handler_t  event_handler)\r\n{\r\n    &#x5B;...]\r\n    apply_config(p_instance, p_config);\r\n    &#x5B;...]\r\n}\r\n\r\nstatic void apply_config(nrfx_uart_t        const * p_instance,\r\n                         nrfx_uart_config_t const * p_config)\r\n{\r\n    &#x5B;...]\r\n    \/* TXD *\/\r\n    nrf_gpio_pin_set(p_config-&gt;pseltxd);\r\n    nrf_gpio_cfg_output(p_config-&gt;pseltxd);\r\n    \r\n    \/* RXD *\/\r\n    nrf_gpio_cfg_input(p_config-&gt;pselrxd, NRF_GPIO_PIN_NOPULL);\r\n\r\n    nrf_uart_baudrate_set(p_instance-&gt;p_reg, p_config-&gt;baudrate);\r\n    nrf_uart_configure(p_instance-&gt;p_reg, p_config-&gt;parity, p_config-&gt;hwfc);\r\n    nrf_uart_txrx_pins_set(p_instance-&gt;p_reg, p_config-&gt;pseltxd, p_config-&gt;pselrxd);\r\n    &#x5B;...]\r\n}\r\n<\/pre>\n<pre class=\"brush: cpp; title: modules\/nrfx\/hal\/nrf_uart.h; notranslate\" title=\"modules\/nrfx\/hal\/nrf_uart.h\">\r\nvoid nrf_uart_txrx_pins_set(\r\n    NRF_UART_Type  *p_reg,\r\n    uint32_t        pseltxd,\r\n    uint32_t        pselrxd\r\n) {\r\n    p_reg-&gt;PSELRXD = pselrxd;\r\n    p_reg-&gt;PSELTXD = pseltxd;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Understand UART, UARTE and getting it to work with PPI UART \u2014 Universal asynchronous receiver\/transmitter UARTE \u2014 Universal asynchronous receiver\/transmitter with EasyDMA Peripheral drivers &#8211; UART Peripheral drivers &#8211; UARTE UART Driver UART module Serial port library nrfx_err_t nrfx_uart_init(nrfx_uart_t const * p_instance, nrfx_uart_config_t const * p_config, nrfx_uart_event_handler_t event_handler) { &#x5B;&#8230;] apply_config(p_instance, p_config); &#x5B;&#8230;] } static [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9148","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/9148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9148"}],"version-history":[{"count":7,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/9148\/revisions"}],"predecessor-version":[{"id":9160,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/9148\/revisions\/9160"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}