<?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>Does SEGGER_RTT_Write(0, datBfr, 4) work?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63493/does-segger_rtt_write-0-datbfr-4-work</link><description>I&amp;#39;m seeing some issues I don&amp;#39;t understand when using RTT. Here is a short fragment of code around the RTT_Write statement. 
 
 The commented out statements are included while I try alternatives but not currently relevant. The routine is called a bit less</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Jul 2020 13:26:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63493/does-segger_rtt_write-0-datbfr-4-work" /><item><title>RE: Does SEGGER_RTT_Write(0, datBfr, 4) work?</title><link>https://devzone.nordicsemi.com/thread/259005?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2020 13:26:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:370dde31-e2ca-4077-8a03-6a90aca12038</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;Issue 1) I am storing the terminal window into a log file and using RTT logging to channel 0; they are giving different results&lt;/p&gt;
&lt;p&gt;The intent is to store the ADC data quickly to the desktop using binary. The logging to the terminal window is outputting two of the four bytes with an unrelated third byte in between them, irrespective if I use a 2 or a 4 for the number of bytes to output in the write statement. There are about 169 of the 256 samples output to the SES terminal logging window.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SEGGER_RTT_Write() expects a char array. The 0x00 char is the \0 string termination character. I see that the 0x00 bytes are present in the RTT upload buffer during debugging, but I believe that J-Link RTT Viewer/Logger will interpret these as string end and filter it out of the log. The additional/wrong data you see in the log seems to come from the encoding format of the file reader you are using. ASCII/UTF-8 only defines symbols of characters from 0 to 127 (0x00 to 0x7F). Since 0xCA is above this, it may be undefined/replaced in the hex viewer if it expected a different format. I tested the logs from J-Link RTT Viewer in a hex-editor that supports ISO-8859 encoding (wxMEdit), and it seems to show the symbols correctly in hex-view.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-d2f164230a3145ea8f41801d442ff78b/rtt_5F00_log_5F00_iso8859.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Note that RTT is typically used for text-logging. It may not work very well with logging binary data. Maybe you can log the data as ASCII text strings?&lt;/span&gt;&lt;/p&gt;
[quote user=""]Issue 2) The channel 0 logging window is outputting a lot of undesired text (I would like to not have in the file) and then outputs 2 of the 4 bytes only for about 65 of the 256 samples.[/quote]
&lt;p&gt;This is something you need to check with Segger, as they are the ones creating the RTT client software. They have their own forum &lt;a href="https://forum.segger.com/"&gt;here&lt;/a&gt;.&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>