<?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: [SOLVED] LPC1778 hard fault during UART setup in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524665#M7301</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 12:50:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I figured it out (at least I can run through the previously-problematic code now)- it looks like my startup code and/or linker script was FUBAR. Hopefully I won't be back saying I was wrong about that ;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for putting me on to looking there (as you did when mentioning stack size)!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: I should probably mention that the startup code/linker found here seems to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fbitbucket.org%2Fsmartavionics%2Flpcopen-make%2Fsrc" rel="nofollow" target="_blank"&gt;https://bitbucket.org/smartavionics/lpcopen-make/src&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to tweak it a bit to actually call main() and to remove a bunch of irrelevant stuff, but things seem OK now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:07:14 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:07:14Z</dc:date>
    <item>
      <title>[SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524651#M7287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Sat Oct 25 13:38:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;SOLVED! The issue was my linker command line not including "-mcpu=cortex-m3 -mthumb". This was causing GCC to link in the ARM version of libgcc.a instead of the Thumb version. Since the Cortex M3 can't execute ARM instructions, this caused the issues I was experiencing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to get the MCI and UARTs working on my LPC1778 board. The board is one I designed and built myself, and physically it seems to function fine. I can use timers and toggle GPIOs, but am getting some really weird behavior with trying to configure the UARTs and MCI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using GCC-ARM-Embedded 4.8-2014-q3-update (also tried with 4.8-2013-q4 and 4.6-2012-something) under Linux, with no IDE (just a Makefile and lpc21isp to program with a USB-serial adapter).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's what happens: I try to initialize the UART, and it just... freezes during the UART_Init call (more specifically, in the uart_set_divisors function within that call). By adding code to toggle a GPIO and moving it around until things fail, I've narrowed it down to the code failing on this line in uart_set_divisors (about line 145 in lpc177x_8x_uart.c):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;//Code executes to here

/* can not find best match */
if(best_divisor == 0) 
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //...but not here
&amp;nbsp;&amp;nbsp;&amp;nbsp; return ERROR;
}

//...or here&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Which makes no sense to me, since it should make it to ONE of those points, and it's not like there's a possible divide-by-zero or some such.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My main function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;int main()
{
TIM_TIMERCFG_Type tinit;
tinit.PrescaleOption = TIM_PRESCALE_TICKVAL;
tinit.PrescaleValue = 12; //12 seems to be the correct value for 24 MHz
TIM_Init(LPC_TIM0, TIM_TIMER_MODE, &amp;amp;tinit);

Delay(500);

GPIO_Init();
GPIO_SetDir(4, 1&amp;lt;&amp;lt;5, GPIO_DIRECTION_OUTPUT); //LCD reset line


//Try to set up UART
UART_CFG_Type cfg;
UART_FIFO_CFG_Type UARTFIFOConfigStruct;

&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; //setting these to '2' gives UART3 control of p0[2,3]
PINSEL_ConfigPin(0, 2, 2);
PINSEL_ConfigPin(0, 3, 2);

UART_ConfigStructInit(&amp;amp;cfg);

UART_Init(UART_3, &amp;amp;cfg); //this never returns

UART_FIFOConfigStructInit(&amp;amp;UARTFIFOConfigStruct);
UART_FIFOConfig(UART_3, &amp;amp;UARTFIFOConfigStruct);
UART_TxCmd(UART_3, ENABLE);


//should get here and loop forever
while(1)
{
LPC_GPIO4-&amp;gt;SET = 1&amp;lt;&amp;lt;5;
char buf[] = "foobar\n";
LPC_GPIO4-&amp;gt;CLR = 1&amp;lt;&amp;lt;5;
UART_SendByte(UART_3,&amp;nbsp; 0x55);
}

return 0;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Only changed section in system_LPC177x_8x.c:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;background-color:#cacaca;background-color:#cacaca;border:1px solid black;background-color:#cacaca;border:1px solid black;"&gt; &lt;PRE&gt;#define CLOCK_SETUP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
//#define SCS_Val&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; 0x00000021
//0000 Changed to disable use of main oscillator- we don't have one!
#define SCS_Val&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; 0x00000001

//0000 Again, changed to use the internal RC oscillator
//#define CLKSRCSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001
#define CLKSRCSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000000
#define PLL0_SETUP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
#define PLL0CFG_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000009
//#define PLL0CFG_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000002
//0000 Don't use PLL1 with internal RC oscillator
//#define PLL1_SETUP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1
#define PLL1_SETUP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0
#define PLL1CFG_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000023
//0000 Try using sysclk directly, without the PLL
//#define CCLKSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000101
#define CCLKSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001
#define USBCLKSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000201
#define EMCCLKSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000001
#define PCLKSEL_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000002
#define PCONP_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x042887DE
#define CLKOUTCFG_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00000100&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Full code is attached. There are a bunch of extra files that can be ignored (ili9325*, map_*, gps_* font*, ...; basically main.c and the files listed above are all that I've mucked with).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's no crystal attached to the chip, so I'm using the onboard oscillator. I've tried adjusting the frequency (slowing things down), not using the PLL, and compiling without optimizations, all with the same result as noted above. I've also assembled a second board that exhibits the exact same problems as the first, so either it's a highly-specific and very coincidental hardware failure, or the hardware is fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suppose it's also possible I messed something up on my board layout, but I don't see how that would cause the hangup where I'm seeing it. Board schematic is attached, in case that's helpful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For debugging, I've got access to a multimeter and an oscilloscope. And a USB-serial adapter, obviously, but that doesn't do much good when the UART isn't working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be much appreciated. I'm completely baffled as to why things would fail in such a manner.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: I've since determined that the code is going to the hard fault handler, for no reason as far as I can tell.&lt;/SPAN&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-338087" rel="nofollow noopener noreferrer" target="_blank"&gt;uart_test_code.tar.gz&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524651#M7287</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524652#M7288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Sat Oct 25 13:59:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you enable UART3 in PCONP?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524652#M7288</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524653#M7289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Sat Oct 25 14:10:33 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like that's done first-thing in UART_Init:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;oid UART_Init(UART_ID_Type UartID, UART_CFG_Type *UART_ConfigStruct)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t tmp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (UartID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_3:
&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; LPC_UART_TypeDef *UARTx = uart_get_pointer(UartID);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(UartID == UART_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; /* Set up clock and power for UART module */
&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; CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCUART0, ENABLE);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(UartID == UART_2)
&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; /* Set up clock and power for UART module */
&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; CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCUART2, ENABLE);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(UartID == UART_3)
&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; /* Set up clock and power for UART module */
&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; CLKPWR_ConfigPPWR (CLKPWR_PCONP_PCUART3, ENABLE);;
...&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, yes, as best I can tell.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524653#M7289</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524654#M7290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by LabRat on Sat Oct 25 14:28:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: dbtayl&lt;/STRONG&gt;&lt;BR /&gt;So, yes, as best I can tell.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; :) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would strongly recommend to use a debugger...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In general it's useful to enable PLL to use 120MHz main clock and check that with CLKOUT... &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524654#M7290</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524655#M7291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Sat Oct 25 14:59:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: LabRat&lt;/STRONG&gt;&lt;BR /&gt;:) &lt;BR /&gt;&lt;BR /&gt;I would strongly recommend to use a debugger...&lt;BR /&gt;&lt;BR /&gt;In general it's useful to enable PLL to use 120MHz main clock and check that with CLKOUT...&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wish I had a debugger to use, but I don't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I CAN set the PLL to be used as the clock, and get a 120 MHz wave on CLKOUT. So that much works at least. It still seems to fail at the same point noted in the first post, though- ie, in the middle of a function while doing nothing that seems like it should cause an issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524655#M7291</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524656#M7292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Sat Oct 25 21:38:03 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;After a little more work, I've determined that the code is jumping to the "HardFault_Handler"... does that shed any light on the situation?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: It's also evidently a bus fault, with only the PRECISERR bit set in CFSR. I don't have a way to make use of the address of the error, though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524656#M7292</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524657#M7293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Wed Oct 29 11:49:55 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I take it nobody else has had a similar problem? It seems unlikely that it's the code (as it's the NXP-provided support code), nor the compiler (as it's the official ARM-GCC package) is the issue, so...?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hardware issues? I've tried two chips and they behave identically, so I guess it would have to be a bad batch or something. I don't see anything in the errata regarding such a problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically I can't figure out why something would cause a bus fault when no pointers are being passed around, and I'm using the NXP-provided code with the ARM-provided compiler.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524657#M7293</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524658#M7294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Oct 30 06:23:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is it possible that there is an interrupt whose vector is not set correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Or is there an access using a pointer to an invalid address? Maybe you don't get a good pointer to the UART registers?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524658#M7294</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524659#M7295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 08:34:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The interrupt vector table looks to be correct. I'm not entirely familiar with assembly, but it appears that dummy ISRs have been defined in the startup code for all interrupts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;/* IRQ Handlers */

&amp;nbsp;&amp;nbsp;&amp;nbsp; .globl&amp;nbsp; Default_Handler
&amp;nbsp;&amp;nbsp;&amp;nbsp; .type&amp;nbsp;&amp;nbsp; Default_Handler, %function
Default_Handler:
&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; .size&amp;nbsp;&amp;nbsp; Default_Handler, . - Default_Handler

&amp;nbsp;&amp;nbsp;&amp;nbsp; .macro&amp;nbsp; IRQ handler
&amp;nbsp;&amp;nbsp;&amp;nbsp; .weak&amp;nbsp;&amp;nbsp; \handler
&amp;nbsp;&amp;nbsp;&amp;nbsp; .set&amp;nbsp;&amp;nbsp;&amp;nbsp; \handler, Default_Handler
&amp;nbsp;&amp;nbsp;&amp;nbsp; .endm

