<?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>nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63631/nrf52832-custom-boad-logging</link><description>Hi! 
 we&amp;#39;re just finishing the layout for a custom nRF52832 board. On the custom board we have a connector for SWDIO and SWCLK to flash the firmware. Can we use theese 2 pins also for logging, or do i also need PIN 6 for UART logging? What pins are needed</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Jul 2020 10:55:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63631/nrf52832-custom-boad-logging" /><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259667?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 10:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fef17fe3-ed7b-41fb-b5b1-59a47aed3428</guid><dc:creator>hannes</dc:creator><description>&lt;p&gt;Thanks - Just tested both ways.&lt;br /&gt;RTT Logging via&amp;nbsp;&lt;span&gt;SWDIO/SWCLK/GND and UART Logging via TX_PIN (6 in my case) and GND.&lt;br /&gt;Everything works fine as expected. Thanks for your support!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259562?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 18:36:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5759273-150a-489a-8914-6830143526f8</guid><dc:creator>Mishka</dc:creator><description>&lt;p&gt;Seems as simple as that. Moreover, you may use any free GPIO pin closest to the UART connector on your PCB, not limiting to the pin 6 only. It&amp;#39;s a good practice to create your own board definitions file and declare the TX_PIN_NUMBER and other stuff (like LEDs and buttons) there. For examples please see sdk/components/boards/ header files.&lt;/p&gt;
&lt;p&gt;But please also note, despite it may be not so critical for TX + GND only, some cables have 5V logic level which is way above allowed 3.6V for the nRF52832. It might be good idea to check that before connecting the cable. Another thing to outline is that this configuration suggest no hardware, no software flow control. Indeed, there is no CTS/RTS, as well as no ability to send XON/XOFF. In some cases this may screw up the terminal.&lt;/p&gt;
&lt;p&gt;Finally, the nRF52 DK offers full UART pinout on pins P0.5 through P0.8. The &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.0/uart_example.html"&gt;UART example&lt;/a&gt; may be used to test the cable connection. After setting it up with the DK, the code may be used to test the custom board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259559?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 17:14:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d361147-144f-4a58-b401-06397405977e</guid><dc:creator>hannes</dc:creator><description>&lt;p&gt;Thanks - so I only need to connect Pin 6 and GND of the custom board with an &amp;quot;USB serial TTL cable&amp;quot; to the PC?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259557?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 17:05:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e58f2f3b-b128-4cde-8957-bbf6ebab151d</guid><dc:creator>Mishka</dc:creator><description>&lt;p&gt;Yep, it should also work. The UART backend uses the same UART driver with RX, CTS, RTS pins explicitly disabled. In the sdk_config.h / app_config.h you have to have something like that:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_LOG_ENABLED 1
#define NRF_LOG_BACKEND_UART_ENABLED 1
#define NRF_LOG_BACKEND_UART_TX_PIN 6&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But for printf() to work you might need to add components/libraries/uart/retarget.c to your firmware, so system calls like putchar(), getchar(), read(), and write() will be redirected to UART. Again, per your SDK config:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define APP_UART_ENABLED 1
#define RETARGET_ENABLED 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Mishka&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259548?ContentTypeID=1</link><pubDate>Sat, 11 Jul 2020 08:37:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfd2cd5d-16d3-4e6b-bd63-1948b0108172</guid><dc:creator>hannes</dc:creator><description>&lt;p&gt;Thanks Mishka for your detailed reply. Can you also tell me which pins are needed for UART logging on the custom board? Just TX (Pin 6) and GND?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 custom boad logging</title><link>https://devzone.nordicsemi.com/thread/259532?ContentTypeID=1</link><pubDate>Fri, 10 Jul 2020 19:26:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:971618d8-8a51-4e9b-935c-5c30c9ffa066</guid><dc:creator>Mishka</dc:creator><description>&lt;p&gt;Hi hannes,&lt;/p&gt;
&lt;p&gt;yes, using only SWDIO and SWCLK will work just fine. If you have programmed the custom board already your circuitry should be already set up. &lt;/p&gt;
&lt;p&gt;In software, all you need is enable the RTT logging backend in the SDK like follows. In the app_config.h or local sdk_config.h:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_LOG_ENABLED 1
#define NRF_LOG_BACKEND_RTT_ENABLED 1
#define NRF_LOG_USES_RTT 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In the Makefile make sure RTT library is included:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;SRC_FILES+=    $(SDK_ROOT)/components/libraries/log/src/nrf_log_backend_rtt.c
SRC_FILES+=    $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT.c
SRC_FILES+=    $(SDK_ROOT)/external/segger_rtt/SEGGER_RTT_printf.c
INC_FOLDERS+=  $(SDK_ROOT)/external/segger_rtt&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;From now on, NRF_LOG_INFO() and other log macros will output to the RTT buffers from where it will be possible to read using an RTT viewer.&lt;/p&gt;
&lt;p&gt;For example, to use the nRF52 DK as debugger, it will be required to download the &lt;a href="https://www.segger.com/downloads/jlink/"&gt;J-Link software&lt;/a&gt; bundle (may also be available with &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download"&gt;nRF command line tools&lt;/a&gt;) and which is very likely installed if you have programmed the custom board already. Among the J-Link library the bundle contains the JLinkExe and the JLinkRTTClient utilities. In one terminal window, please connect the JLink Commander to the debugger with the command like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;$ JLinkExe -device NRF52 -speed 4000 -if SWD -AutoConnect 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In another terminal window, connect RTT Client to the JLink Commander like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="powershell"&gt;$ JLinkRTTClient&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now, the logs should appear in the RTT Client.&lt;/p&gt;
&lt;p&gt;Please also note, if the code use printf() it may be required to tell compiler explicitly that the RTT version should be used. For example, it might be defined like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;SEGGER_RTT.h&amp;gt;
#define printf(...) SEGGER_RTT_printf(0, __VA_ARGS__)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For more insight on how the RTT works is please refer to the &lt;a href="https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/"&gt;Real-Time Transfer page&lt;/a&gt; on the Segger website.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Mishka&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;P.S. I&amp;#39;d leave a couple of GPIO test points on the PCB anyway - they could be very handy if something will occasionally go wrong and it might be needed to connect a LED, another I2C bus, or use them for RX/TX.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>