LPC54018 SWD Programming

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

LPC54018 SWD Programming

3,119 Views
ahmed_mostafa
Contributor II

Hello,

I have created my own circuit board based on the LPC54018. I copied the schematic exactly as the LPC54018 IoT board, except without the wifi chip and the external SPI flash. Do I need the external SPI flash in order to debug the microcontroller?

How can I load a program onto a brand new microcontroller using only SWD and no other pins?

Thanks,

Ahmed

Labels (1)
0 Kudos
15 Replies

3,080 Views
mohd_
Contributor III

Hi @ahmed_mostafa ,

I use LPC Link-2 to program my custom lpc54018 board. 

I dont know if this going to help, you can try to reset your board, close and open back your IDE or try using other usb ports.

 

 

0 Kudos

3,089 Views
ahmed_mostafa
Contributor II

Can anyone provide any help?

0 Kudos

3,066 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ahmed_mostafa,

Which debugger do you used?

Could you please take a picture about the hardware connection.

And what about your project? This chip is no internal flash, so you only can put your code in RAM.

 

BR

Alice

0 Kudos

3,063 Views
ahmed_mostafa
Contributor II

@Alice_Yang 

I use the CMSIS DAP probe debugger that is present on the mini IoT debugger

https://www.nxp.com/products/sensors/accelerometers/mini-iot-baseboard:OM40008

How do I load my code into RAM instead of flash? I am using MCUXpresso.

I notice the Evaluation board has an external flash SPI chip. Is that what is used to program the device on the LPC54018 IoT board? https://www.nxp.com/design/designs/lpc54018-iot-solution:IoT-Solution-with-Amazon-FreeRTOS

 

0 Kudos

3,035 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

1) If you use  OM40008: Mini IoT Baseboard, please refer to UM:

https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true  

2)I notice the Evaluation board has an external flash SPI chip. Is that what is used to program the device on the LPC54018 IoT board?

->> YES.

 

BR

Alice

0 Kudos

3,027 Views
ahmed_mostafa
Contributor II

@Alice_YangThe part number we are using is LPC54018J2MET180. According to the datasheet and the manual, this part does have internal flash memory for code execution. Using SWD and using MCUXpresso, how can we load our code into the internal flash memory?

ahmed_mostafa_0-1623785884845.png

 

0 Kudos

2,993 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ahmed_mostafa,

1) Yes, the chip of LPC54018J2MET180 have internal flash.

2) You can download a SDK demo to test.

3) How about use another debugger? J-link or LPC-link2 .

 

BR

Alice

0 Kudos

2,980 Views
ahmed_mostafa
Contributor II

@Alice_YangWhich SDK demo should I use to test? All of the SDK demos use external flash. The LPC54018 IoT board that I am using uses an external flash memory for storing the program. How do I tell the microcontroller to store the program in internal flash instead?

0 Kudos

2,886 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ahmed_mostafa,

As your chip is  LPC54018J2MET180, please use the SDK 

Alice_Yang_0-1625795561694.png

The part number without "M" meaning the chip doesn't include internal FLASH.

 

BR

Alice

 

0 Kudos

3,021 Views
converse
Senior Contributor V

For parts with internal flash memory, the debugger will automatically load the application into flash, if the application is built to use the flash. Simplest way to test this out is to create a simple application using the New Project wizard and selecting the correct target MCU. Then start a debug session with the built application.

This is described In the MCUXpresso User Manual.

0 Kudos

3,012 Views
ahmed_mostafa
Contributor II

When I try to load the code into flash memory, I get this error:

Driver V.2 dynamic startup failed - driver Init provided no flash parameters

Flash Driver V.2 startup failed - rc Ef(55): Dynamic flash driver startup failed to provide flash parameters.

Terminate (0x0, 0x0, 0x0) status 0x40 - driver reports init failure - EXTSPI driver rc 1 - Device is busy

chip initialization failed - Ef(55): Dynamic flash driver startup failed to provide flash parameters.

failed to initialize flash driver LPC540xx_SPIFI_SFDP.cfx

 

I suspect that the flash driver built into MCUXpresso for this specific part does not know how to communicate with the internal flash.

ahmed_mostafa_0-1623866335461.png

For this particular part, there are 2 variations. There's the LPC540xx which do NOT have internal flash storage. Then there's the LPC540xxJ, which DO have internal flash. I suspect that the "LPC540xx_SPIFI_SFDP.cfx" driver that is used in the IDE is not compatible with the LPC540xxJ variant of the part.

 