&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WDT_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIMER0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIMER1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIMER2_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIMER3_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART2_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART3_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PWM1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I2C0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I2C1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I2C2_IRQHandler
/*&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQSPIFI_IRQHandler */
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SSP0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SSP1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLL0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RTC_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EINT0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EINT1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EINT2_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EINT3_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BOD_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USB_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAN_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DMA_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I2S_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENET_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCI_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MCPWM_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QEI_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLL1_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USBActivity_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CANActivity_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UART4_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SSP2_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LCD_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PWM0_IRQHandler
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRQ&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EEPROM_IRQHandler&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is that not the case?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In any case, that's something to check- I'll see if disabling all interrupts before attempting to run the code changes the behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like there should be no problem getting the UART pointer; uart_get_pointer is used, which returns the correct address (or should, based on the constants defined and referencing the user manual).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on where the code is failing, though, I can't see how a bad pointer could be the problem. It's not doing anything with pointers at that time. By the same token, if I can get it into an infinite loop before the point where it crashes, it doesn't fault, so I'm not really convinced an interrupt is the issue either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524659#M7295</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524660#M7296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Oct 30 08:38:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the vectors in the code you sent are only declarations, not the interrupt routines themselves. Sometimes all interrupts are serviced by the same routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you make sure that get_uart_pointer did not return NULL?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524660#M7296</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524661#M7297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 09:22:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I've simplified the code so now it's just running the function that's causing the fault (uart_set_divisors, provided by NXP). It still reaches the fault handler, before it ever uses that pointer (or, indeed, calls get_uart_pointer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the pared-down code (again, with the uart_set_divisors taken from NXP-provided code):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void HardFault_Handler(void)
{
LPC_GPIO4-&amp;gt;CLR = 1&amp;lt;&amp;lt;28;
while(1)
{
}
}


Status uart_set_divisors(UART_ID_Type UartID, uint32_t baudrate)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Status errorStatus = ERROR;

&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t uClk;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t d, m, bestd, bestm, tmp;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint64_t best_divisor, divisor;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t current_error, best_error;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t recalcbaud;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* get UART block clock */
&amp;nbsp;&amp;nbsp;&amp;nbsp; uClk = CLKPWR_GetCLK(CLKPWR_CLKTYPE_PER);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* In the Uart IP block, baud rate is calculated using FDR and DLL-DLM registers
&amp;nbsp;&amp;nbsp;&amp;nbsp; * The formula is :
&amp;nbsp;&amp;nbsp;&amp;nbsp; * BaudRate= uClk * (mulFracDiv/(mulFracDiv+dividerAddFracDiv) / (16 * (DLL)
&amp;nbsp;&amp;nbsp;&amp;nbsp; * It involves floating point calculations. That's the reason the formulae are adjusted with
&amp;nbsp;&amp;nbsp;&amp;nbsp; * Multiply and divide method.*/
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* The value of mulFracDiv and dividerAddFracDiv should comply to the following expressions:
&amp;nbsp;&amp;nbsp;&amp;nbsp; * 0 &amp;lt; mulFracDiv &amp;lt;= 15, 0 &amp;lt;= dividerAddFracDiv &amp;lt;= 15 */
&amp;nbsp;&amp;nbsp;&amp;nbsp; best_error = 0xFFFFFFFF; /* Worst case */
&amp;nbsp;&amp;nbsp;&amp;nbsp; bestd = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bestm = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; best_divisor = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; //NOTE: OK here
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (m = 1 ; m &amp;lt;= 15 ;m++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (d = 0 ; d &amp;lt; m ; d++)
&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; divisor = ((uint64_t)uClk &amp;lt;&amp;lt; 28)*m / (baudrate*(m+d));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; current_error = divisor &amp;amp; 0xFFFFFFFF;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp = divisor&amp;gt;&amp;gt;32;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Adjust error */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(current_error &amp;gt; ((uint32_t)1&amp;lt;&amp;lt;31))
&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; current_error = -current_error;
&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; tmp++;
&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; /* Out of range */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tmp &amp;lt; 1 || tmp &amp;gt; 65536)
&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; continue;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( current_error &amp;lt; best_error)
&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; best_error = current_error;
&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; best_divisor = tmp;
&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; bestd = d;
&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; bestm = m;
&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; if(best_error == 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; break;
&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; } /* end of inner for loop */

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (best_error == 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp; } /* end of outer for loop&amp;nbsp; */
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* can not find best match */
&amp;nbsp;&amp;nbsp;&amp;nbsp; //This check seems to fail----------------------------------------------
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(best_divisor == 0) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
//Never reached
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ERROR;
}

//never reached
while(1)
{
}

&amp;nbsp;&amp;nbsp;&amp;nbsp; return errorStatus;
}

