<?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>How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72130/how-to-print-floating-numbers-with-nrf-connect-sdk</link><description>Hello, guys. 
 I am using nRF Connect SDK, version 1.4.2 and nRF52840DK. I wonder what would be the way to print floating numbers during debug phase? 
 According to this thread , all we need is to include the following line into prj.conf file: 
 
 as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Sep 2022 20:16:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72130/how-to-print-floating-numbers-with-nrf-connect-sdk" /><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/387171?ContentTypeID=1</link><pubDate>Tue, 20 Sep 2022 20:16:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c35b5a7-e7ce-4bf6-b31e-931701158d59</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Which version of nRF Connect SDK are you using?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;NEWLIB_LIBC_FLOAT_PRINTF&amp;nbsp;&lt;/span&gt;depends on&amp;nbsp;&lt;span&gt;CONFIG_NEWLIB_LIBC, have you set this to &amp;quot;y&amp;quot; as well in your prj.conf file?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/386715?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 19:35:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a85f994-5e8a-4143-9652-0ff230ea186d</guid><dc:creator>NeelSun</dc:creator><description>&lt;p&gt;I&amp;#39;m unable&amp;nbsp; to print float values as well and I get the following error when I try to add&amp;nbsp;&lt;span&gt;CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y in my prj.conf file.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;#39; y&amp;#39; is not a valid value for the bool symbol NEWLIB_LIBC_FLOAT_PRINTF (defined at lib/libc/Kconfig:101). Assignment ignored.&lt;/p&gt;
&lt;p&gt;What could be the reason?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/348937?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 13:16:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3acd9ed9-bf6d-4bb4-9f50-932628f6af2f</guid><dc:creator>hmahdi</dc:creator><description>&lt;p&gt;I had a similar issue. Not sure why, but it just won&amp;#39;t print floats. I solved it by converting to char and printing that instead:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;char buf[MAX];
gcvt( THE_FLOAT, 6, buf);//need to import stdio.h
printk(&amp;quot;%s&amp;quot;,buf);
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/296886?ContentTypeID=1</link><pubDate>Mon, 01 Mar 2021 14:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9d37dc1-0229-4e9b-a98d-8d76d09e36fa</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/bojan"&gt;bojan&lt;/a&gt;, I think what &lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt; meant was that &amp;quot;&lt;span&gt;Segger Debug Terminal&amp;quot; only shows logs/prints from RTT interface, while the printf function is normally redirected to the UART serial terminal.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If nothing is printed at all, this does not sound like an issue with printing floats, but rather how you read the logs/prints in general.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried adding your printf-line to the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.2/nrf/samples/bluetooth/peripheral_uart/README.html"&gt;BLE UART peripheral sample&lt;/a&gt; in NCS v1.4.2, and it prints the float over UART without any added Kconfigs:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;float tmp = 123.456;
printf(&amp;quot;Floating number: %3.2f\n&amp;quot;, tmp);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Output in serial terminal:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.4.0-ncs2  ***
Floating number: 123.46
Starting Nordic UART service example&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/296678?ContentTypeID=1</link><pubDate>Sat, 27 Feb 2021 10:22:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87ad8538-30a4-4cbe-9eb3-834d507df250</guid><dc:creator>bojan</dc:creator><description>&lt;p&gt;Hey, &lt;a href="https://devzone.nordicsemi.com/members/awneil"&gt;awneil&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Thanks for your reply. Unfortunately, I don&amp;#39;t get floating number printed with&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;printf(&amp;quot;Floating number: %3.2f\n&amp;quot;, tmp);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;even on RTT.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to print floating numbers with nRF Connect SDK?</title><link>https://devzone.nordicsemi.com/thread/296675?ContentTypeID=1</link><pubDate>Sat, 27 Feb 2021 09:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8d83de3-16bf-4ca5-8bde-d07e236da46e</guid><dc:creator>awneil</dc:creator><description>[quote userid="76830" url="~/f/nordic-q-a/72130/how-to-print-floating-numbers-with-nrf-connect-sdk"]Nothing is printed in my Segger Debug Terminal[/quote]
&lt;p&gt;I think that only does RTT ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>