<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39953/nrf52840-uart-libraries</link><description>Good day all, 
 I am trying to build a very simple UART connection between the nrf52840 DK and my computer through a UART dongle. 
 First, I saw the UART example in the peripherals folder and I tested it in the Loopback mode with no problem. 
 When I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Oct 2018 15:02:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39953/nrf52840-uart-libraries" /><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155187?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 15:02:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54c2f1a4-dc01-4633-8924-27d2036827b4</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Thank you Martin!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155166?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 14:31:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baaaeaea-1daf-4319-8c2c-9cc10aad005f</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Thanks a lot Martin!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155154?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 14:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e98fa1-039a-4a66-b41c-9f0547a86124</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Yes, that is correct. And instead of :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrf_uart_task_trigger(NRF_UART0, NRF_UART0-&amp;gt;TASKS_STARTTX);&lt;/p&gt;
&lt;p&gt;you should use:&lt;/p&gt;
&lt;p&gt;nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTTX);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155147?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 13:38:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af754953-7b9b-45e0-bf87-559f33cb37d6</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;So,if&amp;nbsp; I understand right I can put NRF_UART_EVENT_TXDRDY directly inside the function without pointer? Or create an&amp;nbsp; nrf_uart_event_t instance and point to it with the dot operator?&lt;/p&gt;
&lt;p&gt;Thank you for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155144?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 13:31:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e167fb9-7906-4562-8e4f-37546a3ed995</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;The parameters you use may point to the task and event address in the UART peripheral, but that is not what the function wants. Look at the function definition of&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#ga0cb9cfb3275d6fa38dafdd6a1050e69f"&gt;nrf_uart_event_check&lt;/a&gt;&lt;span&gt;() f.eks.:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event)
{
    return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrf_uart_task_t and event_t are enums with offset values relative to the UART base address:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @enum nrf_uart_task_t
 * @brief UART tasks.
 */
typedef enum
{
    /*lint -save -e30 -esym(628,__INTADDR__)*/
    NRF_UART_TASK_STARTRX = offsetof(NRF_UART_Type, TASKS_STARTRX), /**&amp;lt; Task for starting reception. */
    NRF_UART_TASK_STOPRX  = offsetof(NRF_UART_Type, TASKS_STOPRX),  /**&amp;lt; Task for stopping reception. */
    NRF_UART_TASK_STARTTX = offsetof(NRF_UART_Type, TASKS_STARTTX), /**&amp;lt; Task for starting transmission. */
    NRF_UART_TASK_STOPTX  = offsetof(NRF_UART_Type, TASKS_STOPTX),  /**&amp;lt; Task for stopping transmission. */
    NRF_UART_TASK_SUSPEND = offsetof(NRF_UART_Type, TASKS_SUSPEND), /**&amp;lt; Task for suspending UART. */
    /*lint -restore*/
} nrf_uart_task_t;

/**
 * @enum nrf_uart_event_t
 * @brief UART events.
 */
typedef enum
{
    /*lint -save -e30*/
    NRF_UART_EVENT_CTS    = offsetof(NRF_UART_Type, EVENTS_CTS),   /**&amp;lt; Event from CTS line activation. */
    NRF_UART_EVENT_NCTS   = offsetof(NRF_UART_Type, EVENTS_NCTS),  /**&amp;lt; Event from CTS line deactivation. */
    NRF_UART_EVENT_RXDRDY = offsetof(NRF_UART_Type, EVENTS_RXDRDY),/**&amp;lt; Event from data ready in RXD. */
    NRF_UART_EVENT_TXDRDY = offsetof(NRF_UART_Type, EVENTS_TXDRDY),/**&amp;lt; Event from data sent from TXD. */
    NRF_UART_EVENT_ERROR  = offsetof(NRF_UART_Type, EVENTS_ERROR), /**&amp;lt; Event from error detection. */
    NRF_UART_EVENT_RXTO   = offsetof(NRF_UART_Type, EVENTS_RXTO)   /**&amp;lt; Event from receiver timeout. */
    /*lint -restore*/
} nrf_uart_event_t;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155131?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 13:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:046d9880-2877-4089-84e4-bd2914cb9dc9</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;One last question though, &lt;/p&gt;
&lt;p&gt;in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#gacf9204ac7ac86d90e9c731118f2d93c3"&gt;nrf_uart_task_trigger&lt;/a&gt;() and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#ga0cb9cfb3275d6fa38dafdd6a1050e69f"&gt;nrf_uart_event_check&lt;/a&gt;() of my code, the parameters are nrf_uart_task_t and event_t. At least that is were UART0 is pointing in both cases. Should I put this without a pointer?&lt;/p&gt;
&lt;p&gt;Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155127?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 12:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9473dd72-a7c0-4478-b9ca-ddc311a94e0e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Happy to help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155122?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 12:52:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7eab4270-a8fd-4d2b-9749-3ef6db736786</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Thank you for your help Martin. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/155116?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 12:37:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0156b1f-de69-4615-a1ed-a06033fffbab</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In addition to what &lt;a href="https://devzone.nordicsemi.com/members/ipshiv"&gt;ipshiv&lt;/a&gt; said, you can read more about the UART HAL and driver &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/hardware_driver_uart.html?cp=4_0_0_2_0_19"&gt;here&lt;/a&gt;, and about the difference between app_uart and nrf_serial &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/lib_serial.html?cp=4_0_0_3_41"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As for your code;&amp;nbsp;you are passing invalid parameters into&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#gacf9204ac7ac86d90e9c731118f2d93c3"&gt;nrf_uart_task_trigger&lt;/a&gt;() and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#ga0cb9cfb3275d6fa38dafdd6a1050e69f"&gt;nrf_uart_event_check&lt;/a&gt;(). You need to pass parameters of types&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uart__hal.html#ga61ed3c0eb7723a0dfda76d7d5025e5a8"&gt;nrf_uart_task_t&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__uarte__hal.html#ga1189b14604f6051467bc91b337c45d6a"&gt;nrf_uarte_event_t&lt;/a&gt;&amp;nbsp;respectively.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Anyway I suggest that you use the drivers anda libraries instead of the HAL directly. Then you can rely on the driver &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/hardware_driver_uart.html?cp=4_0_0_2_0_19"&gt;documentation&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/uart_example.html?cp=4_0_0_4_5_48"&gt;examples&lt;/a&gt;.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/154999?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 07:45:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64421037-a285-46dd-97a0-d9c4c1b4b60e</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Hi, thank you for your reply.&lt;/p&gt;
&lt;p&gt;Interesting tip.&amp;nbsp; The library you refer is located&amp;nbsp; in nRF5_SDK_15.2.0_9412b96\components\libraries\serial. Correct?&lt;/p&gt;
&lt;p&gt;Do you know if there are hardware abstraction libraries like the one for uart,&amp;nbsp; for other onboard peripherals like I2C, SPI, ADC etc?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART libraries</title><link>https://devzone.nordicsemi.com/thread/154979?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 05:23:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44b8bc0b-bee0-4d47-95ea-80a8d1822f70</guid><dc:creator>ipshiv</dc:creator><description>&lt;p&gt;Good day!&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve just started to work with new versions of SDK and NRF52, but NRF51 and older version used &lt;strong&gt;drivers&lt;/strong&gt; to work with specified peripheral and &lt;strong&gt;app &lt;/strong&gt;is a hardware abstraction, which means that functions doesn&amp;#39;t depend of board you are using. Also you can use app libraries with softdevice, driver libraries may cause a problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>