<?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>Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41333/is-there-an-easy-way-to-do-printf-by-uart-in-mesh-sdk-2-2</link><description>I tried to use the code from nRF5_SDK_15.0.0_a53641a, but the compiler keep complaining can&amp;#39;t find head files ( seems not possible without changing sdk 15 files ) 
 So, Is there an easy way?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Dec 2018 01:09:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41333/is-there-an-easy-way-to-do-printf-by-uart-in-mesh-sdk-2-2" /><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/161777?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 01:09:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac5604b1-1d4a-4dd1-9a7d-07b4afd8a927</guid><dc:creator>zzzh</dc:creator><description>&lt;p&gt;By the way, here&amp;#39;s the config I used:&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_UARTE_DEFAULT_CONFIG                                             \
{                                                                            \
    .pseltxd            = TX_PIN_NUMBER,                                     \
    .pselrxd            = NRF_UART_PSEL_DISCONNECTED,                        \
    .pselcts            = NRF_UART_PSEL_DISCONNECTED,                        \
    .pselrts            = NRF_UART_PSEL_DISCONNECTED,                        \
    .p_context          = NULL,                                              \
    .hwfc               = (nrf_uart_hwfc_t)UART_DEFAULT_CONFIG_HWFC,         \
    .parity             = (nrf_uart_parity_t)UART_DEFAULT_CONFIG_PARITY,     \
    .baudrate           = NRF_UART_BAUDRATE_115200,                          \
    .interrupt_priority = UART_DEFAULT_CONFIG_IRQ_PRIORITY,                  \
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/161776?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 01:05:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fedf411f-511a-4473-8ccf-1dfb8887256e</guid><dc:creator>zzzh</dc:creator><description>&lt;p&gt;Hi, awneil,&lt;/p&gt;
&lt;p&gt;here&amp;#39;s the code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uarte_config(NRF_UARTE_Type * p_uarte,
nrfx_uarte_config_t const * p_config)
{
if (p_config-&amp;gt;pseltxd != NRF_UARTE_PSEL_DISCONNECTED)
{
nrf_gpio_pin_set(p_config-&amp;gt;pseltxd);
nrf_gpio_cfg_output(p_config-&amp;gt;pseltxd);
}
if (p_config-&amp;gt;pselrxd != NRF_UARTE_PSEL_DISCONNECTED)
{
nrf_gpio_cfg_input(p_config-&amp;gt;pselrxd, NRF_GPIO_PIN_NOPULL);
}

nrf_uarte_baudrate_set(p_uarte, p_config-&amp;gt;baudrate);
nrf_uarte_configure(p_uarte, p_config-&amp;gt;parity, p_config-&amp;gt;hwfc);
nrf_uarte_txrx_pins_set(p_uarte, p_config-&amp;gt;pseltxd, p_config-&amp;gt;pselrxd);
if (p_config-&amp;gt;hwfc == NRF_UARTE_HWFC_ENABLED)
{
if (p_config-&amp;gt;pselcts != NRF_UARTE_PSEL_DISCONNECTED)
{
nrf_gpio_cfg_input(p_config-&amp;gt;pselcts, NRF_GPIO_PIN_NOPULL);
}
if (p_config-&amp;gt;pselrts != NRF_UARTE_PSEL_DISCONNECTED)
{
nrf_gpio_pin_set(p_config-&amp;gt;pselrts);
nrf_gpio_cfg_output(p_config-&amp;gt;pselrts);
}
nrf_uarte_hwfc_pins_set(p_uarte, p_config-&amp;gt;pselrts, p_config-&amp;gt;pselcts);
}
/*
nrf_uarte_int_enable(p_uarte, UARTE_INT_MASK);
NVIC_SetPriority(UARTE0_UART0_IRQn, p_config-&amp;gt;interrupt_priority);
NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);
NVIC_EnableIRQ(UARTE0_UART0_IRQn);
*/
nrf_uarte_enable(p_uarte);
}

