<?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: LPC1549 UART Bootloader AutoBaud fails in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754734#M30397</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On LPC1549Xpresso board, I ran a quick test on Reinvoke ISP on both UART and USB and didn't see any&lt;/P&gt;&lt;P&gt;problems though. I also tried my IAP code running in either RAM or flash, both work. A quick test you can do&lt;/P&gt;&lt;P&gt;is to make your application bare minimum, e.g.&lt;/P&gt;&lt;P&gt;(1) Only use 12Mhz IRC as MAINCLK.&lt;/P&gt;&lt;P&gt;(2)&amp;nbsp;Enable RAM1 and RAM2, IOCON, SWM, GPIO 0/1/2 clocks in SYSAHBCLKCTRL register.&lt;/P&gt;&lt;P&gt;(3) Disable&amp;nbsp;all interrupts.&lt;/P&gt;&lt;P&gt;(4) Call IAP to read part ID, and then reinvoke ISP with either USB(2) or UART(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you invoke USB ISP, make sure USB is connected to the PC, on reinvoke, USB ISP should&lt;/P&gt;&lt;P&gt;be enumerated as Mass Storage device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, try UART ISP, type "?", "Synchronized" should appear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t ReadIdentification(void) {&lt;BR /&gt;&amp;nbsp; IAP.cmd = IAP_READ_PART_ID;&lt;BR /&gt;&amp;nbsp; IAP_Call (&amp;amp;IAP.cmd, &amp;amp;IAP.stat);&lt;BR /&gt;&amp;nbsp; if (IAP.stat) return (0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (IAP.res[0]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int ReinvokeISP (uint32_t isp_num ) {&lt;BR /&gt;&amp;nbsp; IAP.cmd&amp;nbsp;&amp;nbsp;&amp;nbsp; = IAP_REINVOKE_ISP;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reinvoke ISP&lt;BR /&gt;&amp;nbsp; IAP.par[0] = isp_num;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ISP number, 1=UART ISP, 2=USB ISP, 3=CAN ISP&lt;BR /&gt;&amp;nbsp; IAP_Call (&amp;amp;IAP.cmd, &amp;amp;IAP.stat);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Call IAP Command&lt;BR /&gt;&amp;nbsp; if (IAP.stat) return (IAP.stat);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Command Failed&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Finished without Errors&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the beginning of main, do something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (EN0_RAM1 | EN0_RAM2 | EN0_IOCON | EN0_SWM);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (EN0_EE | EN0_GPIO0 | EN0_GPIO1 | EN0_GPIO2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; i = ReadIdentification();&lt;BR /&gt;&amp;nbsp; if ((i &amp;amp; 0x00001500) != 0x00001500) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (1);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;ReinvokeISP (UART_ISP);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Dec 2017 23:34:23 GMT</pubDate>
    <dc:creator>Dezheng_Tang</dc:creator>
    <dc:date>2017-12-01T23:34:23Z</dc:date>
    <item>
      <title>LPC1549 UART Bootloader AutoBaud fails</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754733#M30396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to get the UART bootloader on the LPC1549 to work.&lt;/P&gt;&lt;P&gt;Reinvoking the ISP from user code works fine, but then the problems start:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I put the call to reinvoke_isp directly into the main() (after all the peripherals have been initialized), autobaud works correctly and the chip answers "SYNCHRONIZED".&lt;/P&gt;&lt;P&gt;In this case the BRG-Register of the USART0 peripheral has a value of 0x4D after the autobaud.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I call reinvoke_isp later by sending a command via UART to the user code, the autobaud-routine fails and sets the BRG register to 0xAC54 which results in a veeeery slow baudrate (approx. 1.5 seconds per char).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only difference between the two cases is that the MCU has to parse the incoming command. Everything else has been successfully initialized in both cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried resetting the USART0 peripheral before reinvoking ISP, but that didn't change anything.&lt;/P&gt;&lt;P&gt;The stackpointer is reset to the top of the stack-32bytes (for IAP) and the upper 32bytes of RAM are excluded from usage by the usercode. (The datasheet mentions that the ROM code uses these bytes.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also compared all SYSCON register values in the working and non-working case. There were no differences.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing? Do I have to initialize/reset anything else to make the autobaud routine work correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking forward to your answers :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Konstantin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 15:04:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754733#M30396</guid>
      <dc:creator>konstantinwerne</dc:creator>
      <dc:date>2017-12-01T15:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1549 UART Bootloader AutoBaud fails</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754734#M30397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On LPC1549Xpresso board, I ran a quick test on Reinvoke ISP on both UART and USB and didn't see any&lt;/P&gt;&lt;P&gt;problems though. I also tried my IAP code running in either RAM or flash, both work. A quick test you can do&lt;/P&gt;&lt;P&gt;is to make your application bare minimum, e.g.&lt;/P&gt;&lt;P&gt;(1) Only use 12Mhz IRC as MAINCLK.&lt;/P&gt;&lt;P&gt;(2)&amp;nbsp;Enable RAM1 and RAM2, IOCON, SWM, GPIO 0/1/2 clocks in SYSAHBCLKCTRL register.&lt;/P&gt;&lt;P&gt;(3) Disable&amp;nbsp;all interrupts.&lt;/P&gt;&lt;P&gt;(4) Call IAP to read part ID, and then reinvoke ISP with either USB(2) or UART(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you invoke USB ISP, make sure USB is connected to the PC, on reinvoke, USB ISP should&lt;/P&gt;&lt;P&gt;be enumerated as Mass Storage device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, try UART ISP, type "?", "Synchronized" should appear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t ReadIdentification(void) {&lt;BR /&gt;&amp;nbsp; IAP.cmd = IAP_READ_PART_ID;&lt;BR /&gt;&amp;nbsp; IAP_Call (&amp;amp;IAP.cmd, &amp;amp;IAP.stat);&lt;BR /&gt;&amp;nbsp; if (IAP.stat) return (0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (IAP.res[0]);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int ReinvokeISP (uint32_t isp_num ) {&lt;BR /&gt;&amp;nbsp; IAP.cmd&amp;nbsp;&amp;nbsp;&amp;nbsp; = IAP_REINVOKE_ISP;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Reinvoke ISP&lt;BR /&gt;&amp;nbsp; IAP.par[0] = isp_num;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ISP number, 1=UART ISP, 2=USB ISP, 3=CAN ISP&lt;BR /&gt;&amp;nbsp; IAP_Call (&amp;amp;IAP.cmd, &amp;amp;IAP.stat);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Call IAP Command&lt;BR /&gt;&amp;nbsp; if (IAP.stat) return (IAP.stat);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Command Failed&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Finished without Errors&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the beginning of main, do something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (EN0_RAM1 | EN0_RAM2 | EN0_IOCON | EN0_SWM);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL0 |= (EN0_EE | EN0_GPIO0 | EN0_GPIO1 | EN0_GPIO2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; i = ReadIdentification();&lt;BR /&gt;&amp;nbsp; if ((i &amp;amp; 0x00001500) != 0x00001500) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (1);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;ReinvokeISP (UART_ISP);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 23:34:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754734#M30397</guid>
      <dc:creator>Dezheng_Tang</dc:creator>
      <dc:date>2017-12-01T23:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1549 UART Bootloader AutoBaud fails</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754735#M30398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the error! The terminal program I was using always sent a null-byte when closing....&lt;/P&gt;&lt;P&gt;So every time I invoked the bootloader via serial command, closed the terminal program and reopened it with another baudrate setting. By the time I send my '?' the autobaud routine has seen the null-byte and calculated a wrong value...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2017 10:36:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1549-UART-Bootloader-AutoBaud-fails/m-p/754735#M30398</guid>
      <dc:creator>konstantinwerne</dc:creator>
      <dc:date>2017-12-04T10:36:30Z</dc:date>
    </item>
  </channel>
</rss>

