LPCXpresso, LPC-Link2 and RESET line

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

LPCXpresso, LPC-Link2 and RESET line

Jump to solution
4,842 Views
alexandertolchi
Contributor I

My board has a IC supervisor/Reset-button (for example, MAX6863UK29-T, TPS3838K33DBV) on its RESET line. RESET from LPC-Link2 has duration ~4ms and causes RESET signal from IC supervisor with duration 100..300ms which is further fed to target MCU. LPCXpresso seems not to be aware of this long RESET signal and tries to initialize JTAG-chain/SWD immediately after the end of short RESET – but JTAG-chain/SWD is under the long RESET right at this moment and therefore can't be initialized. Debug target MCU is LPC43xx in case it makes any difference.

How to set a delay between the moment when RESET comes from LPC-Link2 is released and the initialization of JTAG-chain/SWD?
Is it possible to delay initialization of JTAG-chain/SWD until the moment when RESET on the target board won't be released?

Labels (2)
0 Kudos
1 Solution
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There is an IDE option to control LPC-Link2 pulling ISP on reset:

Preferences -> LPCXpresso -> Redlink/LinkServer Options -> Pull ISP on reset

Try unticking this option.

Yours,

LPCXpresso Support

View solution in original post

0 Kudos
13 Replies
2,830 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There is an IDE option to control LPC-Link2 pulling ISP on reset:

Preferences -> LPCXpresso -> Redlink/LinkServer Options -> Pull ISP on reset

Try unticking this option.

Yours,

LPCXpresso Support

0 Kudos
2,829 Views
alexandertolchi
Contributor I

Thank You for attention.

With your setting all works (“Attach only = False”, MCU LPC4330 without flash):

Window > Preferences -> LPCXpresso -> Redlink/LinkServer Options -> Pull ISP on reset = NO

No “RESET” and “ISP_CTRL (pin 7)” from IDE, “Connect script” works and forms RESET, program stops on start. Hard RESET absent at all without “Connect script”.

Console "Debug messages":

-------------------------------------------------

LPCXpresso RedlinkMulti Driver v8.2 (Sep  5 2016 10:12:38 - crt_emu_cm_redlink build 725)

Found chip XML file in D:/LPC/CML/Prj-M4MC_1/Debug/LPC4330.xml

(  5) Remote configuration complete

============= SCRIPT: MyConnect.scp =============

Reset pin state: 00

Time:    75110

Elapsed: 2000

============= END SCRIPT ========================

Probe Firmware: LPC-LINK2 CMSIS-DAP V5.173 (NXP Semiconductors)

Serial Number:  LUCSPVCV

VID:PID:  1FC9:0090

USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

Emu(0): Connected&Reset. DpID: 4BA00477. CpuID: 410FC240. Info: <None>

Debug protocol: JTAG. RTCK: Disabled. Vector catch: Disabled.

internal error - no information given to derive flash driver version from

Flash started with bad or no driver - Ef(44): Flash driver version is unknown.

internal error - no information given to derive flash driver version from

NXP: LPC4330  Part ID: 0x00000000

Connected: was_reset=true. was_stopped=false

LPCXpresso Free License - Download limit is 256K

============= SCRIPT: LPC18LPC43RamReset.scp =============

Vector table SP/PC is the reset context.

PC = 0x100004ED

SP = 0x10092000

XPSR = 0x21000000

============= END SCRIPT =================================

Stopped: Breakpoint #1

----------------------------------------------------

I was set in “Connect script” delay 200ms=2000 and RESET=10ms (but on wire it is 12ms).

Below - oscillograms for “Pull ISP on reset” = NO and next YES:
1(Y) – RESET (pin 10), 2(B) – TCK/SWCK (pin 4), 3(P) – ISP_CTRL (pin 7)
imageFile.png

imageFile.png

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I think I understand what's happening. The connect script is used by the debug utility (stub) which passes the information to the LinkServer at an appropriate time during the debug connection. In this case, the server program first attempts to establish a wire connection to show the available connections, but it's done without benefit of a script. The IDE issues an unsolicited WireIspReset command in an attempt to first boot the part into the ISP. This triggers your supervisor circuit, and the server cannot display the LPC4330 cores and exits. I haven't found a way to disable it yet, but I'm working on it.