void uarte_tx(NRF_UARTE_Type * p_reg, uint8_t * p_data, size_t len)
{
p_reg-&amp;gt;TXD.PTR = (uint32_t)p_data;
p_reg-&amp;gt;TXD.MAXCNT = len;
p_reg-&amp;gt;TASKS_STARTTX = 0x1UL;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/161762?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 19:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aa993c8-28a0-4ecd-a295-fd91f7c34940</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7242._5F00_Insert-Code-_2D00_-Nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/161737?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 16:06:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4bd427a-bd83-4afa-a994-57d43bd606ec</guid><dc:creator>zzzh</dc:creator><description>&lt;p&gt;Hi, Jorgen,&lt;/p&gt;
&lt;p&gt;I tried your way but it&amp;#39;s still complicate to solve the dependencies without changing the head files..&lt;/p&gt;
&lt;p&gt;So I made it simpler, as below:&lt;/p&gt;
&lt;p&gt;config part:&lt;/p&gt;
&lt;p&gt;void uarte_config(NRF_UARTE_Type * p_uarte,&lt;br /&gt; nrfx_uarte_config_t const * p_config)&lt;br /&gt;{&lt;br /&gt; if (p_config-&amp;gt;pseltxd != NRF_UARTE_PSEL_DISCONNECTED)&lt;br /&gt; {&lt;br /&gt; nrf_gpio_pin_set(p_config-&amp;gt;pseltxd);&lt;br /&gt; nrf_gpio_cfg_output(p_config-&amp;gt;pseltxd);&lt;br /&gt; }&lt;br /&gt; if (p_config-&amp;gt;pselrxd != NRF_UARTE_PSEL_DISCONNECTED)&lt;br /&gt; {&lt;br /&gt; nrf_gpio_cfg_input(p_config-&amp;gt;pselrxd, NRF_GPIO_PIN_NOPULL);&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;nrf_uarte_baudrate_set(p_uarte, p_config-&amp;gt;baudrate);&lt;br /&gt; nrf_uarte_configure(p_uarte, p_config-&amp;gt;parity, p_config-&amp;gt;hwfc);&lt;br /&gt; nrf_uarte_txrx_pins_set(p_uarte, p_config-&amp;gt;pseltxd, p_config-&amp;gt;pselrxd);&lt;br /&gt; if (p_config-&amp;gt;hwfc == NRF_UARTE_HWFC_ENABLED)&lt;br /&gt; {&lt;br /&gt; if (p_config-&amp;gt;pselcts != NRF_UARTE_PSEL_DISCONNECTED)&lt;br /&gt; {&lt;br /&gt; nrf_gpio_cfg_input(p_config-&amp;gt;pselcts, NRF_GPIO_PIN_NOPULL);&lt;br /&gt; }&lt;br /&gt; if (p_config-&amp;gt;pselrts != NRF_UARTE_PSEL_DISCONNECTED)&lt;br /&gt; {&lt;br /&gt; nrf_gpio_pin_set(p_config-&amp;gt;pselrts);&lt;br /&gt; nrf_gpio_cfg_output(p_config-&amp;gt;pselrts);&lt;br /&gt; }&lt;br /&gt; nrf_uarte_hwfc_pins_set(p_uarte, p_config-&amp;gt;pselrts, p_config-&amp;gt;pselcts);&lt;br /&gt; }&lt;br /&gt;/*&lt;br /&gt; nrf_uarte_int_enable(p_uarte, UARTE_INT_MASK);&lt;br /&gt; NVIC_SetPriority(UARTE0_UART0_IRQn, p_config-&amp;gt;interrupt_priority);&lt;br /&gt; NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn);&lt;br /&gt; NVIC_EnableIRQ(UARTE0_UART0_IRQn);&lt;br /&gt;*/&lt;br /&gt; nrf_uarte_enable(p_uarte);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;action part:&lt;/p&gt;
&lt;p&gt;void uarte_tx(NRF_UARTE_Type * p_reg, uint8_t * p_data, size_t len)&lt;br /&gt;{&lt;br /&gt; p_reg-&amp;gt;TXD.PTR = (uint32_t)p_data;&lt;br /&gt; p_reg-&amp;gt;TXD.MAXCNT = len;&lt;br /&gt; p_reg-&amp;gt;TASKS_STARTTX = 0x1UL;&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want to use interrupts by now so that part is commented,&amp;nbsp; Looks good, but it don&amp;#39;t work..&lt;/p&gt;
&lt;p&gt;Anything I missed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/160790?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 15:40:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:227a7f7f-24bb-4ce9-b6a2-763f4f87631e</guid><dc:creator>zzzh</dc:creator><description>&lt;p&gt;Cool, I&amp;#39;ll try it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/160789?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 15:38:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c50f859-19b8-4ec5-985f-92c2b683770b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There is a lot of dependencies in the NRF_LOG module. If you only need simple UART, I would recommend using the app_uart library that you found. You can use the &lt;a href="https://www.nordicsemi.com/en/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/uart_example"&gt;UART example&lt;/a&gt; as a reference when adding&amp;nbsp;the library to your application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/160788?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 15:31:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a67c121-9d49-4293-8750-e4ec56c7aefc</guid><dc:creator>zzzh</dc:creator><description>&lt;p&gt;Hi, Jorgen,&lt;/p&gt;
&lt;p&gt;I tried to use the macro NRF_LOG_DEBUG(...) way, following it, I added include for nrf_log_default_backends.h,&amp;nbsp;nrf_log.h, then added 4 more when compiler complaint can&amp;#39;t find, until I realized this way would not work.&lt;/p&gt;
&lt;p&gt;The thing is, the head file I added include also have include other files it self, even after you add all the includes, compiler would still complaint it can&amp;#39;t find the file included by the file you have included, you have to change sdk 15 head file to solve that, which is not I want.&lt;/p&gt;
&lt;p&gt;After a glance, I found there&amp;#39;s an uart folder in&amp;nbsp;nRF5_SDK_15.0.0_a53641a\components\libraries\, maybe I should try that.&lt;/p&gt;
&lt;p&gt;What do you think?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an easy way to do printf by UART in mesh sdk 2.2?</title><link>https://devzone.nordicsemi.com/thread/160689?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 09:33:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2305b293-4197-4208-8f4d-f3c870b3e334</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The easy way is to use the files from SDK 15.x.0 in your project. Did you include the path to the header files in your project?&lt;/p&gt;
&lt;p&gt;Which exact errors are you getting when compiling?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>