Reset target after flashing not working v8.1.4

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

Reset target after flashing not working v8.1.4

1,174 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hparracho on Thu Apr 21 08:43:15 MST 2016
Hi

I have a custom board with a LPC812 MCU.

Using LPCXpresso 8.1.4 (have not checked any previous versions) and a LPC-Link2 the target is not reset after flashing.
Debug sessions working fine, flashing not (stuck at hard fault interrupt after flashing).

Below you have the command line and the flash log.
Thanks.


crt_emu_cm_redlink -flash-load-exec "S:\projects\FPIO32S-V1\firmware\MODS_TEST\Release\MODS_TEST.
axf" -g -2 -vendor=NXP -pLPC812 -reset=vectreset -flash-driver=LPC800_16.cfx



Ni: LPCXpresso RedlinkMulti Driver v8.1 (Mar 11 2016 13:34:34 - crt_emu_cm_redlink.exe build 672)
Pc: (  0) Reading remote configuration
Pc: (  5) Remote configuration complete
Nc: Probe Firmware: LPC-LINK2 CMSIS-DAP V5.147 (NXP Semiconductors)
Nc: Serial Number:  IQC0EXMV
Nc: VID:PID:  1FC9:0090
Nc: USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&278b3e39&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Pc: ( 30) Emulator Connected
Pc: ( 40) Debug Halt
Pc: ( 50) CPU ID
Nc: Emu(0): Connected&Reset. DpID: 0BC11477. CpuID: 410CC600. Info: <None>
Nc: Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Nc: inspected v.2 On-chip Flash Memory C:\nxp\LPCXpresso_8.1.4_606\lpcxpresso\bin\Flash\LPC800_16.cfx
Nc: image 'LPC800 (16K) Feb 16 2016 09:18:35'
Nc: NXP: LPC812  Part ID: 0x00000000
Pc: ( 65) Chip Setup Complete
Nt: Connected: was_reset=true. was_stopped=false
Cr:v LPCXpresso Free License - Download limit is 256K
Pc: ( 70) License Check Complete
Nt: Loading 'MODS_TEST.axf' ELF 0x00000000 len 0x226C
Nt: Writing 8812 bytes to address 0x00000000 in Flash
Pb: 1 of 1 (  0) Writing pages 0-8 at 0x00000000 with 8812 bytes
Ps: (  0) at 00000000: 0 bytes - 0/8812
Ps: ( 11) at 00000000: 1024 bytes - 1024/8812
Ps: ( 23) at 00000400: 1024 bytes - 2048/8812
Ps: ( 34) at 00000800: 1024 bytes - 3072/8812
Ps: ( 46) at 00000C00: 1024 bytes - 4096/8812
Ps: ( 58) at 00001000: 1024 bytes - 5120/8812
Ps: ( 69) at 00001400: 1024 bytes - 6144/8812
Ps: ( 81) at 00001800: 1024 bytes - 7168/8812
Ps: ( 92) at 00001C00: 1024 bytes - 8192/8812
Ps: (100) at 00002000: 1024 bytes - 9216/8812
Nt: Erased/Wrote page  0-8 with 8812 bytes in 401msec
Pb: (100) Finished writing Flash successfully.
Nt: Flash Write Done
Nt: Loaded 0x226C bytes in 543ms (about 16kB/s)
Nt: Reset target (core)
0 Kudos
Reply
4 Replies

1,075 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos
Reply

1,075 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hparracho on Fri Apr 22 03:36:51 MST 2016
Thanks for your reply.

Maybe I didn't explain myself properly...

Both my firmware versions (debug and release) are just working fine as they should.
The problem is that after flashing the firmware the mcu doesn't reset and gets stuck at hard fault interrupt. I saw this by attaching a debug session after flashing.
If I power cycle the board everything's working properly.

I also experienced this same behavior with an "empty program", just the main and a while(true). It is hard to mess up this complex program. :-)

While developing it kind of sucks to have to power cycle the target after every firmware upload...
0 Kudos
Reply

1,075 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Apr 22 03:27:32 MST 2016
I'm afraid that the vectreset option does not reset well enough to start execution from flash on an LPC812.  Using the 'system' reset should work though.

If you omit the -reset option the utility will normally use the type of reset most appropriate to the part.  Alternatively you could specify "--reset system" (or -reset=system, or --reset=system) explicitly.

If you don't need the additional output (that is intended for use by the IDE) you can omit '-g' too.  Likewise the '-2' which just sets the debug level.  In fact "NXP" is the default --vendor, so you could omit that.  And the default flash driver set by --flash-driver is picked up based on the part number (LPC812), so you don't really need to specify that either.

In fact you could probably simply use

crt_emu_cm_redlink -p LPC812 --flash-load-exec S:\projects\FPIO32SV1\firmware\MODS_TEST\Release\MODS_TEST.axf

Tip: I imagine that you obtained the command line by modifying what the IDE uses when the 'program flash' tool is used?  This is generally a safe thing to do. 
(You may notice, in your case, that no '-reset' option is included on that command line...  and that should work.)

Sincerely
LPCXpresso IDE Support
0 Kudos
Reply

1,075 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by vtw.433e on Fri Apr 22 01:51:03 MST 2016
Without any more information, I would suggest there is a bug in your code. I see you a downloading the Release version of your code:
- have you tried running the Release version through the debugger?
- have you tried flashing the Debug (and presumably, working) version using the command line tool?

The logs suggest that the tools are doing what they are meant to do, and the fact that you say you und up in a Hard Fault suggests it is your code that is the problem...
0 Kudos
Reply