<?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>LPC Microcontrollers中的主题 Re: LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869489#M56111</link>
    <description>&lt;P&gt;I am using the internal oscillator. That may be the reason for the issue?.&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2024 08:01:10 GMT</pubDate>
    <dc:creator>BerlinRaj</dc:creator>
    <dc:date>2024-05-21T08:01:10Z</dc:date>
    <item>
      <title>LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869442#M56109</link>
      <description>&lt;P&gt;Hi, I am using an LPC865M201JHI48 customized microcontroller board. I copied the SDK example of the LPC865 USART polling method and used it in my code. However, it is transmitting some garbage values. For example, if I transmit 'a', I receive '0' on my serial terminal software, PuTTY. I am unable to understand some parts of the code. Can anyone explain which registers should be configured in the&lt;/P&gt;&lt;P&gt;USART_Init(EXAMPLE_USART, &amp;amp;config, EXAMPLE_USART_CLK_FREQ);&amp;nbsp; function? Why are we using the default configuration function&amp;nbsp;USART_GetDefaultConfig(&amp;amp;config); ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;status_t USART_Init(USART_Type *base, const usart_config_t *config, uint32_t srcClock_Hz)&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Check arguments */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; assert(!((NULL == base) || (NULL == config) || (0U == srcClock_Hz)));&lt;/DIV&gt;&lt;DIV&gt;#if defined(FSL_FEATURE_USART_HAS_RXIDLETO_CHECK) &amp;amp;&amp;amp; FSL_FEATURE_USART_HAS_RXIDLETO_CHECK&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; assert(8U &amp;gt; config-&amp;gt;rxIdleTimeout);&lt;/DIV&gt;&lt;DIV&gt;#endif&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; status_t status = kStatus_Success;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; uint32_t instance = USART_GetInstance(base);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) &amp;amp;&amp;amp; FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Enable the clock. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; CLOCK_EnableClock(s_usartClock[instance]);&lt;/DIV&gt;&lt;DIV&gt;#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#if !(defined(FSL_SDK_DISABLE_DRIVER_RESET_CONTROL) &amp;amp;&amp;amp; FSL_SDK_DISABLE_DRIVER_RESET_CONTROL)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Reset the module. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; RESET_PeripheralReset(s_usartRest[instance]);&lt;/DIV&gt;&lt;DIV&gt;#endif /* FSL_SDK_DISABLE_DRIVER_RESET_CONTROL */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//CLOCK_EnableClock(s_usartClock[instance]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;// SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (1&amp;lt;&amp;lt;14);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;/* Reset the module. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//RESET_PeripheralReset(s_usartRest[instance]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;// SYSCON-&amp;gt;PRESETCTRL0 &amp;amp;=~(1&amp;lt;&amp;lt;14);//Assert the usart0 reset&lt;/DIV&gt;&lt;DIV&gt;// SYSCON-&amp;gt;PRESETCTRL0 |= (1&amp;lt;&amp;lt;14);//Clear the usart0 reset&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG &amp;amp;= ~(0x30);//NO PARITY&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG &amp;amp;= ~(1&amp;lt;&amp;lt;6);//ONE STOP BIT&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG &amp;amp;= ~(1&amp;lt;&amp;lt;11);//Asynchronous mode is selected.&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG &amp;amp;= ~(1&amp;lt;&amp;lt;6);//ONE STOP BIT&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG &amp;amp;= ~(0x3 &amp;lt;&amp;lt; 2);//clear 8-bit data length&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG |= (0x1 &amp;lt;&amp;lt; 2);//set the 8-bit data length&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG |= (1 &amp;lt;&amp;lt; 14);//usart0 in master mode&lt;/DIV&gt;&lt;DIV&gt;// USART0-&amp;gt;CFG |= (1 &amp;lt;&amp;lt; 0);//Enable the uart&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; /* Setup configuration and enable USART to configure other register. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; base-&amp;gt;CFG = USART_CFG_PARITYSEL(config-&amp;gt;parityMode) | USART_CFG_STOPLEN(config-&amp;gt;stopBitCount) |&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_CFG_SYNCEN((uint32_t)config-&amp;gt;syncMode &amp;gt;&amp;gt; 1) |&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_CFG_DATALEN((uint8_t)config-&amp;gt;bitCountPerChar) | USART_CFG_LOOP(config-&amp;gt;loopback) |&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_CFG_SYNCMST(config-&amp;gt;syncMode) | USART_CFG_CLKPOL(config-&amp;gt;clockPolarity) |&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_CFG_CTSEN(config-&amp;gt;enableHardwareFlowControl) | USART_CFG_ENABLE_MASK;&lt;/DIV&gt;&lt;DIV&gt;#if defined(FSL_FEATURE_USART_HAS_RXIDLETO_CHECK) &amp;amp;&amp;amp; FSL_FEATURE_USART_HAS_RXIDLETO_CHECK&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; base-&amp;gt;CTL |= USART_CTL_RXIDLETOCFG(config-&amp;gt;rxIdleTimeout);&lt;/DIV&gt;&lt;DIV&gt;#endif&lt;/DIV&gt;&lt;DIV&gt;#if defined(FSL_SDK_USART_DRIVER_ENABLE_BAUDRATE_AUTO_GENERATE) &amp;amp;&amp;amp; (FSL_SDK_USART_DRIVER_ENABLE_BAUDRATE_AUTO_GENERATE)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; if (0U != config-&amp;gt;baudRate_Bps)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Setup baudrate */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (kStatus_Success != USART_SetBaudRate(base, config-&amp;gt;baudRate_Bps, srcClock_Hz))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; status = kStatus_USART_BaudrateNotSupport;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;#else&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; base-&amp;gt;BRG&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= FSL_SDK_USART_BRG_VALUE;&lt;/DIV&gt;&lt;DIV&gt;#if defined(FSL_FEATURE_USART_HAS_OSR_REGISTER) &amp;amp;&amp;amp; (FSL_FEATURE_USART_HAS_OSR_REGISTER)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; base-&amp;gt;OSR&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= FSL_SDK_USART_BRG_VALUE;&lt;/DIV&gt;&lt;DIV&gt;#endif /* FSL_FEATURE_USART_HAS_OSR_REGISTER */&lt;/DIV&gt;&lt;DIV&gt;#endif /* FSL_SDK_USART_DRIVER_ENABLE_BAUDRATE_AUTO_GENERATE */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; if (status == kStatus_Success)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_EnableContinuousSCLK(base, config-&amp;gt;enableContinuousSCLK);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Setup the USART transmit and receive. */&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_EnableTx(base, config-&amp;gt;enableTx);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; USART_EnableRx(base, config-&amp;gt;enableRx);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; return status;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 May 2024 07:05:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869442#M56109</guid>
      <dc:creator>BerlinRaj</dc:creator>
      <dc:date>2024-05-21T07:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869488#M56110</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; Hi, I am using an LPC865M201JHI48 customized microcontroller board. I copied the SDK example of the LPC865 USART polling method ...&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You will have to make sure the SDK example applies (correct MCU and ext. quartz oscillator), and that that your custom board design is correct so far.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; However, it is transmitting some garbage values. For example, if I transmit 'a', I receive '0' on my serial terminal software, PuTTY.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Take a scope and measure actual signal. Otherwise you are just poking around in the dark.&lt;BR /&gt;Both baudrate and signal level could be incorrect. A 3.3V MCU output is not able to drive a TTL level input of a serial adapter.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; // USART0-&amp;gt;CFG &amp;amp;= ~(0x30);//NO PARITY&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;EM&gt;&amp;gt; ...&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;I'm not going to decode the bit operation with the datasheet / user manual.&lt;BR /&gt;Start with the actual UART signal.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 07:56:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869488#M56110</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2024-05-21T07:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869489#M56111</link>
      <description>&lt;P&gt;I am using the internal oscillator. That may be the reason for the issue?.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 08:01:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869489#M56111</guid>
      <dc:creator>BerlinRaj</dc:creator>
      <dc:date>2024-05-21T08:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869513#M56112</link>
      <description>&lt;P&gt;This might well be.&lt;BR /&gt;I don't have a LPC865 eval board, much less your custom board.&lt;BR /&gt;But a change in the clock tree surely affects all peripherals, whose clock generation is derived (usually) from the core clock.&lt;/P&gt;&lt;P&gt;As said, I highly recommend to check the UART signal with a scope. It will also reveal the actual baudrate.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 08:23:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1869513#M56112</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2024-05-21T08:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC865M201JHI48 USART DRIVER EXAMPLE DOUBT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1870398#M56124</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/223867"&gt;@BerlinRaj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;USART_GetDefaultConfig(&amp;amp;config)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This function is used&amp;nbsp; to obtain the common default configuration. You can also customize the configuration according to your needs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;USART_Init(EXAMPLE_USART, &amp;amp;config, EXAMPLE_USART_CLK_FREQ)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;This function initializes USART based on the previous configuration.&lt;/P&gt;
&lt;P&gt;As you mentioned "&lt;SPAN&gt;f I transmit 'a', I receive '0' on my serial terminal software, PuTTY.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;I completely agree with &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/137574"&gt;@frank_m&lt;/a&gt;, you should observe the output signal through an oscilloscope, which can show both the clock frequency and the bit.&lt;/P&gt;
&lt;P&gt;Hope this will help you.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Hang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 07:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC865M201JHI48-USART-DRIVER-EXAMPLE-DOUBT/m-p/1870398#M56124</guid>
      <dc:creator>Harry_Zhang</dc:creator>
      <dc:date>2024-05-22T07:48:39Z</dc:date>
    </item>
  </channel>
</rss>