@Alice_Yang @converse any help?

 

0 Kudos

3,113 Views
converse
Senior Contributor V

No you do not need external SPI to debug.

you will need a debug probe such as MCU-link, LPC-link2 etc and install an IDE such as the free NXP MCUXpresso.

0 Kudos

3,109 Views
ahmed_mostafa
Contributor II

I use MCUXpresso and it works just fine with the LPC54018 IoT module. I'm using the CMSIS Link server debugger than comes with that IoT module.

However when I apply that same setup to my custom board, I get errors. I'm confident that I've connected the SWD traces correctly to the microcontroller. Is there any other setting I need to do inside MCUXpresso? This is my Console output:

__________________________________________________________________________

MCUXpresso IDE RedlinkMulti Driver v11.3 (Jan 11 2021 16:41:13 - crt_emu_cm_redlink build 9)

Found chip XML file in C:/Users/amostafa9/Documents/Code Repositories/LPC54018_Digital_Out/lpcxpresso54s018_mcofd_Digital_Out/Debug\LPC54S018.xml

Reconnected to existing LinkServer process.

Probe Firmware: LPC11U3x CMSIS-DAP v1.0.4 (NXP Semiconductors)

Serial Number:  11041018

VID:PID:  1FC9:0132

USB Path: \\?\hid#vid_1fc9&pid_0132&mi_00#7&25c5da96&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

Using memory from core 0 after searching for a good core

On debug connection - use system reset, stalling when 0x40000040 is accessed

Retask read watchpoint 1 at 0x40000040 to use for boot ROM stall

Waiting for target to stop...

Warning - processor did not halt - gave up waiting

debug interface type      = CoreSight DP (DAP DP ID 2BA01477) over SWD TAP 0

processor type            = Cortex-M4 (CPU ID 00000C24) on DAP AP 0

number of h/w breakpoints = 6

number of flash patches   = 2

number of h/w watchpoints = 4

Probe(0): Connected&Reset. DpID: 2BA01477. CpuID: 00000C24. Info: <None>

Debug protocol: SWD. RTCK: Disabled. Vector catch: Enabled.

Content of CoreSight Debug ROM(s):

RBASE E00FF000: CID B105100D PID 04000BB4C4 ROM (type 0x1)

ROM 1 E000E000: CID B105E00D PID 04000BB00C Gen SCS (type 0x0)

ROM 1 E0001000: CID B105E00D PID 04003BB002 Gen DWT (type 0x0)

ROM 1 E0002000: CID B105E00D PID 04002BB003 Gen FPB (type 0x0)

ROM 1 E0000000: CID B105E00D PID 04003BB001 Gen ITM (type 0x0)

ROM 1 E0040000: CID B105900D PID 04000BB9A1 CSt TPIU type 0x11 Trace Sink - TPIU

ROM 1 E0041000: CID B105900D PID 04000BB925 CSt ETM type 0x13 Trace Source - Core

NXP: LPC54S018

DAP stride is 4096 bytes (1024 words)

XML Error - no license-type XML file 'crt_common.xme' on path.

note - part information contained no product license-type data

Inspected v.2 External Flash Device on SPI LPC540xx_SPIFI_SFDP.cfx

Image 'LPC540xx_JEDEC_SFDP Dec 17 2020 10:03:04'

Opening flash driver LPC540xx_SPIFI_SFDP.cfx

Using SOFT reset to run the flash driver

rst - Boot ROM stall address was not accessed (but we entered debug on Halt anyway)

Driver V.2 dynamic startup failed - driver Init provided no flash parameters

Flash Driver V.2 startup failed - rc Ef(55): Dynamic flash driver startup failed to provide flash parameters.

Terminate (0x0, 0x0, 0x0) status 0x40 - driver reports init failure - EXTSPI driver rc 1 - Device is busy

chip initialization failed - Ef(55): Dynamic flash driver startup failed to provide flash parameters.

failed to initialize flash driver LPC540xx_SPIFI_SFDP.cfx

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

What is causing these errors?

 

 

0 Kudos

3,086 Views
ahmed_mostafa
Contributor II

Can anyone provide any help?

0 Kudos

3,070 Views
converse
Senior Contributor V

with almost 100% certainty, you have a problem on your circuit. Check the debug connection, power and termination of unused pins 

0 Kudos