int main()
{
//Remove all interrupts
NVIC_DeInit();

GPIO_Init();
GPIO_SetDir(4, 1&amp;lt;&amp;lt;28|1&amp;lt;&amp;lt;29, GPIO_DIRECTION_OUTPUT);
LPC_GPIO4-&amp;gt;SET = 1&amp;lt;&amp;lt;28|1&amp;lt;&amp;lt;29;

uart_set_divisors(UART_0, 115200);

LPC_GPIO4-&amp;gt;CLR = 1&amp;lt;&amp;lt;29; //circle GPS pin LOW == GOOD!

while(1)
{
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, as far as I can tell (for the interrupts in the startup code), Default_Handler is defined, "IRQ" is defined as a macro for "handler", which is then defined as a weak alials for Default_Handler... so there should be a default handler installed for all interrupts? In any case, there really shouldn't be any interrupts going on in the above code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Yes, I realize that it will never return from uart_set_divisors; the point is that it ends up in the fault handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT2: If I comment out the infinite loop and "if(best_divisor == 0)" lines, the function returns just fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524661#M7297</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524662#M7298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Oct 30 09:52:03 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I just realized that best_divisor is a 64 bit variable. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One reason might be that there is a stack overflow which leads to an alignment error when best_divisor is read just before performing the check.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you check stack space?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524662#M7298</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524663#M7299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 09:59:36 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Stack size was set at 1k. I bumped it up to 8k, with no change.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The startup file also had ".align&amp;nbsp; 3" specified; I changed it to an 8-byte alignment (".align&amp;nbsp; 8", in case there was a problem with a uint64 not being on such a boundary), though that didn't seem to help either.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524663#M7299</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524664#M7300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Oct 30 10:03:54 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;you can take a look at the assembly output of the file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Check which instructions are used at the point of crash. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you perform a register dump in the hard fault handler?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524664#M7300</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524665#M7301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 12:50:59 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I figured it out (at least I can run through the previously-problematic code now)- it looks like my startup code and/or linker script was FUBAR. Hopefully I won't be back saying I was wrong about that ;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for putting me on to looking there (as you did when mentioning stack size)!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: I should probably mention that the startup code/linker found here seems to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fbitbucket.org%2Fsmartavionics%2Flpcopen-make%2Fsrc" rel="nofollow" target="_blank"&gt;https://bitbucket.org/smartavionics/lpcopen-make/src&lt;/A&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had to tweak it a bit to actually call main() and to remove a bunch of irrelevant stuff, but things seem OK now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524665#M7301</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524666#M7302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 13:05:21 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Nevermind... I lied. Back to debugging.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524666#M7302</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524667#M7303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Thu Oct 30 14:57:01 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't have any way to use a register dump in the hard fault handler- I have no debugger or any method of communication with the chip, really.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The fault occurs around these lines:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;.LVL24:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .loc 1 163 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orrs&amp;nbsp;&amp;nbsp;&amp;nbsp; r3, r10, fp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beq&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .L29
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .L15
.LVL25:
.L25:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, [sp, #24]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r5, r6
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r0, [\sp]&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(backslash added otherwise formatting eats the "sp" in brackets)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Which corresponds to the line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;if(best_divisor == 0)&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides it seeming odd that the frame pointer is evidently being used as a general purpose register, I don't see a problem with that. I suppose if the stack pointer got messed up that could cause a problem? I can't narrow it down to exactly which instruction is causing the fault.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: Nevermind, I can (kind of) read assembly- honest! .LVL25 shouldn't be reached from .LVL24...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524667#M7303</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524668#M7304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Fri Oct 31 03:12:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;can you post a list file containing both C and assembly code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So we can see how the C instructions are converted and which registers are used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;can you configure a second uart by writing directly to the uart registers? this should provide an option for a register dump. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You should compare the assembly code with the register content take special care of the pointer instructions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524668#M7304</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524669#M7305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Fri Oct 31 07:54:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;(Files also attached in .tar.gz file)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;main.c:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;#include "lpc177x_8x_gpio.h"
#include "lpc177x_8x_timer.h"
#include "lpc177x_8x_uart.h"
#include "lpc177x_8x_clkpwr.h"
#include "core_cm3.h"

//Hard fault seems to be caused by bus fault
//Just PRECISERR, none of the other bits set
//Wait... BFARVALID also seems to be set
void HardFault_Handler(void)
{
//Sqare GPS pin low -&amp;gt; error
LPC_GPIO4-&amp;gt;CLR = 1&amp;lt;&amp;lt;28;
while(1)
{
}
}


LPC_UART_TypeDef *uart_get_pointer(UART_ID_Type UartID)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_UART_TypeDef *UARTx = NULL;
&amp;nbsp;&amp;nbsp;&amp;nbsp; switch(UartID)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UARTx = LPC_UART0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_2:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UARTx = LPC_UART2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UART_3:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UARTx = LPC_UART3;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; default:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return UARTx;
}


Status uart_set_divisors(UART_ID_Type UartID, uint32_t baudrate)
{
Status errorStatus = ERROR;

uint32_t uClk;
uint32_t d, m, bestd, bestm, tmp;
UNS_64 best_divisor, divisor;
uint32_t current_error, best_error;
uint32_t recalcbaud;

/* get UART block clock */
uClk = CLKPWR_GetCLK(CLKPWR_CLKTYPE_PER);

/* In the Uart IP block, baud rate is calculated using FDR and DLL-DLM registers
* The formula is :
* BaudRate= uClk * (mulFracDiv/(mulFracDiv+dividerAddFracDiv) / (16 * (DLL)
* It involves floating point calculations. That's the reason the formulae are adjusted with
* Multiply and divide method.*/

/* The value of mulFracDiv and dividerAddFracDiv should comply to the following expressions:
* 0 &amp;lt; mulFracDiv &amp;lt;= 15, 0 &amp;lt;= dividerAddFracDiv &amp;lt;= 15 */
best_error = 0xFFFFFFFF; /* Worst case */
bestd = 0;
bestm = 0;
best_divisor = 0;

for (m = 1 ; m &amp;lt;= 15 ;m++)
{
for (d = 0 ; d &amp;lt; m ; d++)
{
divisor = ((uint64_t)uClk &amp;lt;&amp;lt; 28)*m / (baudrate*(m+d));
current_error = divisor &amp;amp; 0xFFFFFFFF;

tmp = divisor&amp;gt;&amp;gt;32;

/* Adjust error */
if(current_error &amp;gt; ((uint32_t)1&amp;lt;&amp;lt;31))
{
current_error = -current_error;
tmp++;
}

/* Out of range */
if(tmp &amp;lt; 1 || tmp &amp;gt; 65536)
continue;

if( current_error &amp;lt; best_error)
{
best_error = current_error;
best_divisor = tmp;
bestd = d;
bestm = m;

if(best_error == 0) 
break;
}
} /* end of inner for loop */

if (best_error == 0)
break;
} /* end of outer for loop&amp;nbsp; */

//Code DOES get here=================================

/* can not find best match */
if(best_divisor == 0) 
{
//Code never gets here=================================
return ERROR;
}
//Code never gets here=================================

recalcbaud = (uClk &amp;gt;&amp;gt; 4) * bestm / (best_divisor * (bestm + bestd));

/* reuse best_error to evaluate baud error*/
if(baudrate &amp;gt; recalcbaud) 
best_error = baudrate - recalcbaud;
else 
best_error = recalcbaud -baudrate;

best_error = best_error * 100 / baudrate;

if (best_error &amp;lt; UART_ACCEPTED_BAUDRATE_ERROR)
{
if (UartID == UART_1)
{
LPC_UART1-&amp;gt;LCR |= UART_LCR_DLAB_EN;

LPC_UART1-&amp;gt;DLM = UART_LOAD_DLM(best_divisor);

LPC_UART1-&amp;gt;DLL = UART_LOAD_DLL(best_divisor);

/* Then reset DLAB bit */
LPC_UART1-&amp;gt;LCR &amp;amp;= (~UART_LCR_DLAB_EN) &amp;amp; UART_LCR_BITMASK;

LPC_UART1-&amp;gt;FDR = (UART_FDR_MULVAL(bestm) | UART_FDR_DIVADDVAL(bestd)) &amp;amp; UART_FDR_BITMASK;
}
else if (UartID == UART_4)
{
LPC_UART4-&amp;gt;LCR |= UART_LCR_DLAB_EN;

LPC_UART4-&amp;gt;DLM = UART_LOAD_DLM(best_divisor);

LPC_UART4-&amp;gt;DLL = UART_LOAD_DLL(best_divisor);

/* Then reset DLAB bit */
LPC_UART4-&amp;gt;LCR &amp;amp;= (~UART_LCR_DLAB_EN) &amp;amp; UART_LCR_BITMASK;

LPC_UART4-&amp;gt;FDR = (UART_FDR_MULVAL(bestm) | UART_FDR_DIVADDVAL(bestd)) &amp;amp; UART_FDR_BITMASK;
}

else
{
LPC_UART_TypeDef *UARTx = uart_get_pointer(UartID);
UARTx-&amp;gt;LCR |= UART_LCR_DLAB_EN;

UARTx-&amp;gt;DLM = UART_LOAD_DLM(best_divisor);

UARTx-&amp;gt;DLL = UART_LOAD_DLL(best_divisor);

/* Then reset DLAB bit */
UARTx-&amp;gt;LCR &amp;amp;= (~UART_LCR_DLAB_EN) &amp;amp; UART_LCR_BITMASK;

UARTx-&amp;gt;FDR = (UART_FDR_MULVAL(bestm) | UART_FDR_DIVADDVAL(bestd)) &amp;amp; UART_FDR_BITMASK;
}
errorStatus = SUCCESS;
}

return errorStatus;
}


int main()
{
GPIO_Init();
GPIO_SetDir(4, 1&amp;lt;&amp;lt;28|1&amp;lt;&amp;lt;29, GPIO_DIRECTION_OUTPUT);
LPC_GPIO4-&amp;gt;SET = 1&amp;lt;&amp;lt;28|1&amp;lt;&amp;lt;29;

uart_set_divisors(UART_0, 115200);

//Code never gets here=================================
LPC_GPIO4-&amp;gt;CLR = 1&amp;lt;&amp;lt;29;
while(1)
{
}

return 0;
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;main.s:&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV class="j-rte-table"&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca" style="border:1px solid black;background-color:#cacaca;"&gt; &lt;PRE&gt;.syntax unified
.cpu cortex-m3
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 4
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.thumb
.file"main.c"
.text
.Ltext0:
.cfi_sections.debug_frame
.section.text.HardFault_Handler,"ax",%progbits
.align1
.globalHardFault_Handler
.thumb
.thumb_func
.typeHardFault_Handler, %function
HardFault_Handler:
.LFB55:
.file 1 "main.c"
.loc 1 11 0
.cfi_startproc
@ Volatile: function does not return.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
.loc 1 13 0
ldrr3, .L4
movr2, #268435456
strr2, [r3, #28]
.L2:
b.L2
.L5:
.align2
.L4:
.word537493632
.cfi_endproc
.LFE55:
.sizeHardFault_Handler, .-HardFault_Handler
.section.text.uart_get_pointer,"ax",%progbits
.align1
.globaluart_get_pointer
.thumb
.thumb_func
.typeuart_get_pointer, %function
uart_get_pointer:
.LFB56:
.loc 1 21 0
.cfi_startproc
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
.LVL0:
.LVL1:
cmpr0, #3
ittels
ldrlsr3, .L9
ldrlsr0, [r3, r0, lsl #2]
.LVL2:
.loc 1 21 0
movhir0, #0
.LVL3:
.loc 1 38 0
bxlr
.L10:
.align2
.L9:
.word.LANCHOR0
.cfi_endproc
.LFE56:
.sizeuart_get_pointer, .-uart_get_pointer
.global__aeabi_uldivmod
.section.text.uart_set_divisors,"ax",%progbits
.align1
.globaluart_set_divisors
.thumb
.thumb_func
.typeuart_set_divisors, %function
uart_set_divisors:
.LFB57:
.loc 1 42 0
.cfi_startproc
@ args = 0, pretend = 0, frame = 48
@ frame_needed = 0, uses_anonymous_args = 0
.LVL4:
push{r4, r5, r6, r7, r8, r9, r10, fp, lr}
.LCFI0:
.cfi_def_cfa_offset 36
.cfi_offset 4, -36
.cfi_offset 5, -32
.cfi_offset 6, -28
.cfi_offset 7, -24
.cfi_offset 8, -20
.cfi_offset 9, -16
.cfi_offset 10, -12
.cfi_offset 11, -8
.cfi_offset 14, -4
subsp, sp, #52
.LCFI1:
.cfi_def_cfa_offset 88
.LVL5:
.loc 1 42 0
movr7, r0
.loc 1 52 0
movsr0, #1
.LVL6:
.loc 1 42 0
movr4, r1
.loc 1 52 0
blCLKPWR_GetCLK
.LVL7:
.loc 1 71 0
lsrsr1, r0, #4
lslsr2, r0, #28
strr1, [sp, #12]
strr2, [sp, #8]
.loc 1 52 0
movip, r0
.LVL8:
.loc 1 64 0
movsr5, #0
.loc 1 71 0
ldrdr0, [sp, #8]
.LVL9:
strdr0, [sp, #16]
.loc 1 62 0
movr1, #-1
.loc 1 71 0
strr4, [sp, #36]
.loc 1 67 0
movsr6, #1
.loc 1 62 0
strr1, [sp, #32]
.loc 1 65 0
movr10, #0
movfp, #0
.loc 1 63 0
strr5, [sp]
.LVL10:
.L12:
.loc 1 42 0 discriminator 1
ldrr1, [sp, #36]
movsr2, #0
strr1, [sp, #28]
strr2, [sp, #24]
.LVL11:
.L18:
.loc 1 71 0
ldrr8, [sp, #28]
movr9, #0
movr2, r8
movr3, r9
ldrdr0, [sp, #16]
strip, [sp, #4]
bl__aeabi_uldivmod
.LVL12:
.loc 1 77 0
cmpr0, #-2147483648
.loc 1 74 0
movr2, r1
.loc 1 80 0
ithi
addhir2, r1, #1
.loc 1 84 0
addr1, r2, #-1
.loc 1 72 0
movr3, r0
.loc 1 79 0
ithi
rsbhir3, r0, #0
.LVL13:
.loc 1 84 0
cmpr1, #65536
.loc 1 77 0
ldrip, [sp, #4]
.LVL14:
.loc 1 84 0
bcs.L14
.loc 1 87 0
ldrr0, [sp, #32]
.LVL15:
cmpr3, r0
bcs.L14
.LVL16:
.loc 1 90 0
movr10, r2
movfp, #0
.LVL17:
.loc 1 94 0
cbzr3, .L25
ldrr1, [sp, #24]
strr3, [sp, #32]
movr5, r6
strr1, [sp]
.LVL18:
.L14:
.loc 1 69 0
ldrr2, [sp, #24]
.LVL19:
ldrr3, [sp, #28]
.LVL20:
addsr2, r2, #1
addr3, r3, r4
cmpr2, r6
strr2, [sp, #24]
.LVL21:
strr3, [sp, #28]
bcc.L18
.loc 1 99 0
ldrr0, [sp, #32]
cbzr0, .L17
ldrr1, [sp, #36]
ldrdr2, [sp, #16]
.LVL22:
addr1, r1, r4
.loc 1 67 0
addsr6, r6, #1
.LVL23:
strr1, [sp, #36]
ldrdr0, [sp, #8]
addsr2, r2, r0
adcr3, r3, r1
cmpr6, #16
strdr2, [sp, #16]
bne.L12
.L17:
.LVL24:
.loc 1 106 0
orrsr3, r10, fp
beq.L29
b.L15
.LVL25:
.L25:
ldrr0, [sp, #24]
movr5, r6
strr0, [sp]
.LVL26:
.L15:
.loc 1 113 0
ldrr1, [sp]
lsrr3, ip, #4
addr1, r1, r5
mulr0, r3, r5
umullr2, r3, r1, r10
mlar3, r1, fp, r3
movsr1, #0
bl__aeabi_uldivmod
.LVL27:
.loc 1 116 0
cmpr4, r0
.loc 1 117 0
itehi
rsbhir0, r0, r4
.LVL28:
.loc 1 119 0
rsblsr0, r4, r0
.LVL29:
.loc 1 121 0
movsr3, #100
mulsr0, r3, r0
.LVL30:
udivr4, r0, r4
.LVL31:
.loc 1 123 0
cmpr4, #2
bhi.L29
ldrr8, [sp]
.loc 1 125 0
cmpr7, #1
lslr0, fp, #24
uxtbr1, r10
lslr5, r5, #4
.LVL32:
andr9, r8, #15
bne.L22
.loc 1 127 0
ldrr4, .L35
.LVL33:
.loc 1 129 0
lsrr2, r10, #8
.loc 1 127 0
ldrbr3, [r4, #12]@ zero_extendqisi2
.loc 1 129 0
orrsr2, r2, r0
.loc 1 127 0
orrr3, r3, #128
.loc 1 129 0
uxtbr2, r2
.loc 1 127 0
strbr3, [r4, #12]
.LVL34:
.loc 1 129 0
strbr2, [r4, #4]
.loc 1 131 0
strbr1, [r4]
.loc 1 134 0
ldrbr3, [r4, #12]@ zero_extendqisi2
andr3, r3, #127
strbr3, [r4, #12]
b.L34
.LVL35:
.L22:
.loc 1 138 0
cmpr7, #4
bne.L23
.loc 1 140 0
ldrr4, .L35+4
.LVL36:
.loc 1 142 0
lsrr2, r10, #8
.loc 1 140 0
ldrr3, [r4, #12]
.loc 1 142 0
orrsr2, r2, r0
.loc 1 140 0
orrr3, r3, #128
.loc 1 142 0
uxtbr2, r2
.loc 1 140 0
strr3, [r4, #12]
.loc 1 142 0
strr2, [r4, #4]
.loc 1 144 0
strr1, [r4]
.loc 1 147 0
ldrr3, [r4, #12]
andr3, r3, #127
strr3, [r4, #12]
.L34:
.loc 1 149 0
uxtbr5, r5
orrr5, r5, r9
strr5, [r4, #40]
b.L33
.LVL37:
.L23:
cmpr7, #3
itetls
ldrlsr3, .L35+8
.loc 1 138 0
movhir4, #0
.LVL38:
ldrlsr4, [r3, r7, lsl #2]
.LVL39:
.LBB5:
.loc 1 157 0
lsrr2, r10, #8
.loc 1 155 0
ldrbr3, [r4, #12]@ zero_extendqisi2
.loc 1 157 0
orrsr2, r2, r0
.loc 1 155 0
orrr3, r3, #128
.loc 1 157 0
uxtbr2, r2
.loc 1 155 0
strbr3, [r4, #12]
.loc 1 157 0
strbr2, [r4, #4]
.loc 1 159 0
strbr1, [r4]
.loc 1 162 0
ldrbr3, [r4, #12]@ zero_extendqisi2
.loc 1 164 0
orrr5, r9, r5
.loc 1 162 0
andr3, r3, #127
.loc 1 164 0
uxtbr5, r5
.loc 1 162 0
strbr3, [r4, #12]
.loc 1 164 0
strbr5, [r4, #40]
.LVL40:
.L33:
.LBE5:
.loc 1 166 0
movsr0, #1
b.L19
.LVL41:
.L29:
.loc 1 109 0
movsr0, #0
.LVL42:
.L19:
.loc 1 170 0
addsp, sp, #52
@ sp needed
pop{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.LVL43:
.L36:
.align2
.L35:
.word1073807360
.word1074413568
.word.LANCHOR0
.cfi_endproc
.LFE57:
.sizeuart_set_divisors, .-uart_set_divisors
.section.text.startup.main,"ax",%progbits
.align1
.globalmain
.thumb
.thumb_func
.typemain, %function
main:
.LFB58:
.loc 1 174 0
.cfi_startproc
@ Volatile: function does not return.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push{r3, lr}
.LCFI2:
.cfi_def_cfa_offset 8
.cfi_offset 3, -8
.cfi_offset 14, -4
.loc 1 175 0
blGPIO_Init
.LVL44:
.loc 1 177 0
ldrr4, .L39
.loc 1 176 0
movsr0, #4
movr1, #805306368
movsr2, #1
blGPIO_SetDir
.LVL45:
.loc 1 177 0
movr3, #805306368
strr3, [r4, #24]
.loc 1 179 0
movsr0, #0
movr1, #115200
bluart_set_divisors
.LVL46:
.loc 1 182 0
movr3, #536870912
strr3, [r4, #28]
.L38:
b.L38
.L40:
.align2
.L39:
.word537493632
.cfi_endproc
.LFE58:
.sizemain, .-main
.section.rodata.CSWTCH.2,"a",%progbits
.align2
.set.LANCHOR0,. + 0
.typeCSWTCH.2, %object
.sizeCSWTCH.2, 16
CSWTCH.2:
.word1073790976
.word0
.word1074364416
.word1074380800
.text
.Letext0:
.file 2 "/home/ghost/embedded/arm/gcc-arm-none-eabi-4_8-2014q3/lib/gcc/arm-none-eabi/4.8.4/include/stdint-gcc.h"
.file 3 "./LPC177x_8x.h"
.file 4 "./Drivers/include/lpc_types.h"
.file 5 "./Drivers/include/lpc177x_8x_uart.h"
.file 6 "./Drivers/include/lpc177x_8x_clkpwr.h"
.file 7 "./core_cm3.h"
.file 8 "./Drivers/include/lpc177x_8x_gpio.h"
.section.debug_info,"",%progbits
.Ldebug_info0:
.4byte0x946
.2byte0x2
.4byte.Ldebug_abbrev0
.byte0x4
.uleb128 0x1
.4byte.LASF61
.byte0x1
.4byte.LASF62
.4byte.LASF63
.4byte.Ldebug_ranges0+0
.4byte0
.4byte0
.4byte.Ldebug_line0
.uleb128 0x2
.byte0x4
.byte0x7
.4byte.LASF0
.uleb128 0x2
.byte0x1
.byte0x6
.4byte.LASF1
.uleb128 0x2
.byte0x2
.byte0x5
.4byte.LASF2
.uleb128 0x3
.4byte.LASF5
.byte0x2
.byte0x28
.4byte0x49
.uleb128 0x2
.byte0x4
.byte0x5
.4byte.LASF3
.uleb128 0x2
.byte0x8
.byte0x5
.4byte.LASF4
.uleb128 0x3
.4byte.LASF6
.byte0x2
.byte0x2e
.4byte0x62
.uleb128 0x2
.byte0x1
.byte0x8
.4byte.LASF7
.uleb128 0x2
.byte0x2
.byte0x7
.4byte.LASF8
.uleb128 0x3
.4byte.LASF9
.byte0x2
.byte0x34
.4byte0x7b
.uleb128 0x2
.byte0x4
.byte0x7
.4byte.LASF10
.uleb128 0x3
.4byte.LASF11
.byte0x2
.byte0x37
.4byte0x8d
.uleb128 0x2
.byte0x8
.byte0x7
.4byte.LASF12
.uleb128 0x4
.byte0x4
.byte0x5
.ascii"int\000"
.uleb128 0x2
.byte0x4
.byte0x7
.4byte.LASF13
.uleb128 0x5
.4byte0x70
.uleb128 0x6
.4byte0xa2
.uleb128 0x5
.4byte0x57
.uleb128 0x7
.byte0x20
.byte0x3
.2byte0x177
.4byte0x115
.uleb128 0x8
.ascii"DIR\000"
.byte0x3
.2byte0x179
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0
.uleb128 0x9
.4byte.LASF14
.byte0x3
.2byte0x17a
.4byte0x115
.byte0x2
.byte0x23
.uleb128 0x4
.uleb128 0x9
.4byte.LASF15
.byte0x3
.2byte0x17b
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x10
.uleb128 0x8
.ascii"PIN\000"
.byte0x3
.2byte0x17c
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x14
.uleb128 0x8
.ascii"SET\000"
.byte0x3
.2byte0x17d
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x18
.uleb128 0x8
.ascii"CLR\000"
.byte0x3
.2byte0x17e
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x1c
.byte0
.uleb128 0xa
.4byte0x70
.4byte0x125
.uleb128 0xb
.4byte0x9b
.byte0x2
.byte0
.uleb128 0xc
.4byte.LASF16
.byte0x3
.2byte0x17f
.4byte0xb1
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x1f2
.4byte0x16b
.uleb128 0xe
.ascii"RBR\000"
.byte0x3
.2byte0x1f4
.4byte0x16b
.uleb128 0xe
.ascii"THR\000"
.byte0x3
.2byte0x1f5
.4byte0xac
.uleb128 0xe
.ascii"DLL\000"
.byte0x3
.2byte0x1f6
.4byte0xac
.uleb128 0xf
.4byte.LASF14
.byte0x3
.2byte0x1f7
.4byte0x70
.byte0
.uleb128 0x6
.4byte0xac
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x1f9
.4byte0x192
.uleb128 0xe
.ascii"DLM\000"
.byte0x3
.2byte0x1fb
.4byte0xac
.uleb128 0xe
.ascii"IER\000"
.byte0x3
.2byte0x1fc
.4byte0xa2
.byte0
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x1fe
.4byte0x1b4
.uleb128 0xe
.ascii"IIR\000"
.byte0x3
.2byte0x200
.4byte0xa7
.uleb128 0xe
.ascii"FCR\000"
.byte0x3
.2byte0x201
.4byte0xac
.byte0
.uleb128 0x7
.byte0x58
.byte0x3
.2byte0x1f0
.4byte0x2e4
.uleb128 0x10
.4byte0x131
.byte0x2
.byte0x23
.uleb128 0
.uleb128 0x10
.4byte0x170
.byte0x2
.byte0x23
.uleb128 0x4
.uleb128 0x10
.4byte0x192
.byte0x2
.byte0x23
.uleb128 0x8
.uleb128 0x8
.ascii"LCR\000"
.byte0x3
.2byte0x203
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0xc
.uleb128 0x9
.4byte.LASF17
.byte0x3
.2byte0x204
.4byte0x2e4
.byte0x2
.byte0x23
.uleb128 0xd
.uleb128 0x8
.ascii"LSR\000"
.byte0x3
.2byte0x205
.4byte0x16b
.byte0x2
.byte0x23
.uleb128 0x14
.uleb128 0x9
.4byte.LASF18
.byte0x3
.2byte0x206
.4byte0x2e4
.byte0x2
.byte0x23
.uleb128 0x15
.uleb128 0x8
.ascii"SCR\000"
.byte0x3
.2byte0x207
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x1c
.uleb128 0x9
.4byte.LASF19
.byte0x3
.2byte0x208
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x1d
.uleb128 0x8
.ascii"ACR\000"
.byte0x3
.2byte0x209
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x20
.uleb128 0x9
.4byte.LASF20
.byte0x3
.2byte0x20a
.4byte0x304
.byte0x2
.byte0x23
.uleb128 0x24
.uleb128 0x8
.ascii"FDR\000"
.byte0x3
.2byte0x20b
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x28
.uleb128 0x9
.4byte.LASF21
.byte0x3
.2byte0x20c
.4byte0x2e4
.byte0x2
.byte0x23
.uleb128 0x29
.uleb128 0x8
.ascii"TER\000"
.byte0x3
.2byte0x20d
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x30
.uleb128 0x9
.4byte.LASF22
.byte0x3
.2byte0x20e
.4byte0x314
.byte0x2
.byte0x23
.uleb128 0x31
.uleb128 0x9
.4byte.LASF23
.byte0x3
.2byte0x20f
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x4c
.uleb128 0x9
.4byte.LASF24
.byte0x3
.2byte0x210
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x4d
.uleb128 0x9
.4byte.LASF25
.byte0x3
.2byte0x211
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x50
.uleb128 0x9
.4byte.LASF26
.byte0x3
.2byte0x212
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x51
.uleb128 0x9
.4byte.LASF27
.byte0x3
.2byte0x213
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x54
.uleb128 0x9
.4byte.LASF28
.byte0x3
.2byte0x214
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x55
.byte0
.uleb128 0xa
.4byte0x57
.4byte0x2f4
.uleb128 0xb
.4byte0x9b
.byte0x6
.byte0
.uleb128 0xa
.4byte0x57
.4byte0x304
.uleb128 0xb
.4byte0x9b
.byte0x2
.byte0
.uleb128 0xa
.4byte0x57
.4byte0x314
.uleb128 0xb
.4byte0x9b
.byte0x3
.byte0
.uleb128 0xa
.4byte0x57
.4byte0x324
.uleb128 0xb
.4byte0x9b
.byte0x1a
.byte0
.uleb128 0xc
.4byte.LASF29
.byte0x3
.2byte0x215
.4byte0x1b4
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x21b
.4byte0x36a
.uleb128 0xe
.ascii"RBR\000"
.byte0x3
.2byte0x21c
.4byte0x16b
.uleb128 0xe
.ascii"THR\000"
.byte0x3
.2byte0x21d
.4byte0xac
.uleb128 0xe
.ascii"DLL\000"
.byte0x3
.2byte0x21e
.4byte0xac
.uleb128 0xf
.4byte.LASF14
.byte0x3
.2byte0x21f
.4byte0x70
.byte0
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x221
.4byte0x38c
.uleb128 0xe
.ascii"DLM\000"
.byte0x3
.2byte0x222
.4byte0xac
.uleb128 0xe
.ascii"IER\000"
.byte0x3
.2byte0x223
.4byte0xa2
.byte0
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x225
.4byte0x3ae
.uleb128 0xe
.ascii"IIR\000"
.byte0x3
.2byte0x226
.4byte0xa7
.uleb128 0xe
.ascii"FCR\000"
.byte0x3
.2byte0x227
.4byte0xac
.byte0
.uleb128 0x7
.byte0x58
.byte0x3
.2byte0x219
.4byte0x51a
.uleb128 0x10
.4byte0x330
.byte0x2
.byte0x23
.uleb128 0
.uleb128 0x10
.4byte0x36a
.byte0x2
.byte0x23
.uleb128 0x4
.uleb128 0x10
.4byte0x38c
.byte0x2
.byte0x23
.uleb128 0x8
.uleb128 0x8
.ascii"LCR\000"
.byte0x3
.2byte0x229
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0xc
.uleb128 0x9
.4byte.LASF17
.byte0x3
.2byte0x22a
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0xd
.uleb128 0x8
.ascii"MCR\000"
.byte0x3
.2byte0x22b
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x10
.uleb128 0x9
.4byte.LASF18
.byte0x3
.2byte0x22c
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x11
.uleb128 0x8
.ascii"LSR\000"
.byte0x3
.2byte0x22d
.4byte0x16b
.byte0x2
.byte0x23
.uleb128 0x14
.uleb128 0x9
.4byte.LASF19
.byte0x3
.2byte0x22e
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x15
.uleb128 0x8
.ascii"MSR\000"
.byte0x3
.2byte0x22f
.4byte0x16b
.byte0x2
.byte0x23
.uleb128 0x18
.uleb128 0x9
.4byte.LASF20
.byte0x3
.2byte0x230
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x19
.uleb128 0x8
.ascii"SCR\000"
.byte0x3
.2byte0x231
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x1c
.uleb128 0x9
.4byte.LASF21
.byte0x3
.2byte0x232
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x1d
.uleb128 0x8
.ascii"ACR\000"
.byte0x3
.2byte0x233
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x20
.uleb128 0x9
.4byte.LASF30
.byte0x3
.2byte0x234
.4byte0x70
.byte0x2
.byte0x23
.uleb128 0x24
.uleb128 0x8
.ascii"FDR\000"
.byte0x3
.2byte0x235
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x28
.uleb128 0x9
.4byte.LASF31
.byte0x3
.2byte0x236
.4byte0x70
.byte0x2
.byte0x23
.uleb128 0x2c
.uleb128 0x8
.ascii"TER\000"
.byte0x3
.2byte0x237
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x30
.uleb128 0x9
.4byte.LASF22
.byte0x3
.2byte0x238
.4byte0x314
.byte0x2
.byte0x23
.uleb128 0x31
.uleb128 0x9
.4byte.LASF23
.byte0x3
.2byte0x239
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x4c
.uleb128 0x9
.4byte.LASF24
.byte0x3
.2byte0x23a
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x4d
.uleb128 0x9
.4byte.LASF25
.byte0x3
.2byte0x23b
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x50
.uleb128 0x9
.4byte.LASF26
.byte0x3
.2byte0x23c
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x51
.uleb128 0x9
.4byte.LASF27
.byte0x3
.2byte0x23d
.4byte0xac
.byte0x2
.byte0x23
.uleb128 0x54
.uleb128 0x9
.4byte.LASF28
.byte0x3
.2byte0x23e
.4byte0x2f4
.byte0x2
.byte0x23
.uleb128 0x55
.byte0
.uleb128 0xc
.4byte.LASF32
.byte0x3
.2byte0x23f
.4byte0x3ae
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x244
.4byte0x554
.uleb128 0xe
.ascii"RBR\000"
.byte0x3
.2byte0x245
.4byte0xa7
.uleb128 0xe
.ascii"THR\000"
.byte0x3
.2byte0x246
.4byte0xa2
.uleb128 0xe
.ascii"DLL\000"
.byte0x3
.2byte0x247
.4byte0xa2
.byte0
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x249
.4byte0x576
.uleb128 0xe
.ascii"DLM\000"
.byte0x3
.2byte0x24a
.4byte0xa2
.uleb128 0xe
.ascii"IER\000"
.byte0x3
.2byte0x24b
.4byte0xa2
.byte0
.uleb128 0xd
.byte0x4
.byte0x3
.2byte0x24d
.4byte0x598
.uleb128 0xe
.ascii"IIR\000"
.byte0x3
.2byte0x24e
.4byte0xa7
.uleb128 0xe
.ascii"FCR\000"
.byte0x3
.2byte0x24f
.4byte0xa2
.byte0
.uleb128 0x7
.byte0x5c
.byte0x3
.2byte0x242
.4byte0x69b
.uleb128 0x10
.4byte0x526
.byte0x2
.byte0x23
.uleb128 0
.uleb128 0x10
.4byte0x554
.byte0x2
.byte0x23
.uleb128 0x4
.uleb128 0x10
.4byte0x576
.byte0x2
.byte0x23
.uleb128 0x8
.uleb128 0x8
.ascii"LCR\000"
.byte0x3
.2byte0x251
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0xc
.uleb128 0x9
.4byte.LASF14
.byte0x3
.2byte0x252
.4byte0x70
.byte0x2
.byte0x23
.uleb128 0x10
.uleb128 0x8
.ascii"LSR\000"
.byte0x3
.2byte0x253
.4byte0xa7
.byte0x2
.byte0x23
.uleb128 0x14
.uleb128 0x9
.4byte.LASF17
.byte0x3
.2byte0x254
.4byte0x70
.byte0x2
.byte0x23
.uleb128 0x18
.uleb128 0x8
.ascii"SCR\000"
.byte0x3
.2byte0x255
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x1c
.uleb128 0x8
.ascii"ACR\000"
.byte0x3
.2byte0x256
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x20
.uleb128 0x8
.ascii"ICR\000"
.byte0x3
.2byte0x257
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x24
.uleb128 0x8
.ascii"FDR\000"
.byte0x3
.2byte0x258
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x28
.uleb128 0x8
.ascii"OSR\000"
.byte0x3
.2byte0x259
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x2c
.uleb128 0x9
.4byte.LASF18
.byte0x3
.2byte0x25a
.4byte0x69b
.byte0x2
.byte0x23
.uleb128 0x30
.uleb128 0x9
.4byte.LASF33
.byte0x3
.2byte0x25b
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x48
.uleb128 0x9
.4byte.LASF23
.byte0x3
.2byte0x25c
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x4c
.uleb128 0x9
.4byte.LASF25
.byte0x3
.2byte0x25d
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x50
.uleb128 0x9
.4byte.LASF27
.byte0x3
.2byte0x25e
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x54
.uleb128 0x9
.4byte.LASF34
.byte0x3
.2byte0x25f
.4byte0xa2
.byte0x2
.byte0x23
.uleb128 0x58
.byte0
.uleb128 0xa
.4byte0x70
.4byte0x6ab
.uleb128 0xb
.4byte0x9b
.byte0x5
.byte0
.uleb128 0xc
.4byte.LASF35
.byte0x3
.2byte0x260
.4byte0x598
.uleb128 0x11
.byte0x1
.byte0x4
.byte0x48
.4byte0x6cc
.uleb128 0x12
.4byte.LASF36
.sleb128 0
.uleb128 0x12
.4byte.LASF37
.sleb128 1
.byte0
.uleb128 0x3
.4byte.LASF38
.byte0x4
.byte0x48
.4byte0x6b7
.uleb128 0x2
.byte0x1
.byte0x8
.4byte.LASF39
.uleb128 0x3
.4byte.LASF40
.byte0x4
.byte0xbd
.4byte0x82
.uleb128 0x13
.byte0x1
.byte0x5
.2byte0x173
.4byte0x711
.uleb128 0x12
.4byte.LASF41
.sleb128 0
.uleb128 0x12
.4byte.LASF42
.sleb128 1
.uleb128 0x12
.4byte.LASF43
.sleb128 2
.uleb128 0x12
.4byte.LASF44
.sleb128 3
.uleb128 0x12
.4byte.LASF45
.sleb128 4
.byte0
.uleb128 0xc
.4byte.LASF46
.byte0x5
.2byte0x179
.4byte0x6e9
.uleb128 0x14
.byte0x1
.4byte.LASF59
.byte0x1
.byte0x14
.byte0x1
.4byte0x746
.byte0x1
.4byte0x746
.uleb128 0x15
.4byte.LASF47
.byte0x1
.byte0x14
.4byte0x711
.uleb128 0x16
.4byte.LASF58
.byte0x1
.byte0x16
.4byte0x746
.byte0
.uleb128 0x17
.byte0x4
.4byte0x324
.uleb128 0x18
.byte0x1
.4byte.LASF64
.byte0x1
.byte0xa
.byte0x1
.4byte.LFB55
.4byte.LFE55
.byte0x2
.byte0x7d
.sleb128 0
.byte0x1
.uleb128 0x19
.4byte0x71d
.4byte.LFB56
.4byte.LFE56
.byte0x2
.byte0x7d
.sleb128 0
.byte0x1
.4byte0x789
.uleb128 0x1a
.4byte0x72f
.4byte.LLST0
.uleb128 0x1b
.4byte0x73a
.4byte.LLST1
.byte0
.uleb128 0x1c
.byte0x1
.4byte.LASF65
.byte0x1
.byte0x29
.byte0x1
.4byte0x6cc
.4byte.LFB57
.4byte.LFE57
.4byte.LLST2
.byte0x1
.4byte0x89d
.uleb128 0x1d
.4byte.LASF47
.byte0x1
.byte0x29
.4byte0x711
.4byte.LLST3
.uleb128 0x1d
.4byte.LASF48
.byte0x1
.byte0x29
.4byte0x70
.4byte.LLST4
.uleb128 0x1e
.4byte.LASF49
.byte0x1
.byte0x2b
.4byte0x6cc
.byte0
.uleb128 0x1f
.4byte.LASF50
.byte0x1
.byte0x2d
.4byte0x70
.4byte.LLST5
.uleb128 0x20
.ascii"d\000"
.byte0x1
.byte0x2e
.4byte0x70
.4byte.LLST6
.uleb128 0x20
.ascii"m\000"
.byte0x1
.byte0x2e
.4byte0x70
.4byte.LLST7
.uleb128 0x1f
.4byte.LASF51
.byte0x1
.byte0x2e
.4byte0x70
.4byte.LLST8
.uleb128 0x1f
.4byte.LASF52
.byte0x1
.byte0x2e
.4byte0x70
.4byte.LLST9
.uleb128 0x20
.ascii"tmp\000"
.byte0x1
.byte0x2e
.4byte0x70
.4byte.LLST10
.uleb128 0x1f
.4byte.LASF53
.byte0x1
.byte0x2f
.4byte0x6de
.4byte.LLST11
.uleb128 0x1f
.4byte.LASF54
.byte0x1
.byte0x2f
.4byte0x6de
.4byte.LLST12
.uleb128 0x1f
.4byte.LASF55
.byte0x1
.byte0x30
.4byte0x70
.4byte.LLST13
.uleb128 0x1f
.4byte.LASF56
.byte0x1
.byte0x30
.4byte0x70
.4byte.LLST14
.uleb128 0x1f
.4byte.LASF57
.byte0x1
.byte0x31
.4byte0x70
.4byte.LLST15
.uleb128 0x21
.4byte.LBB5
.4byte.LBE5
.4byte0x88d
.uleb128 0x22
.4byte.LASF58
.byte0x1
.byte0x9a
.4byte0x746
.byte0x1
.byte0x54
.byte0
.uleb128 0x23
.4byte.LVL7
.4byte0x90d
.uleb128 0x24
.byte0x1
.byte0x50
.byte0x1
.byte0x31
.byte0
.byte0
.uleb128 0x25
.byte0x1
.4byte.LASF66
.byte0x1
.byte0xad
.4byte0x94
.4byte.LFB58
.4byte.LFE58
.4byte.LLST16
.byte0x1
.4byte0x8fa
.uleb128 0x26
.4byte.LVL44
.4byte0x925
.uleb128 0x27
.4byte.LVL45
.4byte0x92f
.4byte0x8e2
.uleb128 0x24
.byte0x1
.byte0x52
.byte0x1
.byte0x31
.uleb128 0x24
.byte0x1
.byte0x51
.byte0x3
.byte0x48
.byte0x49
.byte0x24
.uleb128 0x24
.byte0x1
.byte0x50
.byte0x1
.byte0x34
.byte0
.uleb128 0x23
.4byte.LVL46
.4byte0x789
.uleb128 0x24
.byte0x1
.byte0x51
.byte0x4
.byte0x8
.byte0xe1
.byte0x39
.byte0x24
.uleb128 0x24
.byte0x1
.byte0x50
.byte0x1
.byte0x30
.byte0
.byte0
.uleb128 0x28
.4byte.LASF67
.byte0x7
.2byte0x490
.4byte0x908
.byte0x1
.byte0x1
.uleb128 0x5
.4byte0x3e
.uleb128 0x29
.byte0x1
.4byte.LASF60
.byte0x6
.byte0xe1
.byte0x1
.4byte0x70
.byte0x1
.4byte0x925
.uleb128 0x2a
.4byte0x57
.byte0
.uleb128 0x2b
.byte0x1
.4byte.LASF68
.byte0x8
.byte0x8a
.byte0x1
.byte0x1
.uleb128 0x2c
.byte0x1
.4byte.LASF69
.byte0x8
.byte0x8c
.byte0x1
.byte0x1
.uleb128 0x2a
.4byte0x57
.uleb128 0x2a
.4byte0x70
.uleb128 0x2a
.4byte0x57
.byte0
.byte0
.section.debug_abbrev,"",%progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x55
.uleb128 0x6
.uleb128 0x11
.uleb128 0x1
.uleb128 0x52
.uleb128 0x1
.uleb128 0x10
.uleb128 0x6
.byte0
.byte0
.uleb128 0x2
.uleb128 0x24
.byte0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte0
.byte0
.uleb128 0x3
.uleb128 0x16
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x4
.uleb128 0x24
.byte0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte0
.byte0
.uleb128 0x5
.uleb128 0x35
.byte0
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x6
.uleb128 0x26
.byte0
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x7
.uleb128 0x13
.byte0x1
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x8
.uleb128 0xd
.byte0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.uleb128 0x38
.uleb128 0xa
.byte0
.byte0
.uleb128 0x9
.uleb128 0xd
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.uleb128 0x38
.uleb128 0xa
.byte0
.byte0
.uleb128 0xa
.uleb128 0x1
.byte0x1
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0xb
.uleb128 0x21
.byte0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2f
.uleb128 0xb
.byte0
.byte0
.uleb128 0xc
.uleb128 0x16
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0xd
.uleb128 0x17
.byte0x1
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0xe
.uleb128 0xd
.byte0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0xf
.uleb128 0xd
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x10
.uleb128 0xd
.byte0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x38
.uleb128 0xa
.byte0
.byte0
.uleb128 0x11
.uleb128 0x4
.byte0x1
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x12
.uleb128 0x28
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1c
.uleb128 0xd
.byte0
.byte0
.uleb128 0x13
.uleb128 0x4
.byte0x1
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x14
.uleb128 0x2e
.byte0x1
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x49
.uleb128 0x13
.uleb128 0x20
.uleb128 0xb
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x15
.uleb128 0x5
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x16
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x17
.uleb128 0xf
.byte0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x18
.uleb128 0x2e
.byte0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.uleb128 0x2117
.uleb128 0xc
.byte0
.byte0
.uleb128 0x19
.uleb128 0x2e
.byte0x1
.uleb128 0x31
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0xa
.uleb128 0x2117
.uleb128 0xc
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x1a
.uleb128 0x5
.byte0
.uleb128 0x31
.uleb128 0x13
.uleb128 0x2
.uleb128 0x6
.byte0
.byte0
.uleb128 0x1b
.uleb128 0x34
.byte0
.uleb128 0x31
.uleb128 0x13
.uleb128 0x2
.uleb128 0x6
.byte0
.byte0
.uleb128 0x1c
.uleb128 0x2e
.byte0x1
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0x6
.uleb128 0x2116
.uleb128 0xc
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x1d
.uleb128 0x5
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x6
.byte0
.byte0
.uleb128 0x1e
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1c
.uleb128 0xb
.byte0
.byte0
.uleb128 0x1f
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x6
.byte0
.byte0
.uleb128 0x20
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x6
.byte0
.byte0
.uleb128 0x21
.uleb128 0xb
.byte0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x22
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0xa
.byte0
.byte0
.uleb128 0x23
.uleb128 0x4109
.byte0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x31
.uleb128 0x13
.byte0
.byte0
.uleb128 0x24
.uleb128 0x410a
.byte0
.uleb128 0x2
.uleb128 0xa
.uleb128 0x2111
.uleb128 0xa
.byte0
.byte0
.uleb128 0x25
.uleb128 0x2e
.byte0x1
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x1
.uleb128 0x40
.uleb128 0x6
.uleb128 0x2117
.uleb128 0xc
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x26
.uleb128 0x4109
.byte0
.uleb128 0x11
.uleb128 0x1
.uleb128 0x31
.uleb128 0x13
.byte0
.byte0
.uleb128 0x27
.uleb128 0x4109
.byte0x1
.uleb128 0x11
.uleb128 0x1
.uleb128 0x31
.uleb128 0x13
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x28
.uleb128 0x34
.byte0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0x5
.uleb128 0x49
.uleb128 0x13
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3c
.uleb128 0xc
.byte0
.byte0
.uleb128 0x29
.uleb128 0x2e
.byte0x1
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x49
.uleb128 0x13
.uleb128 0x3c
.uleb128 0xc
.uleb128 0x1
.uleb128 0x13
.byte0
.byte0
.uleb128 0x2a
.uleb128 0x5
.byte0
.uleb128 0x49
.uleb128 0x13
.byte0
.byte0
.uleb128 0x2b
.uleb128 0x2e
.byte0
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x3c
.uleb128 0xc
.byte0
.byte0
.uleb128 0x2c
.uleb128 0x2e
.byte0x1
.uleb128 0x3f
.uleb128 0xc
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0xc
.uleb128 0x3c
.uleb128 0xc
.byte0
.byte0
.byte0
.section.debug_loc,"",%progbits
.Ldebug_loc0:
.LLST0:
.4byte.LVL0
.4byte.LVL2
.2byte0x1
.byte0x50
.4byte.LVL2
.4byte.LFE56
.2byte0x4
.byte0xf3
.uleb128 0x1
.byte0x50
.byte0x9f
.4byte0
.4byte0
.LLST1:
.4byte.LVL1
.4byte.LVL3
.2byte0x2
.byte0x30
.byte0x9f
.4byte.LVL3
.4byte.LFE56
.2byte0x1
.byte0x50
.4byte0
.4byte0
.LLST2:
.4byte.LFB57
.4byte.LCFI0
.2byte0x2
.byte0x7d
.sleb128 0
.4byte.LCFI0
.4byte.LCFI1
.2byte0x2
.byte0x7d
.sleb128 36
.4byte.LCFI1
.4byte.LFE57
.2byte0x3
.byte0x7d
.sleb128 88
.4byte0
.4byte0
.LLST3:
.4byte.LVL4
.4byte.LVL6
.2byte0x1
.byte0x50
.4byte.LVL6
.4byte.LFE57
.2byte0x4
.byte0xf3
.uleb128 0x1
.byte0x50
.byte0x9f
.4byte0
.4byte0
.LLST4:
.4byte.LVL4
.4byte.LVL7-1
.2byte0x1
.byte0x51
.4byte.LVL7-1
.4byte.LVL31
.2byte0x1
.byte0x54
.4byte.LVL31
.4byte.LFE57
.2byte0x4
.byte0xf3
.uleb128 0x1
.byte0x51
.byte0x9f
.4byte0
.4byte0
.LLST5:
.4byte.LVL8
.4byte.LVL9
.2byte0x1
.byte0x50
.4byte.LVL9
.4byte.LVL12-1
.2byte0x1
.byte0x5c
.4byte.LVL14
.4byte.LVL27-1
.2byte0x1
.byte0x5c
.4byte0
.4byte0
.LLST6:
.4byte.LVL10
.4byte.LVL11
.2byte0x2
.byte0x30
.byte0x9f
.4byte.LVL11
.4byte.LVL21
.2byte0x2
.byte0x91
.sleb128 -64
.4byte.LVL21
.4byte.LVL22
.2byte0x1
.byte0x52
.4byte.LVL22
.4byte.LVL43
.2byte0x2
.byte0x91
.sleb128 -64
.4byte.LVL43
.4byte.LFE57
.2byte0x2
.byte0x7d
.sleb128 -64
.4byte0
.4byte0
.LLST7:
.4byte.LVL8
.4byte.LVL10
.2byte0x2
.byte0x31
.byte0x9f
.4byte.LVL10
.4byte.LVL43
.2byte0x1
.byte0x56
.4byte0
.4byte0
.LLST8:
.4byte.LVL8
.4byte.LVL10
.2byte0x2
.byte0x30
.byte0x9f
.4byte.LVL17
.4byte.LVL18
.2byte0x2
.byte0x91
.sleb128 -64
.4byte.LVL24
.4byte.LVL25
.2byte0x2
.byte0x7d
.sleb128 0
.4byte.LVL25
.4byte.LVL26
.2byte0x2
.byte0x91
.sleb128 -64
.4byte.LVL26
.4byte.LVL34
.2byte0x2
.byte0x7d
.sleb128 0
.4byte.LVL34
.4byte.LVL41
.2byte0x1
.byte0x58
.4byte.LVL41
.4byte.LVL42
.2byte0x2
.byte0x7d
.sleb128 0
.4byte0
.4byte0
.LLST9:
.4byte.LVL8
.4byte.LVL10
.2byte0x2
.byte0x30
.byte0x9f
.4byte.LVL24
.4byte.LVL25
.2byte0x1
.byte0x55
.4byte.LVL26
.4byte.LVL32
.2byte0x1
.byte0x55
.4byte.LVL41
.4byte.LVL42
.2byte0x1
.byte0x55
.4byte0
.4byte0
.LLST10:
.4byte.LVL13
.4byte.LVL19
.2byte0x1
.byte0x52
.4byte.LVL25
.4byte.LVL26
.2byte0x1
.byte0x52
.4byte0
.4byte0
.LLST11:
.4byte.LVL8
.4byte.LVL10
.2byte0xa
.byte0x9e
.uleb128 0x8
.8byte0
.4byte.LVL17
.4byte.LVL18
.2byte0x6
.byte0x5a
.byte0x93
.uleb128 0x4
.byte0x5b
.byte0x93
.uleb128 0x4
.4byte.LVL24
.4byte.LVL43
.2byte0x6
.byte0x5a
.byte0x93
.uleb128 0x4
.byte0x5b
.byte0x93
.uleb128 0x4
.4byte0
.4byte0
.LLST12:
.4byte.LVL12
.4byte.LVL15
.2byte0x6
.byte0x50
.byte0x93
.uleb128 0x4
.byte0x51
.byte0x93
.uleb128 0x4
.4byte0
.4byte0
.LLST13:
.4byte.LVL13
.4byte.LVL20
.2byte0x1
.byte0x53
.4byte.LVL25
.4byte.LVL26
.2byte0x1
.byte0x53
.4byte0
.4byte0
.LLST14:
.4byte.LVL8
.4byte.LVL10
.2byte0x3
.byte0x9
.byte0xff
.byte0x9f
.4byte.LVL10
.4byte.LVL16
.2byte0x2
.byte0x91
.sleb128 -56
.4byte.LVL16
.4byte.LVL18
.2byte0x1
.byte0x53
.4byte.LVL18
.4byte.LVL25
.2byte0x2
.byte0x91
.sleb128 -56
.4byte.LVL25
.4byte.LVL26
.2byte0x1
.byte0x53
.4byte.LVL28
.4byte.LVL30
.2byte0x1
.byte0x50
.4byte.LVL30
.4byte.LVL31
.2byte0xc
.byte0x70
.sleb128 0
.byte0xf7
.uleb128 0x29
.byte0x74
.sleb128 0
.byte0xf7
.uleb128 0x29
.byte0x1b
.byte0xf7
.uleb128 0
.byte0x9f
.4byte.LVL31
.4byte.LVL33
.2byte0x1
.byte0x54
.4byte.LVL35
.4byte.LVL36
.2byte0x1
.byte0x54
.4byte.LVL37
.4byte.LVL38
.2byte0x1
.byte0x54
.4byte0
.4byte0
.LLST15:
.4byte.LVL27
.4byte.LVL28
.2byte0x1
.byte0x50
.4byte0
.4byte0
.LLST16:
.4byte.LFB58
.4byte.LCFI2
.2byte0x2
.byte0x7d
.sleb128 0
.4byte.LCFI2
.4byte.LFE58
.2byte0x2
.byte0x7d
.sleb128 8
.4byte0
.4byte0
.section.debug_aranges,"",%progbits
.4byte0x34
.2byte0x2
.4byte.Ldebug_info0
.byte0x4
.byte0
.2byte0
.2byte0
.4byte.LFB55
.4byte.LFE55-.LFB55
.4byte.LFB56
.4byte.LFE56-.LFB56
.4byte.LFB57
.4byte.LFE57-.LFB57
.4byte.LFB58
.4byte.LFE58-.LFB58
.4byte0
.4byte0
.section.debug_ranges,"",%progbits
.Ldebug_ranges0:
.4byte.LFB55
.4byte.LFE55
.4byte.LFB56
.4byte.LFE56
.4byte.LFB57
.4byte.LFE57
.4byte.LFB58
.4byte.LFE58
.4byte0
.4byte0
.section.debug_line,"",%progbits
.Ldebug_line0:
.section.debug_str,"MS",%progbits,1
.LASF46:
.ascii"UART_ID_Type\000"
.LASF62:
.ascii"main.c\000"
.LASF11:
.ascii"uint64_t\000"
.LASF13:
.ascii"sizetype\000"
.LASF32:
.ascii"LPC_UART1_TypeDef\000"
.LASF47:
.ascii"UartID\000"
.LASF61:
.ascii"GNU C 4.8.4 20140725 (release) [ARM/embedded-4_8-br"
.ascii"anch revision 213147] -mcpu=cortex-m3 -mthumb -mapc"
.ascii"s-frame -mfloat-abi=soft -mno-sched-prolog -mtune=c"
.ascii"ortex-m3 -march=armv7-m -mfix-cortex-m3-ldrd -gdwar"
.ascii"f-2 -Os -fno-hosted -ffunction-sections -fdata-sect"
.ascii"ions\000"
.LASF25:
.ascii"ADRMATCH\000"
.LASF66:
.ascii"main\000"
.LASF27:
.ascii"RS485DLY\000"
.LASF58:
.ascii"UARTx\000"
.LASF2:
.ascii"short int\000"
.LASF68:
.ascii"GPIO_Init\000"
.LASF6:
.ascii"uint8_t\000"
.LASF69:
.ascii"GPIO_SetDir\000"
.LASF63:
.ascii"/home/ghost/embedded/arm/code/gps_map/lpc1778_uart_"
.ascii"test\000"
.LASF49:
.ascii"errorStatus\000"
.LASF40:
.ascii"UNS_64\000"
.LASF4:
.ascii"long long int\000"
.LASF23:
.ascii"RS485CTRL\000"
.LASF29:
.ascii"LPC_UART_TypeDef\000"
.LASF3:
.ascii"long int\000"
.LASF55:
.ascii"current_error\000"
.LASF36:
.ascii"ERROR\000"
.LASF48:
.ascii"baudrate\000"
.LASF7:
.ascii"unsigned char\000"
.LASF26:
.ascii"RESERVED10\000"
.LASF28:
.ascii"RESERVED11\000"
.LASF1:
.ascii"signed char\000"
.LASF12:
.ascii"long long unsigned int\000"
.LASF9:
.ascii"uint32_t\000"
.LASF0:
.ascii"unsigned int\000"
.LASF10:
.ascii"long unsigned int\000"
.LASF57:
.ascii"recalcbaud\000"
.LASF37:
.ascii"SUCCESS\000"
.LASF41:
.ascii"UART_0\000"
.LASF42:
.ascii"UART_1\000"
.LASF43:
.ascii"UART_2\000"
.LASF44:
.ascii"UART_3\000"
.LASF45:
.ascii"UART_4\000"
.LASF39:
.ascii"char\000"
.LASF51:
.ascii"bestd\000"
.LASF16:
.ascii"LPC_GPIO_TypeDef\000"
.LASF5:
.ascii"int32_t\000"
.LASF52:
.ascii"bestm\000"
.LASF60:
.ascii"CLKPWR_GetCLK\000"
.LASF33:
.ascii"SCI_CTRL\000"
.LASF59:
.ascii"uart_get_pointer\000"
.LASF14:
.ascii"RESERVED0\000"
.LASF17:
.ascii"RESERVED1\000"
.LASF18:
.ascii"RESERVED2\000"
.LASF19:
.ascii"RESERVED3\000"
.LASF20:
.ascii"RESERVED4\000"
.LASF21:
.ascii"RESERVED5\000"
.LASF30:
.ascii"RESERVED6\000"
.LASF31:
.ascii"RESERVED7\000"
.LASF22:
.ascii"RESERVED8\000"
.LASF24:
.ascii"RESERVED9\000"
.LASF34:
.ascii"SYNCCTRL\000"
.LASF53:
.ascii"best_divisor\000"
.LASF15:
.ascii"MASK\000"
.LASF38:
.ascii"Status\000"
.LASF8:
.ascii"short unsigned int\000"
.LASF35:
.ascii"LPC_UART4_TypeDef\000"
.LASF56:
.ascii"best_error\000"
.LASF65:
.ascii"uart_set_divisors\000"
.LASF54:
.ascii"divisor\000"
.LASF67:
.ascii"ITM_RxBuffer\000"
.LASF64:
.ascii"HardFault_Handler\000"
.LASF50:
.ascii"uClk\000"
.ident"GCC: (GNU Tools for ARM Embedded Processors) 4.8.4 20140725 (release) [ARM/embedded-4_8-branch revision 213147]"
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try to figure out what values to put in the registers (ie, run the code on a regular computer and copy the results) and manually configure a UART when I have time today, which probably won't be until this evening.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as I can tell, the fault is at .LVL24.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT: I realized there are some macros in there; they happen after the fault, so I shouldn't think their presence should cause any problems in interpreting what's going on. I'll fix it if they do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524669#M7305</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] LPC1778 hard fault during UART setup</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524670#M7306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by dbtayl on Fri Oct 31 19:23:20 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I got UART0 up and running by manually calculating the clock registers and not running UART_Init. So now I can dump register values. I currently have the following hardfault handler:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void HardFault_Handler(void)
{
uint32_t reg = SCB-&amp;gt;CFSR;
uint8_t regval[12];
regval[0] = '0';
regval[1] = 'x';
regval[11] = '\r';
regval[10] = '\n';

while(1)
{
//Bus fault
if(SCB-&amp;gt;CFSR &amp;amp; SCB_CFSR_BUSFAULTSR_Msk)
{
uint8_t msg[] = "bus fault: ";
UART_Send(UART_0, msg, 11, BLOCKING);

char i;
for(i = 0; i &amp;lt; 8; i++)
{
uint8_t nibble = (reg&amp;gt;&amp;gt;4*(7-i)) &amp;amp; 0x0f;
regval[i+2] = nibble &amp;lt; 10 ? nibble + '0' : nibble + 'a' - 10;
}

UART_Send(UART_0, regval, 12, BLOCKING);

//If BFAR is valid
if(reg &amp;amp; 1&amp;lt;&amp;lt;15)
{
uint8_t msg[] = "BFAR: ";
UART_Send(UART_0, msg, 6, BLOCKING);

uint32_t bfar = SCB-&amp;gt;BFAR;
char i;
for(i = 0; i &amp;lt; 8; i++)
{
uint8_t nibble = (bfar&amp;gt;&amp;gt;4*(7-i)) &amp;amp; 0x0f;
regval[i+2] = nibble &amp;lt; 10 ? nibble + '0' : nibble + 'a' - 10;
}

UART_Send(UART_0, regval, 12, BLOCKING);
}
}
//Memory fault
else if(SCB-&amp;gt;CFSR &amp;amp; SCB_CFSR_MEMFAULTSR_Msk)
{
uint8_t msg[] = "mem fault\n\r";
UART_Send(UART_0, msg, 11, BLOCKING);
}
//Usage fault
else if(SCB-&amp;gt;CFSR &amp;amp; SCB_CFSR_USGFAULTSR_Msk)
{
uint8_t msg[] = "usg fault\n\r";
UART_Send(UART_0, msg, 11, BLOCKING);
}
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From that, I get the following output:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;bus fault: 0x00008200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BFAR: 0x00000000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So... it's faulting at address 0 with a bus fault? Now this is making even less sense to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there any other registers I should dump?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:07:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SOLVED-LPC1778-hard-fault-during-UART-setup/m-p/524670#M7306</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:07:23Z</dc:date>
    </item>
  </channel>
</rss>