Thanks and regards,

LPCXpresso Support

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Thanks for this additional information. Can you copy and paste the contents of The Debug Log here, and also the MyConnect.scp? The other thing I'll recommend, it may be there is an orphaned redlinkserv.exe process in the background when you start up the debug session. If so, the IDE will try to use it and it's possible the server already has an open socket on the debug port. If you see this, kill the process in the Task Manager before starting the debug session.

Thanks and regards,

LPCXpresso Support

0 Kudos
2,829 Views
alexandertolchi
Contributor I

Process "redlinkserv.exe (32 bits)" is absent before starting of LPCXpresso.

Console "Debug messages" for  “Attach only = True” (JTAG works):

----------------------------------------------------------

LPCXpresso RedlinkMulti Driver v8.2 (Sep 5 2016 10:12:38 - crt_emu_cm_redlink build 725)
Found chip XML file in D:/LPC/CML/Prj-M4MC_1/Debug/LPC4330.xml
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.173 (NXP Semiconductors)
Serial Number: LUCSPVCV
VID:PID: 1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Emu(0): Connected&Reset. DpID: 4BA00477. CpuID: 410FC240. Info: <None>
Debug protocol: JTAG. RTCK: Disabled. Vector catch: Disabled.
internal error - no information given to derive flash driver version from
internal error - no information given to derive flash driver version from
NXP: LPC4330 Part ID: 0x00000000
Connected: was_reset=false. was_stopped=false
LPCXpresso Free License - Download limit is 256K

----------------------------------------------------------

After command in IDE "Restart", programm stops on 1-st command in "main()" and I get additional strings in console "Debug messages":

---------------------------------------------------------
Stopped: Halt
============= SCRIPT: LPC18LPC43RamReset.scp =============
Vector table SP/PC is the reset context.
PC = 0x100004ED
SP = 0x10092000
XPSR = 0x21000000
============= END SCRIPT =================================
============= SCRIPT: LPC18LPC43RamReset.scp =============
Vector table SP/PC is the reset context.
PC = 0x100004ED
SP = 0x10092000
XPSR = 0x21000000
============= END SCRIPT =================================
Stopped: Breakpoint #1

------------------------------------------------------------

