<?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のトピックLPC55s69 32kHz Clock Mode USART</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024732#M39980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using 32kHz mode for usart.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My procedure is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;POWER_EnablePD(kPDRUNCFG_PD_XTAL32K); /*!&amp;lt; Powered down the XTAL 32 kHz RTC oscillator */&lt;BR /&gt; POWER_DisablePD(kPDRUNCFG_PD_FRO32K); /*!&amp;lt; Powered the FRO 32 kHz RTC oscillator */&lt;BR /&gt; CLOCK_AttachClk(kFRO32K_to_OSC32K); /*!&amp;lt; Switch OSC32K to FRO32K */&lt;/P&gt;&lt;P&gt;/*!&amp;lt; Set up dividers */&lt;BR /&gt; CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!&amp;lt; Set AHBCLKDIV divider to value 1 */&lt;BR /&gt; /*!&amp;lt; Set up clock selectors - Attach clocks to the peripheries */&lt;BR /&gt; CLOCK_AttachClk(kOSC32K_to_MAIN_CLK); /*!&amp;lt; Switch MAIN_CLK to OSC32K */&lt;BR /&gt; /*&amp;lt; Set SystemCoreClock variable. */&lt;BR /&gt; SystemCoreClock = 32768U;&lt;/P&gt;&lt;P&gt;POWER_SetVoltageForFreq( 32768U ); /*!&amp;lt; Set voltage for the one of the fastest clock outputs: System clock output */&lt;BR /&gt; CLOCK_SetFLASHAccessCyclesForFreq(32768U); /*!&amp;lt; Set FLASH wait states for core */&lt;/P&gt;&lt;P&gt;CLOCK_SetClkDiv( kCLOCK_DivFlexFrg0, 256U, false ); /*!&amp;lt; Set FRGCTRL0_DIV divider to value 256 */&lt;BR /&gt; CLOCK_AttachClk( kOSC32K_to_FLEXCOMM0 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USART_Init( BOARD_COMMS_UART, &amp;amp;config, CLOCK_GetFlexCommClkFreq( 0U ) );&lt;/P&gt;&lt;P&gt;if(CLOCK_GetFlexCommClkFreq( 0U ) == 32768U){&lt;BR /&gt; BOARD_COMMS_UART-&amp;gt;CFG |= USART_CFG_MODE32K(1);&lt;BR /&gt; BOARD_COMMS_UART-&amp;gt;BRG = 0;&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I send a 16 byte of 0x55 in order to measure the baudrate, it gives me 0.49ms per bit, so the baud rate is 2000, not 9600.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tested the CLKOUT which route to OSC32 clock, it gives me 32kHz correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I set it to 9600 baud rate? Do I miss any steps to enable 32kHz clock mode for usart?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any example code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Dec 2019 11:37:22 GMT</pubDate>
    <dc:creator>francisy</dc:creator>
    <dc:date>2019-12-27T11:37:22Z</dc:date>
    <item>
      <title>LPC55s69 32kHz Clock Mode USART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024732#M39980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using 32kHz mode for usart.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My procedure is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;POWER_EnablePD(kPDRUNCFG_PD_XTAL32K); /*!&amp;lt; Powered down the XTAL 32 kHz RTC oscillator */&lt;BR /&gt; POWER_DisablePD(kPDRUNCFG_PD_FRO32K); /*!&amp;lt; Powered the FRO 32 kHz RTC oscillator */&lt;BR /&gt; CLOCK_AttachClk(kFRO32K_to_OSC32K); /*!&amp;lt; Switch OSC32K to FRO32K */&lt;/P&gt;&lt;P&gt;/*!&amp;lt; Set up dividers */&lt;BR /&gt; CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U, false); /*!&amp;lt; Set AHBCLKDIV divider to value 1 */&lt;BR /&gt; /*!&amp;lt; Set up clock selectors - Attach clocks to the peripheries */&lt;BR /&gt; CLOCK_AttachClk(kOSC32K_to_MAIN_CLK); /*!&amp;lt; Switch MAIN_CLK to OSC32K */&lt;BR /&gt; /*&amp;lt; Set SystemCoreClock variable. */&lt;BR /&gt; SystemCoreClock = 32768U;&lt;/P&gt;&lt;P&gt;POWER_SetVoltageForFreq( 32768U ); /*!&amp;lt; Set voltage for the one of the fastest clock outputs: System clock output */&lt;BR /&gt; CLOCK_SetFLASHAccessCyclesForFreq(32768U); /*!&amp;lt; Set FLASH wait states for core */&lt;/P&gt;&lt;P&gt;CLOCK_SetClkDiv( kCLOCK_DivFlexFrg0, 256U, false ); /*!&amp;lt; Set FRGCTRL0_DIV divider to value 256 */&lt;BR /&gt; CLOCK_AttachClk( kOSC32K_to_FLEXCOMM0 );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USART_Init( BOARD_COMMS_UART, &amp;amp;config, CLOCK_GetFlexCommClkFreq( 0U ) );&lt;/P&gt;&lt;P&gt;if(CLOCK_GetFlexCommClkFreq( 0U ) == 32768U){&lt;BR /&gt; BOARD_COMMS_UART-&amp;gt;CFG |= USART_CFG_MODE32K(1);&lt;BR /&gt; BOARD_COMMS_UART-&amp;gt;BRG = 0;&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I send a 16 byte of 0x55 in order to measure the baudrate, it gives me 0.49ms per bit, so the baud rate is 2000, not 9600.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tested the CLKOUT which route to OSC32 clock, it gives me 32kHz correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I set it to 9600 baud rate? Do I miss any steps to enable 32kHz clock mode for usart?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any example code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Dec 2019 11:37:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024732#M39980</guid>
      <dc:creator>francisy</dc:creator>
      <dc:date>2019-12-27T11:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55s69 32kHz Clock Mode USART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024733#M39981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Francis,&lt;/P&gt;&lt;P&gt;This is the fig of the uart clock:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/100226i3EF8800E0472F094/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think it is correct that you get 2K baudrate.&lt;/P&gt;&lt;P&gt;You use OSC32K as the uart clock source.&lt;/P&gt;&lt;P&gt;Flexcomm Interface clock = (FRG input clock) / (1+(MULT / DIV))&lt;/P&gt;&lt;P&gt;For your case, the DIV=255, the MULT is zero, so the FlexComm0 clock is the 32K OSC.&lt;/P&gt;&lt;P&gt;This is baudrate formula:&lt;/P&gt;&lt;P&gt;baud rate = [FCLK / oversample rate] / BRG divide&lt;/P&gt;&lt;P&gt;For your case, the oversample rate is a fixed value 16, the BRG is 1(which you set up BRG as zero), so the uart baudrate is&lt;/P&gt;&lt;P&gt;32K/16/1=2K.&lt;/P&gt;&lt;P&gt;Hope it can help you&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Dec 2019 02:13:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024733#M39981</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-12-31T02:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55s69 32kHz Clock Mode USART</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024734#M39982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="19420" data-username="xiangjun.rong" href="https://community.nxp.com/people/xiangjun.rong" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: none; font-size: 1.286rem;"&gt;xiangjun.rong&lt;/A&gt;&lt;BR /&gt;But what I need is 9600 baud rate when using 32kHz clock.&lt;/P&gt;&lt;P&gt;It should be achieved by setting&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;USART&lt;SPAN style="color: #51626f; background-color: #f6f6f6;"&gt;-&amp;gt;CFG |= USART_CFG_MODE32K(1);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I have found my mistake.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should disable USART before I change the MODE32K bit in CFG.&lt;/P&gt;&lt;P&gt;Like the below.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void Uart32kClkModeConfig( USART_Type * base)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;CFG &amp;amp;= ~USART_CFG_ENABLE_MASK;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;CFG |= USART_CFG_MODE32K( 1 );&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;BRG = 0;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;OSR = 0;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;base-&amp;gt;CFG |= USART_CFG_ENABLE_MASK;&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2020 13:27:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55s69-32kHz-Clock-Mode-USART/m-p/1024734#M39982</guid>
      <dc:creator>francisy</dc:creator>
      <dc:date>2020-01-02T13:27:53Z</dc:date>
    </item>
  </channel>
</rss>

