Custom board doesn't run stand alone

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom board doesn't run stand alone

1,059 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Sun Jun 22 07:05:26 MST 2014
Hi,

I've designed a custom board using the LPC812. In debug mode everything works fine.
When I try to run the program without the debugger nothing happens.
It seems the debugger flashes the program into flash, so I thought that a simple power cycle would run the program again.
Unfortunately it does not. It does not matter whether the SWD link as attached or not.
I've checked reset and isp_enable and they are both high, so that should not be the problem. How can I make sure that the code runs without starting a debug session?

Thanks in advance.

Kind regards,

Remco Poelstra
Labels (1)
0 Kudos
16 Replies

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Sun Jun 29 11:08:30 MST 2014
Sorry for the late reply.
You're most likely good, when it comes to debug-code.
The old libraries for other LPC devices had some debug-code, which I had to disable in order to get my devices to do anything.
LPCOpen seems to be far better.
If your program is very simple, you may be able to disassemble the output and read through the disassembly.
But before you do that, maybe you just want to run the C Preprocessor, which "expands" all code and prepares the code as one huge raw text-file, which is fed into the compiler.
Way too few people know about this feature and even fewer use it.
(I'm using GCC myself; I have no idea how to do this with other compilers)
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Fri Jun 27 07:31:51 MST 2014
Found the problem. The ISP line is controlled by a FT232R via the DTR signal. The FT232R is running from USB power, but no cable was attached so it was powered down. I had assumed that it then would not fiddle with the ISP line, but as it turned out it hold the line at half voltage for a while. Long enough for the LPC800 to mark it as a ISP command.
I've now configured the FT232R to run for the main supply and it all works correctly now.
Thanks for the support.

Remco
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Jun 27 04:44:11 MST 2014
That address is in the ROM boot loader. This implies that you have not got ISP tied correctly.

See ISP section in here:
http://www.lpcware.com/content/faq/lpcxpresso/debug-design
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Fri Jun 27 04:37:31 MST 2014
I've loaded the blinky example, with the only modification in board.h to use the internal oscillator (set the define to 0).
The reset behavior is exactly the same, i.e. the part generates a reset pulse on its own and the code does not run. Only after I assert a hardware reset the code runs.
When I attach the debugger after I startup the board and click suspend the debugger indicates the following:
   Thread [1] <main> (Suspended : Signal : SIGINT:Interrupt)
No further address or code references are shown. Could this give a hint on what the processor is doing at that moment?
The program counter is at 0x1FFF1AE0, but I've no idea where that is.

How can I best continue from here?

Remco
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Tue Jun 24 08:29:04 MST 2014
I've taken a screenshot of the power supply and reset line. It seems that the LPC800 asserts reset on its own. I've yet to investigate whether my code is causing this.
The lower trace is VCC the upper trace is reset.

I'm using the internal oscillator and the Chip_SystemInit for initialisation.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Mon Jun 23 12:55:32 MST 2014
Hi remcopoelstra,
I also suggest you to probe vcc vs. reset signals
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Jun 23 10:12:26 MST 2014
Not sure which hardware you are using, but this sounds like a timing problem...

Would suggest to use a very simple program (blinky without interrupts) to test a few things.

Are you using a crystal? Perhaps it needs a little delay loop...
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Mon Jun 23 10:04:45 MST 2014
It seems to have something to do with the startup of the part.
When I manually reset the part, the code runs reliably. When I power cycle the part, the code won't run. I've seen it run once after startup, but usually nothing happens.
Should I've taken special pre-cautions for proper startup? I've done the usual, such as pullups and decoupling caps.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Mon Jun 23 08:44:28 MST 2014
@Kevin Wells:
How do I check for the missing checksum? I assume that, because the code runs at debug time, that the code flashed to firmware does contain the checksum. Is there some way to check that assumption?

@PacMan:
How can I make sure all debug code is disabled? The application is very simple and only sends two I2C commands. Could there be hidden debug code in a board library or so? I only know about the DEBUG_ENABLE define, which controls debug output.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Mon Jun 23 08:40:59 MST 2014
Yep, Pullups are there. Voltages seem ok to me.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Sun Jun 22 12:09:22 MST 2014
Missing checksum?

The reserved Cortex-M0+ exception vector location 7 (offset 0x0000 001C in the vector
table) should contain the 2’s complement of the check-sum of table entries 0 through 6.
This causes the checksum of the first 8 table entries to be 0. The bootloader code
checksums the first 8 locations in sector 0 of the flash. If the result is 0, then execution
control is transferred to the user code.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Sun Jun 22 11:56:27 MST 2014
Make sure you've disabled all debug code.

Just a hint; it may be useful, it may be bogus...  ;-)
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sun Jun 22 10:59:14 MST 2014
Pull-ups at Reset and ISP-pin?
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Sun Jun 22 09:53:38 MST 2014
I've tried both Newlib (none) and Redlib (none), but they both do not run stand alone.
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Sun Jun 22 09:25:31 MST 2014
Yes, but I disabled all output. Does that still block the code from running?
0 Kudos

999 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sun Jun 22 07:34:15 MST 2014
Which library are you linking? Semihosting?
0 Kudos