IDE cannot find MEM-AP (LPCXpresso54608)

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

IDE cannot find MEM-AP (LPCXpresso54608)

4,561 Views
hosseinragheb
Contributor II

My LPCXpresso54608 board seems to have got a problem with power as the MCUXpresso IDE can no longer debug/flash code using the board, although it finds the probe. Below is what I get from the debugger. Also using LPCScript queryflash, only BankA and EEPROM are listed. Any idea what has caused this and how to fix it?

Thank you.

MCUXpresso RedlinkMulti Driver v10.0 (Jun 22 2017 23:31:55 - crt_emu_cm_redlink build 272)
Found chip XML file in C:/Users/hr140529/Documents/MCUXpressoIDE_10.0.2_411/workspace/sdk_demo_apps_hello_world/Debug\LPC54608J512.xml
( 5) Remote configuration complete
Reconnected to existing redlink server (PID 4294967295)
Connecting to probe 1 core 0 (server PID unknown) gave 'OK'
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.182 (NXP Semiconductors)
Serial Number: NRA2CQGQ
VID:PID: 1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&15e160a5&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
connection to debug bus (DpID 0x2BA01477 AP Index[0]: 0xFFFFFFFF) SWD failed - 'Em(01). Cannot find selected MEM-AP (check t ­›¿ m
connection failed - Em(01). Cannot find selected MEM-AP (check target power).. Retrying
connection to debug bus (DpID 0x2BA01477 AP Index[0]: 0xFFFFFFFF) SWD failed - 'Em(01). Cannot find selected MEM-AP (check t-­›¿ m
Failed on connect: Em(01). Cannot find selected MEM-AP (check target power)
Connected&Reset. Was: NotConnected. DpID: 00634BA8. CpuID: 00000000. Info: <None>
Last stub error 0: OK
Last sticky error: 0x0 AIndex: 0
No debug bus (MemAp) selected
DAP Speed test unexecuted or failed
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
(100) Target Connection Failed
error closing down debug session - Em(02). MEM-AP is not selected.

Also here are some responses to LPCScrypt commands:

LPCScrypt - CMSIS-DAP firmware programming script v1.8.2 April 2017.

Connect an LPC-Link2 or LPCXpresso V2/V3 Board via USB then press Space.

Press any key to continue . . .

Booting LPCScrypt target with "LPCScrypt_158.bin.hdr"
LPCScrypt target booted
.
Programming LPCXpresso V2/V3 with "lpc4322_bl_crc.bin"

- LPCXpresso V2/V3 programmed sucessfully and has the unique ID: NRA2CQGQ
- To use: remove DFU link and reboot.

Connect Next Board then press Space (or CTRL-C to Quit)

Press any key to continue . . .
Terminate batch job (Y/N)? y

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt memDisplay 0x00000000
0x0 10007fe0 100014f5 10000179 10001ded
0x10 1000017d 1000017f 10000181 00000000
0x20 00000000 00000000 00000000 10000183
0x30 10000185 00000000 10000187 10001e4d
0x40 1000018b 00000000 1000018b 00000000
0x50 1000018b 1000018b 1000018b 1000018b
0x60 10001e75 10001e5d 1000018b 1000018b
0x70 1000018b 1000018b 1000018b 1000018b
0x80 1000018b 1000018b 1000018b 1000018b
0x90 00000000 1000018b 1000018b 1000018b
0xa0 1000018b 1000018b 1000018b 1000018b
0xb0 1000018b 1000018b 1000018b 1000018b
0xc0 1000018b 1000018b 1000018b 1000018b
0xd0 1000018b 1000018b 1000018b 1000018b
0xe0 1000018b 1000018b 1000018b 1000018b
0xf0 00000000 00000000 1000018b 1000018b

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt queryOTPMem
0x40045000 a00bcb3c 00a66f29 00000000 00000080
0x40045010 00000000 00000000 00000000 00000000
0x40045020 00000000 00000000 00000000 00000000
0x40045030 00000000 00000000 00000000 00000000
0x40045040 00000000 00000000 00000000 00000000
0x40045050 86b95973 6384ab77 c2057d0c aa2d6a07
0x40045060 00000000 00000000 00000000 00000000
0x40045070 00000000 00000000 00000000 00000000

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt querypart
partID = 0xa00bcb3c 80
decode = LPC4322: BankA 512KB
Core Clock = 180000000

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt queryflash
Number of Flash Devices = 2
Name = BankA
Base = 0x1a000000
Size = 0x80000
Page = 0x1000
Sector = 8-64KB
Blank = 0xff
Buffer = 0x8000
Name = EEPROM
Base = 0x20040000
Size = 0x3f80
Page = 0x80
Sector = NA
Blank = 0x0
Buffer = 0x8000

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt erase BankA
Erasing BankA LPC_Error Fatal 0x10
... completed in 0.106s
Error: <Command line>:1: Fatal 0x10
Script cmd: erase BankA
Last target cmd: =eraseFlash 1a000000
Terminated with errors

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt program sdkusb_examples_
usb_keyboard2mouse_bm.bin.hdr BankA
..
Programmed 62480 bytes to 0x1a000000 in 0.149s (409.460KB/sec)

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt verify sdkusb_examples_u
sb_keyboard2mouse_bm.bin.hdr BankA
..
Verified 62480 bytes to 0x1a000000 in 0.017s (3588.943KB/sec)

