<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: scanf functionality in LPC1768 in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1527841#M50263</link>
    <description>&lt;P&gt;I don't have a LPC1768 and the named driver library to try myself.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; But I'm not able to use scanf to get data from UART. I'm getting bus fault error while debugging.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Are you aware that scanf() requires the address of the variables that should accept the scanned value, not the variable itself ? In other words, passing by reference, not by value (like printf()).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The bus fault suggests you got that wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Otherwise, I would check to source code of the low-level implementation underlying the prinf/scanf code of the library.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Sep 2022 05:30:55 GMT</pubDate>
    <dc:creator>frank_m</dc:creator>
    <dc:date>2022-09-26T05:30:55Z</dc:date>
    <item>
      <title>scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1527822#M50262</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use printf and scanf functions for LPC1768 controller in MCUXpresso IDE project.&lt;/P&gt;&lt;P&gt;I'm using -&amp;nbsp;lpc17xx.cmsis.driver.library/blob/master/Drivers/source/debug_frmwrk.c to print data on UART terminal and I am able to print data on UART using printf.&lt;/P&gt;&lt;P&gt;But I'm not able to use scanf to get data from UART. I'm getting bus fault error while debugging.&lt;/P&gt;&lt;P&gt;Is there any project setting required to enable scanf?&lt;/P&gt;&lt;P&gt;Is there any example code for how to use scanf in LPC17xx?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using&amp;nbsp;MCUXpressoIDE_11.5.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;EMB02&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 04:50:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1527822#M50262</guid>
      <dc:creator>emb02</dc:creator>
      <dc:date>2022-09-26T04:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1527841#M50263</link>
      <description>&lt;P&gt;I don't have a LPC1768 and the named driver library to try myself.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; But I'm not able to use scanf to get data from UART. I'm getting bus fault error while debugging.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Are you aware that scanf() requires the address of the variables that should accept the scanned value, not the variable itself ? In other words, passing by reference, not by value (like printf()).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The bus fault suggests you got that wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Otherwise, I would check to source code of the low-level implementation underlying the prinf/scanf code of the library.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 05:30:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1527841#M50263</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-09-26T05:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528146#M50269</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes I know in scanf we have to pass address of the variable. I'm attaching test code.&lt;/P&gt;&lt;P&gt;I'm using CMSIS driver library.&lt;/P&gt;&lt;P&gt;I'm attaching library files used for printf and scanf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 05:38:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528146#M50269</guid>
      <dc:creator>emb02</dc:creator>
      <dc:date>2022-09-27T05:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528580#M50276</link>
      <description>&lt;P&gt;As stated, I don't have your MCU platform available. But I never used standard CLib functions for serial input either.&lt;/P&gt;&lt;P&gt;In your situation, I would try to debug into the code, i.e. into the &lt;FONT face="courier new,courier"&gt;scanf()&lt;/FONT&gt; implementation. If necessary, into the assembler code. Note the values of registers involved in the instruction causing fault. And then relate it back to used variables.&lt;/P&gt;&lt;P&gt;Not sure if you noticed, but &lt;FONT face="courier new,courier"&gt;printf/scanf&lt;/FONT&gt;&amp;nbsp; is not part of the &lt;FONT face="courier new,courier"&gt;debug_frmwrk.c&lt;/FONT&gt; source. This is usually provided in a more generic clib implementation, that often requires you to implement the low-level UART code.&lt;/P&gt;&lt;P&gt;An alternative would be to use the &lt;FONT face="courier new,courier"&gt;getkey()&lt;/FONT&gt; method of your &lt;FONT face="courier new,courier"&gt;debug_frmwrk.c&lt;/FONT&gt; source instead of scanf.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 06:00:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528580#M50276</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-09-27T06:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528756#M50281</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;&lt;P&gt;-&amp;gt;&lt;SPAN&gt;An alternative would be to use the&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;getkey()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;method of your&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;debug_frmwrk.c&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;source instead of scanf.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I'm using this and able to receive data from UART.&lt;/P&gt;&lt;P&gt;I'm attaching debug console library of LPC845 in which printf and scanf works properly.&lt;/P&gt;&lt;P&gt;-&amp;gt;&lt;SPAN&gt;Not sure if you noticed, but&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;printf/scanf&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp; is not part of the&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;debug_frmwrk.c&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;source.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So which library is used for &lt;FONT face="courier new,courier"&gt;printf/scanf&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;for LPC17xx series?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;EMB02&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 11:03:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528756#M50281</guid>
      <dc:creator>emb02</dc:creator>
      <dc:date>2022-09-27T11:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528804#M50283</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I'm using this and able to receive data from UART.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;gt; I'm attaching debug console library of LPC845 in which printf and scanf works properly.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Not sure if that means you are using the LPC845 &lt;FONT face="courier new,courier"&gt;debug_*&lt;/FONT&gt; sources.&lt;BR /&gt;The fsl_*.c/h files are MCU specific, you would need those specific for the LPC176x.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; So which library is used for&amp;nbsp;&lt;FONT face="courier new,courier"&gt;printf/scanf&lt;/FONT&gt;&amp;nbsp;for LPC17xx series?&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I avoid clib functions in general, and printf/scanf in particular, for both code size and runtime issues.&lt;BR /&gt;In the rare instances I want or use direct serial interaction, I did the reception and parsing myself. I.e. receive up to a termination character ('\r','\n'), and convert an ASCII string to decimal or hexadecimal number.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For debugging, I often use the semihosting variant (usually only debug_printf), which comes in a special (semihosting) library. This is routed via the SWD/JTAG, works only with attached debugger, and is very likely not what you want.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I remember correctly, older MCUs like the LPC176x variants lack the specific SDK support in the MCUXpresso IDE environment, as provided for newer one's (I use a LPC5462x).&lt;BR /&gt;I am not very familiar with the&amp;nbsp;LPC176x in this setup, though.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 12:11:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1528804#M50283</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-09-27T12:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1529183#M50291</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt;Not sure if that means you are using the LPC845&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;debug_*&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;sources.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt;The fsl_*.c/h files are MCU specific, you would need those specific for the LPC176x.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm not using LPC845 &lt;FONT face="courier new,courier"&gt;debug_*&lt;/FONT&gt;&amp;nbsp;source files for LPC1768.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I want that specific driver files which contains printf / scanf for LPC1768.&lt;/P&gt;&lt;P&gt;Is there any reference MCUXpresso project available for printf / scanf for LPC17xx series?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;EMB02&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 04:34:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1529183#M50291</guid>
      <dc:creator>emb02</dc:creator>
      <dc:date>2022-09-28T04:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: scanf functionality in LPC1768</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1529231#M50294</link>
      <description>&lt;P&gt;As said, I don't have LPC176X boards.&lt;/P&gt;&lt;P&gt;But have tried the projects that come preinstalled, like described here ?&lt;BR /&gt;&amp;nbsp;&lt;A href="https://copperhilltech.com/blog/lpc17681769-arm-cortex-m3-development-mcuxpresso-ide-installation-and-adding-a-template-project/" target="_blank"&gt;https://copperhilltech.com/blog/lpc17681769-arm-cortex-m3-development-mcuxpresso-ide-installation-and-adding-a-template-project/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And the LPC-Open libraries ?&lt;BR /&gt;&lt;A href="https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples:LPC-OPEN-LIBRARIES" target="_blank"&gt;https://www.nxp.com/design/microcontrollers-developer-resources/lpcopen-libraries-and-examples:LPC-OPEN-LIBRARIES&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 06:02:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/scanf-functionality-in-LPC1768/m-p/1529231#M50294</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-09-28T06:02:38Z</dc:date>
    </item>
  </channel>
</rss>

