<?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>I can&amp;#39;t print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110583/i-can-t-print-message-on-putty-terminal-when-i-use-uarte</link><description>Hi, when I use other modules (like NRF_LOG ecc) no problem, when i use UART or UARTE the script is ok but i can&amp;#39;t see anything on PuTTY terminal. In my case, a LED should toogle when I puty any button on keyboard (as it is) and print a message like &amp;quot;The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 May 2024 08:45:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110583/i-can-t-print-message-on-putty-terminal-when-i-use-uarte" /><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/482967?ContentTypeID=1</link><pubDate>Mon, 13 May 2024 08:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89916f90-103c-47e2-8258-df25d3e49cce</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;This is what I see when running your application on a DK:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1715588930264v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I can write in the UART terminal (Putty), and it is printed in the UART log from the nRF.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;By default, the printf will print using RTT (which is not UART). This is why you can see it in the debug terminal in Segger Embedded Studio. If you want printf to be printed over UART instead, you need to enable it from sdk_config.h by setting:&lt;/p&gt;
&lt;p&gt;#define RETARGER_ENABLED 1&lt;/p&gt;
&lt;p&gt;(find it and change from 0 to 1)&lt;/p&gt;
&lt;p&gt;Then the printf() messages will be printed over UART (putty) instead of RTT.&lt;/p&gt;
[quote user="Ste_"]Can I ask also why NRF_LOG_INFO doesn&amp;#39;t work instead of printf()?[/quote]
&lt;p&gt;In order to use NRF_LOG_INFO() you need to add it and start it from your application. The easiest way to do this is to look at some example that is already doing it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Some clues are that you need a couple of extra sdk_config.h definitions, such as one that is choosing the backend for the log module (RTT or UART), and you need a function that starts the logging (nrf_log_init()), and some function to process the log, (NRF_LOG_PROCESS()).&lt;/p&gt;
&lt;p&gt;Look at how this is done in e.g. the sdk\examples\ble_peripheral\ble_app_hrs example.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/482846?ContentTypeID=1</link><pubDate>Fri, 10 May 2024 15:09:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:124265c8-0997-4951-931d-871a81d75c2d</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Sorry, that one should be right&lt;br /&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/uarte.zip"&gt;devzone.nordicsemi.com/.../uarte.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/482780?ContentTypeID=1</link><pubDate>Fri, 10 May 2024 11:55:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4f6202f-e270-42c9-be83-f1005f8d9975</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Please zip the entire application folder. If you are using the ble_app_uart project, then this is the folder you should .zip. The folder you attached now is only the segger embedded studio file, which says something about how the compiler should compile your application, but it doesn&amp;#39;t contain any of the .c or .h files in your application.&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/482649?ContentTypeID=1</link><pubDate>Thu, 09 May 2024 09:27:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:548f3bd0-10c3-489f-9a1e-c6a77c2c10ae</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Hi Edvin, sorry if I reply just now!&lt;br /&gt;&lt;br /&gt;I have the same old problems!&lt;br /&gt; &lt;br /&gt;About move the printing printf() out of the handler I tried and it works, but why it doesn&amp;#39;t work in the handler?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Can I ask also why NRF_LOG_INFO doesn&amp;#39;t work instead of printf()?&lt;br /&gt;&lt;br /&gt;Here the code, thanks a lot!&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/uart_5F00_pca10040.zip"&gt;devzone.nordicsemi.com/.../uart_5F00_pca10040.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When I push&amp;nbsp;any button the led switch on (if it was off) or switch off (if it was on). That&amp;#39;s ok. The problem is that I can&amp;#39;t see, as the row 51 says, the message &amp;quot;The char received over UART is: %c \r\n&amp;quot;, c&amp;quot;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481928?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 07:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70f905cd-d453-464b-80de-c507ef148c7c</guid><dc:creator>Edvin</dc:creator><description>[quote user="Ste_"]&lt;br /&gt;However, I tried the&amp;nbsp;ble_app_uart example you said and I have the same problem[/quote]
&lt;p&gt;This suggests that putty is not set up correctly. Please check the link to set up the putty terminal from my initial reply.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, if you are testing the ble_app_uart, please note that this will not by default echo whatever you input back to the uart.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Did you try to move the printing (printf()) out of the uart event handler, like I suggested in the previous reply?&lt;/p&gt;
[quote user="Ste_"]nrf_gpio_pin_toggle(led);[/quote]
&lt;p&gt;Does this trigger? Are you sure you are not seeing an even amount of characters, so that the pin toggles a few times, ending up in the same state as it started? (It may be so quick that you don&amp;#39;t see it).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you are still stuck, please upload the application (zip and upload here using &amp;quot;drag and drop&amp;quot;, so&amp;nbsp; that I can have a look. Describe what you expect the behavior to be, and what you observe, so that I can try to replicate this on a DK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481838?ContentTypeID=1</link><pubDate>Fri, 03 May 2024 14:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29214ffd-b856-456b-a030-daba5dd23f72</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Sorry, I mean this printable part in the code: &lt;br /&gt;&lt;br /&gt;&lt;span&gt;// print a message over uart port along with the character information&lt;/span&gt;&lt;br /&gt;&lt;span&gt;printf(&amp;quot;The char received over UART is: %c \r\n&amp;quot;, c);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;nrf_gpio_pin_toggle(led);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;br /&gt;&lt;br /&gt;However, I tried the&amp;nbsp;ble_app_uart example you said and I have the same problem&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481441?ContentTypeID=1</link><pubDate>Thu, 02 May 2024 06:54:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41742554-525f-45d9-ac10-55eb13ddd34b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;What hardware are you running this application on? Is it an nRF52832 DK?&lt;/p&gt;
[quote user="Ste_"]it doesn&amp;#39;t give me back a feedback when I switch on or switch off the led (like a message, as I coded, &amp;quot;Leds Turned On!!&amp;quot; or &amp;quot;Leds Turned Off!!&amp;quot;)[/quote]
&lt;p&gt;I can&amp;#39;t see where it is supposed to print that, but I guess you modified something in the &lt;span&gt;uart_event_handler(). Is the uart_event_handler() triggered when you write a character? It could be that what you are seeing are issues because you are using the UART inside the UART event handler. Try just setting a variable inside the&amp;nbsp;uart_event_handler() callback, and print from main if this is set (for testing/debugging purposes)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Something like:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;// Near top of main.c:
...
unit8_t received_byte = 0x00;

uart_event_handler(...)
{
    ...
    else if (p_event-&amp;gt;evt_type == APP_UART_DATA_READY)
    {
        // Read the available character and store it in the variable
        app_uart_get(&amp;amp;c);

        // print a message over uart port along with the character information
        received_byte = c;
        printf(&amp;quot;The char received over UART is: %c \r\n&amp;quot;, c);
        nrf_gpio_pin_toggle(led);
    
    }
    ...
}


int main(void)
{
    ...
    while (true)
    {
        if (received_byte != 0x00)
        {
            printf(&amp;quot;received byte %c\r\n&amp;quot;, received_byte);
            received_byte = 0x00;
        }
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And see if it prints anything then.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However, you should look into using the RTT log to print log messages, so that it will be independent of the UART. You can look into the SDK\examples\ble_peripheral\ble_app_uart example, as this has some nice UART handling that you can look at.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481376?ContentTypeID=1</link><pubDate>Wed, 01 May 2024 13:32:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5373aa6d-4436-40ab-bc2f-0dffbfff4cc6</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Ok, i set Termite. It allow me to write what I write but it doesn&amp;#39;t give me back a feedback when I switch on or switch off the led (like a message, as I coded, &amp;quot;Leds Turned On!!&amp;quot; or &amp;quot;Leds Turned Off!!&amp;quot;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481375?ContentTypeID=1</link><pubDate>Wed, 01 May 2024 13:27:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7efcd0a6-eeed-4c63-88a2-98588c3375f9</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;br /&gt;Thank you for your answer. I followed your advices on putty but them doesn&amp;#39;t works. About Termite probably i should understand how it works.&lt;br /&gt;&lt;br /&gt;Thanks, regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/481009?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2024 08:37:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:142beb7b-8f44-4e69-a3f2-96fa0e075618</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply, but I was out off office after I got assigned with your ticket.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me see if I understand you correctly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can see the UART messages being printed in the Putty Terminal, but you can&amp;#39;t write back to the nRF via UART?&lt;/p&gt;
&lt;p&gt;Please try to follow &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_cli.html#lib_cli_terminal_settings"&gt;this description&lt;/a&gt;&amp;nbsp;when you set up your PuTTy terminal. Ignore the part about RTT.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Alternatively, you can use another UART terminal. I usually use &amp;quot;Termite&amp;quot;, whenever I need two way communication.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/480515?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 15:52:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d691369-0374-4410-8f3e-2b3ff794b109</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;I already noticed also that if I open PuTTY put in communication the board and my pc and meanwhile I start the debug, I can also see on the terminal debugger the message I was talking about. However i can&amp;#39;t see the message on the PuTTY terminal.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't print message on PuTTY terminal when i use UARTE</title><link>https://devzone.nordicsemi.com/thread/480512?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2024 15:43:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e99dae13-31ae-4565-bb2e-38464da17313</guid><dc:creator>Ste_</dc:creator><description>&lt;p&gt;Just to clarify, i check the right COM&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>