C:\nxp\LPCScrypt\scripts>C:\nxp\LPCScrypt\bin\lpcscrypt erase BankA
Erasing BankA LPC_Error Fatal 0x10
... completed in 0.106s
Error: <Command line>:1: Fatal 0x10
Script cmd: erase BankA
Last target cmd: =eraseFlash 1a000000
Terminated with errors

C:\nxp\LPCScrypt\scripts>

9 Replies

2,721 Views
ritesh_prajapat
Contributor III

Hello MCUXpresso IDE Support, 

Reminder from our side. 

We are using LPCXpresso 54628 development kit OM13098 for our development purpose. We are also facing some issues while flashing firmware from USB powered cable. 

 

We are not able to flash firmware from USB and facing same issue which has been mentioned into this thread. 

 

Anyone has any idea like is it proper way to provide supply from USB through CPU and also flash firmware using that same interface via MCUXpresso tool?  Let me know if any other recommended option for same to flash firmware. 

 

Regards, 

Ritesh Prajapati

0 Kudos

2,721 Views
ritesh_prajapat
Contributor III

Hello, 

We are using LPCXpresso 54628 development kit OM13098 for our development purpose. We are also facing some issues while flashing firmware from USB powered cable. 

We are not able to flash firmware from USB and facing same issue which has been mentioned into this thread. 

Anyone has any idea like is it proper way to provide supply from USB through CPU and also flash firmware using that same interface via MCUXpresso tool?  Let me know if any other recommended option for same to flash firmware. 

Regards, 

Ritesh Prajapati

0 Kudos

2,721 Views
lpcxpresso_supp
NXP Employee
NXP Employee

So this raises the question as to what you have actually programmed into your board?

But that aside, you could try doing a mass erase via the "debug mailbox" that is implemented on these parts. There is a script that can be used to do this inside the IDE install directory at "/ide/bin/Scripts/LPC5410xMassErase.scp".

Instructions on how to use this script can be found at the top of the script file (which is basically just a text file).

Note that you will need to ensure the LPC-Link2 is booted first, which can be done using the "boot_link2" script in the /ide/bin directory (as per MCUXpresso IDE v10.0.2 User Guide section 14.12.4", Manually booting LPC-Link2").

Whether this will work is of course dependent on how badly you have "locked" your part.

Regards,

MCUXpresso IDE Support

2,721 Views
hosseinragheb
Contributor II

I am so grateful for your advice. It took me several attempts using different combinations of redlink commands (for whic I could not find any guide documents) to mass erase the flash. I have now recovered the board (using external Link2 probe), and am trying to recover the on-board Link2 Probe.

0 Kudos

2,721 Views
lpcxpresso_supp
NXP Employee
NXP Employee

I'll say again - you cannot use the LPCScrypt utility with the LPC54608 MCU.

LPCScrypt will only communicate with the LPC43xx MCU that is used in the debug probe.

Also - I strongly recommend that you do not try using the mbed firmware with this board unless you actually intend to develop using the mbed online tools and use the drag'n'drop mbed mechanism for programming.

I would suggest that the next thing you need to do is try booting the board into ISP mode before you try making a debug connection : https://community.nxp.com/message/630748 

And then follow the instructions I gave you in my previous post.

Regards,

MCUXpresso IDE Support

0 Kudos

2,721 Views
hosseinragheb
Contributor II

Thanks again for your response.

Unfortunately the MCU does not enter the ISP mode, I followed the steps suggested, alongside the reference manual (UM10912 - Chapter 3: LPC546xx Boot process - Rev. 2.0 - 26 July 2017), specifically Table 5. I've tried all combinations. My guess is the value written at ECRP has locked the use of ISP mode (UM10912 - Chapter 42: LPC546xx Enhanced Code Read Protection). Table 1020 specifically gives the details.

Also the manual specifically says: 

Remark: If SWD (17:16) is DISABLED, ISP Entry from ISP (15:14) is DISABLED, and ISP
Entry from Bootloader (13:12) is DISABLED, the IAP Mass Erase can still be used to
erase the entire Flash to recover a device.as long as the OTP MASS ERASE is
ENABLED. This will require a programming interface to program the Flash once it is
erased.

That's why I'm looking for a software/tool to access and write proper values at ECRP.

0 Kudos

2,721 Views
lpcxpresso_supp
NXP Employee
NXP Employee

First of all, note that LPCScrypt is not used for accessing the LPC54608 chip on your board. LPCScrypt can be used to program debug probe firmware into the built-in LPC-Link2 debug probe (which is based on an LPC43xx). Trying to program applications for the LPC54608 using LPCScrypt is thus very likely to result in a non-functioning debug probe!!!

