<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>Printf weird behavior</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/35787/printf-weird-behavior</link><description> 
Hi guys, 
So I&amp;#39;m facing an annoying issue using printf in keil. The IDE does
not show what I print, furthermore it just keeps printing
continuously random characters like these :
™™™™&amp;#250;&amp;#250;&amp;#177;&amp;#250;y&amp;#177;q&amp;#177;&amp;#249;&amp;#177;&amp;#177;
&amp;#177; &amp;#177; ™&amp;#250;&amp;#177; &amp;#177; &amp;#177;
‘&amp;#177;&amp;#177;
™&amp;#252;&amp;#253;™&amp;#177;&amp;#177;&amp;#250;&amp;#177;&amp;#250;&amp;#250;
%&amp;#177;&amp;#252;&amp;#250;&amp;#169;&amp;#250;&amp;#177;™&amp;#254; 
All I did was declare</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/150491?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 11:58:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0b330382-cf53-4c8b-89ed-f6605ed8f814</guid><dc:creator>Amine Cheriti</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ok I thought USART BR.&lt;br /&gt;
So if I understand clearly ( according to that link too : &lt;a href="http://www.keil.com/support/man/docs/uv4/uv4_db_dbg_serialwin.htm"&gt;http://www.keil.com/support/man/docs/uv4/uv4_db_dbg_serialwin.htm&lt;/a&gt;
) the printf viewer is a serial windows which means it has its own BR
( the one Andrew was talking about previously)?&lt;/p&gt;

&lt;p&gt;
So my problem was probably that this BR value was(might still be)
wrong, which brings me to the following question : where do I set
this BR value? Secondly how do I know the correct value to put it ?
How do I know the BR of the &amp;lt;&amp;lt; device &amp;gt;&amp;gt; the printf is
communicating with?&lt;/p&gt;

&lt;p&gt;
Thank you very much guys !&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/150072?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 11:45:41 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fd0b0e98-38e9-4d8d-99c2-21fc998ed30c</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Evidently using the SWV via &amp;quot;Serial debug (printf) viewer&amp;quot;, and
not a USART&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/141104?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 10:04:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b6001e44-179e-4004-a7f0-856ec7adcc7e</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
The point is that both Baud Rates need to be the same.&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t quite follow your description of the &amp;quot;solution&amp;quot; but,
evidently, one side of the link or the other was not working at the
clock speed that you thought it was, so your baud rate calculation
was giving the wrong answer - because the baud rate is derived from
the clock.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/131695?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 09:04:24 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f3cca890-557c-4254-a23b-70c98176345d</guid><dc:creator>Amine Cheriti</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m not quite sure to understand which BR you&amp;#39;re talking about?
Communication between my computer and the MCU? Where do I set/change
this?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/129571?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 09:02:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:78445f17-c582-44cf-8f83-ac06e19811d4</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
But the setting in your Target was based on a false assumption -
so your Target baud rate &lt;i&gt;&lt;b&gt;was&lt;/b&gt;&lt;/i&gt; wrong.&lt;/p&gt;

&lt;p&gt;
That&amp;#39;s why I asked how you had &lt;i&gt;&lt;b&gt;checked&lt;/b&gt;&lt;/i&gt; the baud
rate!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/121395?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 08:30:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8f5b9d8f-02d4-478e-800b-df903848aa8c</guid><dc:creator>Amine Cheriti</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m using a host application which communicates with my MCU. The
BR of both is set to the same value.&lt;/p&gt;

&lt;p&gt;
However I found my problem , I&amp;#39;m writing the solution here in case
it can help someone in the future :&lt;br /&gt;
I had the change the core Clock in the debug options.&lt;br /&gt;
Go to project otpions -&amp;gt; debug -&amp;gt; settings ( ST-Link
debugger)-&amp;gt; trace-&amp;gt; Core clock&lt;br /&gt;
This value needs to be the same as your MCU clock !&lt;br /&gt;
Hope this helps.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/109570?ContentTypeID=1</link><pubDate>Mon, 24 Sep 2018 09:43:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a94961a6-486c-4f6f-8b3e-3d9c36520dfb</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
How did you check?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/83873?ContentTypeID=1</link><pubDate>Mon, 24 Sep 2018 09:03:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:292ba055-985e-4b08-9a1f-cff5732960d1</guid><dc:creator>Amine Cheriti</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hi Andrew,&lt;br /&gt;
Thanks for your reply !&lt;br /&gt;
I just checked and my Baud rate is good (unfortunately).&lt;/p&gt;

&lt;p&gt;
Amine&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Printf weird behavior</title><link>https://community.arm.com/thread/70907?ContentTypeID=1</link><pubDate>Mon, 24 Sep 2018 08:56:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:92f2a7e3-c729-473c-8c14-493555f79357</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Usually means you have the wrong baud rate - see &lt;i&gt;&amp;quot;Baud Rate
Mismatch&amp;quot;&lt;/i&gt;, about two-thirds down this page:
&lt;a href="https://learn.sparkfun.com/tutorials/serial-communication"&gt;learn.sparkfun.com/.../serial-communication&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>