For “Attach only = False” (JTAG don't works) console "Debug messages" is absent at all.  

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Can you attach a screenshot of your debug configuration which shows the connect script entry? Where have you placed the script file? The default script location is the Scripts subdirectory to your <install>\lpcxresso\bin folder. Otherwise, you have to use a full path name to the file.

The second thing I'd like you to change is the name of the c% script variable (e.g. f%) to avoid a potential issue. a% - d% are typically reserved by the script engine for core registers PC, SP, xPSR, and VTOR, respectively. There should be  no usage conflict within a connect script, but it's better to not get into a bad habit.

Thank and regards,

LPCXpresso Support

0 Kudos
2,829 Views
alexandertolchi
Contributor I

OK, bellow - my debug settings and place of "MyConnect.scp" (together with others scripts):

DBG_settings.png

Script_DIR.png

Text of "MyConnect.scp" - the same as above (i changed c% to f%).

JTAG - don't works, messages from “Connect script” in console of RedlinkServer is absent:

EMU.png

JTAG.png

Console of RedlinkServer:

-----------------------------

redlink>ProbeList
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.173
Serial Number = LUCSPVCV
VID:PID = 1FC9:0090
Path = \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
redlink>ProbeStatus
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.173
Serial Number = LUCSPVCV
VID:PID = 1FC9:0090
Path = \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
IsOpen = TRUE
WireInitialized = TRUE
WireProtocol = SWD
CoresConfigured = TRUE
PacketSize = 1024
Reference Count = 0
HasSWV = FALSE
HasETM = FALSE
HasJTAG = TRUE
HasSWD = TRUE
Probe Type = CMSIS-DAP
Probe Reference Count = 0
redlink>ProbeIsOpen 1
TRUE
redlink>WireIspReset 1
redlink>WireIsConnected 1
FALSE
redlink>WireJtagConnect 1
redlink>CoresConfigured 1
TRUE
redlink>CoreList 1
redlink>ProbeStatus
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.173
Serial Number = LUCSPVCV
VID:PID = 1FC9:0090
Path = \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
IsOpen = TRUE
WireInitialized = TRUE
WireProtocol = SWD
CoresConfigured = TRUE
PacketSize = 1024
Reference Count = 0
HasSWV = FALSE
HasETM = FALSE
HasJTAG = TRUE
HasSWD = TRUE
Probe Type = CMSIS-DAP
Probe Reference Count = 0
redlink>quit
[Closed]

---------------------------------------------------------

If I set “Attach only = True”, than JTAG works:

JTAG-OK.png

 

Console of RedlinkServer:

-----------------------------

redlink>ProbeList
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.173
Serial Number = LUCSPVCV
VID:PID = 1FC9:0090
Path = \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
redlink>ProbeStatus
Index = 1
Manufacturer = NXP Semiconductors
Description = LPC-LINK2 CMSIS-DAP V5.173
Serial Number = LUCSPVCV
VID:PID = 1FC9:0090
Path = \\?\hid#vid_1fc9&pid_0090&mi_00#9&2c20669a&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
IsOpen = TRUE
WireInitialized = TRUE
WireProtocol = SWD
CoresConfigured = TRUE
PacketSize = 1024
Reference Count = 0
HasSWV = FALSE
HasETM = FALSE
HasJTAG = TRUE
HasSWD = TRUE
Probe Type = CMSIS-DAP
Probe Reference Count = 0
redlink>ProbeIsOpen 1
TRUE
redlink>WireIsConnected 1
TRUE
redlink>WireGetProtocol 1
SWD
redlink>WireJtagConnect 1
redlink>CoresConfigured 1
TRUE
redlink>CoreList 1
TAP 0: 4BA00477 Core 0: M4 APID: 24770011
TAP 1: 0BA01477 Core 0: M0 APID: 04770021
redlink>ProbeIsOpen 1
TRUE
redlink>WireIsConnected 1
TRUE
redlink>WireGetProtocol 1
SWD
redlink>WireJtagConnect 1
redlink>CoresConfigured 1
TRUE

----------------------------------------

But with “Attach only = True” no stop on start and interupts don't works after switch to other project...

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Connect/Reset scripts are used with LinkServer emulator connections, typically with LPC-Link2 CMSIS-DAP probes like you're using. Be certain to set the project Debug Configuration Debugger <tab> Emulator selection to LinkServer, or you'll not be allowed to enter a connect or reset script file name.

I understood your supervisor circuit monitors the RESET state and latches the assert for 300 ms. Is this not the case? If not, please explain. If so, the connect script WIRETIMEDRESET command triggers the (assert/release) of the RESET line. So, programming a delay (using the example script above) after this command should provide the delay your supervisor circuit requires. I can assure you the debug utility does not configure the JTAG/SWD wire protocol until the script is finished executing. There are script commands which configure the wire, but you won't be using these.

Thanks and regards,

LPCXpresso Support

0 Kudos
2,829 Views
alexandertolchi
Contributor I

Yes, my setting for “Emulator selection” is “LinkServer”.


You write: “your supervisor circuit monitors the RESET state and latches the assert for 300 ms” – YES, You're right! This long RESET_300ms and initialization of JTAG from LPCXpresso are imposed at each other and go at the same time. The long RESET doesn't allow to go initialization of JTAG. It is necessary to solve this problem. How?


In my LPCXpresso (v8.2.2 [Build 650]) “Connect script” isn’t activated at all! You write, that for “Attach only = True”, it is right – “any configured script is prevented from use”. For “Attach only = False”, from you words, “Connect script” has to be go before initialization of JTAG - is so? If so, then LPCXpresso itself in case “Attach only = False” before initialization JTAG (and probably after “Connect script”) gives RESET which will be extended on my board up to 300 ms and initialization of JTAG won't take place again.

0 Kudos
2,829 Views
alexandertolchi
Contributor I

Thank You for replay.


Signal on RESET-Line appears, if I set option “Attach only = False” (in “Run/Debug Settings” of Project Properties). This RESET from LPC-Link2 has duration ~4ms. Next after 10ms LPCXpresso make initialization of JTAG-chain/SWD. It is necessary for me to change this 10ms to 300ms - delay must be longer of signal RESET from IC supervisor/Reset-button. How to do it?


If I set option “Attach only = True” signal RESET from LPC-Link2 is absent and initialization of JTAG-chain/SWD goes OK (but not each time). With this setting program doesn’t make stop on start and interrupts don’t work after switching to other project. Only after "Restart" of program in LPCXpresso, I get "stop on start".


I inserted your script in “Connect Script” option of “Run/Debug Settings” for Project Properties. Connect script isn’t activated – I don’t see messages from this script in console of RedlinkServer and I don’t see signal on RESET line. If I type these commands in console – they works: I see signal RESET and I see messages in console. Why “Connect Script” isn’t activated?


My question is the same… How to delay initialization of JTAG-chain/SWD after release of Signal RESET from LPC-Link2?

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

The Attach configuration option allows the debugger to attach to a running system without disturbing it in any way. For Attach = true, any configured script is prevented from use.

It seems clear enough what you're trying to do. You want to assert RESET (hard), then delay 300 ms before the debugger proceeds with the debug connection. If so, a programmed delay in the script example above will accomplish this. Simply edit the line 220 UNTIL e% >= 30000 statement (see above)  to read 220 UNTIL e% >= 3000. In other words, replace the 30000 value with 3000. This changes the program delay from 3.0 seconds to 0.30 seconds (300 ms). Then use the edited version of the script file as a connect script.

Regards,

LPCXpresso Support

0 Kudos
2,829 Views
alexandertolchi
Contributor I

“Attach only = True” or “Attach only = False” – doesn't matter, “Connect script” isn’t activated at all! Why?


If I set “Attach only = False”, then LPCXpresso SELF forms hard RESET on output of LPC-Link2 - duration ~4ms. Next after 10ms LPCXpresso make initialization of JTAG-chain/SWD. But RESET from LPC-Link2 will be extended till 200ms – it does IC Supervisor/Reset-button on my board (MAX6863UK29-T, TPS3838K33DBV). Extended RESET doesn't allow to do initialization of JTAG-chain/SWD and LPCXpresso doesn't see “target” (LPC4330). It is necessary to delay initialization of JTAG-chain/SWD until end of extended RESET. How?


I think “Connect script” will not help me. You write, that for “Attach only = True”, any configured script is prevented from use. For “Attach only = False”, if “Connect script” works before hard RESET_4ms (from option “Attach only = False”), then it makes no difference. If after - JTAG-chain/SWD will be resetted from “Connect script” and connection with “target” will be lost.

0 Kudos
2,829 Views
lpcxpresso_supp
NXP Employee
NXP Employee

LPCXpresso, by default uses the VECTRESET signal to reset the LPC43xx parts. It does not toggle the RESET line unless you're explicitly doing so via a LinkServer connect script. A script would normally use one of the WIRETIMEDRESET, WIREHOLDRESET, or WIREISPRESET commands for this purpose. The script language presently does not support a DELAY primitive, but it's possible to use the TIME command (increments a counter at 10 ms intervals) within a script program loop to affect a delay of any reasonable length. The following example would need to be referenced from the LPCXpresso Project Debug Configuration as a connect script.

100 p% = PROBEFIRSTFOUND
110 REM Hold Reset for 10 ms
120 WIRETIMEDRESET p% 10
130 REM Initial timer value
140 t% = TIME
150 PRINT "Time:    "; t%
160 REM Current timer value
170 c% = 0
180 REPEAT
190   REM Current timer value until 3 seconds elapsed
200   c% = TIME
210   e% = c% - t%
220 UNTIL e% >= 30000
230 PRINT "Elapsed: "; e%
240 END

EDIT: I realize this implementation doesn't make sense waiting to count to 30000. The LinkServer TIME primitive shows it returns clock() * 10 in your release. This has to be a bug. To get the number of seconds, the output from clock() is divided by CLOCKS_PER_SEC (typically equal to 1000). 3000 milliseconds is 3 seconds. Since TIME returns clock() * 10, the count you're waiting for is 3000 * 10, or 30000. This will be fixed in a future release.

0 Kudos