Anyway, I suggest that you proceed as follows...

First of all, close down the IDE and disconnect your board from all power / USB sources and ensure that you have a link fitted on header JP5 ("DFU-Link").  This will allow the IDE to softload the probe firmware into the built-in LPC-Link2.

Now connect the board back up to debug port USB connector (J8) and also to the power USB connector (J1) - sometimes the board will not get sufficient power through USB alone (particularly if the LCD screen is being used or). If at all possible, I would suggest powering the board via a powered USB hub.

Now manually book the debug probe, as described in section 14.12, "Using and troubleshooting LPC-Link2" of the MCUXpresso IDE v10.0.2 User Guide (in particular section 14.12.4).

Please confirm at this point that the LPC-Link2 appears correctly in the Windows Control Panel "Devices and Printers"

Having done this, open Task Manager and make sure you have no executables of the following form running:

  • redlinkserv
  • arm-none-eabi_gdb*
  • crt_emu_*

Now start the IDE,  and try debugging one of the example projects. If the debug session still fails to start, please post the debug log that you now see.

Regards,

MCUXpresso IDE Support

0 Kudos

2,721 Views
hosseinragheb
Contributor II

Thanks for responding. As you've mentioned the on-board debug probe is not functioning any more, so I used an external LPC-Link2 probe instead. Following the steps suggested did not change the outcome though (see the log below).

I think what has caused all this is that I have mistakenly written (an example binary file) over the on-chip memory (at 0x0 rather than BankA for instance) using the LinkServer GUI Flash Programmer. Now the question is how to write the original chip firmware back to its appropriate location? I have downloaded "lpc4322_bl_crc.bin" and "lpc4322_lpc54608xpresso_if_crc.bin" from Updating LPCXpresso firmware - | Mbed 

and can obviously use LPCScrypt to program_CMSIS lpc4322_bl_crc.bin, but then I cannot program lpc4322_lpc54608xpresso_if_crc.bin. Any ideas?

MCUXpresso RedlinkMulti Driver v10.0 (Jun 22 2017 23:31:55 - crt_emu_cm_redlink build 272)
Found chip XML file in C:/Users/hr140529/Documents/MCUXpressoIDE_10.0.2_411/workspace/lpcxpresso54608_driver_examples_gpio_led_output/Debug\LPC54608J512.xml
Reconnected to existing redlink server (PID 4294967295)
Connecting to probe 1 core 0 (server PID unknown) gave 'OK'
Probe Firmware: LPC-LINK2 CMSIS-DAP V5.182 (NXP Semiconductors)
Serial Number: I3F4MZKT
VID:PID: 1FC9:0090
USB Path: \\?\hid#vid_1fc9&pid_0090&mi_00#8&20b2488&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
connection to debug bus (DpID 0x2BA01477 AP Index[0]: 0xFFFFFFFF) SWD failed - 'Em(01). Cannot find selected MEM-AP (check t4ë„X m
connection failed - Em(01). Cannot find selected MEM-AP (check target power).. Retrying
connection to debug bus (DpID 0x2BA01477 AP Index[0]: 0xFFFFFFFF) SWD failed - 'Em(01). Cannot find selected MEM-AP (check t ë„X m
Failed on connect: Em(01). Cannot find selected MEM-AP (check target power)
Connected&Reset. Was: NotConnected. DpID: 00000004. CpuID: 00000000. Info: <None>
Last stub error 0: OK
Last sticky error: 0x0 AIndex: 0
No debug bus (MemAp) selected
DAP Speed test unexecuted or failed
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
(100) Target Connection Failed
error closing down debug session - Em(02). MEM-AP is not selected.

0 Kudos

2,721 Views
hosseinragheb
Contributor II

Having read about ECRP (Enhanced Code Read Protection), I notice that its value at 0x20 is currently 00000000 (lpcscrypt memDisplay 0x00000020). I think the current ECRP settings (bit values) stop many possible interactions such as ISP, SWD, Flash erase/write. Now, I need to write the new value 0002A83F at 0x20 to enable ISP boot up possibility and SWD. Any idea how I can do this please? I tried LPCScrypt commands below, but no luck yet (even generated the binary file containing the word I need 0002A83F, called ECRP0x20.bin below).

lpcscrypt flashSet 0x00000020 0x0002A83F
LPC_Error Address not in Flash 0x9 0x20
Error: <Command line>:1: Address not in Flash 0x9 0x20
Script cmd: flashSet 0x00000020 0x0002A83F
Last target cmd: =flashSet 20 2a83f
Terminated with errors

lpcscrypt program ECRP0x20.bin 0x00000020
Error: <Command line>:1: No matching memory found 0x00000020 (0x20)
Script cmd: program ECRP0x20.bin 0x00000020
Last target cmd: =queryFlash
Terminated with errors

0 Kudos