LPC546XX: SWD Locked?

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

LPC546XX: SWD Locked?

12,521 Views
giusloq
Contributor III

I have a custom board with LPC546XX that was working well with a J-Link debug probe over SWD.

Now it doesn't work anymore, JLink says it wasn't able to connect to the device.

I tried to power up the device with ISP0 connected to GND and it enters correctly into ISP mode over UART. Indeed I can sends commands over UART and the device replies correctly.

Even if I let the my application run (leaving ISP0 floating at startup), the MCU seems working well, but JLink isn't able to connect.

Any ideas?

Labels (1)
0 Kudos
Reply
29 Replies

1,634 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Do you use blhost program image, or other programmer? 

Maybe write the OTP part by mistake ?

 

BR

Alice

0 Kudos
Reply

1,576 Views
giusloq
Contributor III

Do you use blhost program image, or other programmer? 

I never used blhost application, sincerely I don't know what is it. As programmer I use JLink.

Maybe write the OTP part by mistake ?

How that is possible? I never tried to access OTP memory. I'm worried because if it happened one time in the past, it could happen again in the future.

 

0 Kudos
Reply

1,518 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

After confirm with design team with internal, they said 

Normally only OTP API can be used.

0 Kudos
Reply

1,477 Views
giusloq
Contributor III

Again on another board with a different MCU from the same family: LPC54606J512BD100!!!

I was developing a firmware on a custom board that mounts one LPC54606J512BD100. After some weeks working on it, now the probe (Segger J-Link) isn't able to detect the MCU. It seems SWD pins are locked.

The MCU seems ok, the last programmed firmware starts and the Boot ROM runs if I keep some ISP pins low at reset.

Two different LPC546xx MCUs (LPC54606J512BD100 and LPC54616J512BD208) on different custom boards. It can't be just a case, there's something that brings these MCUs to be a nice brick.

 

 

0 Kudos
Reply

1,429 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

Do you have any demo board about lpc546xx, for example lpcxpresso54628 or lpcxpresso54608, 

how about run your project on demo board?

 

 

BR

Alice

0 Kudos
Reply

1,426 Views
giusloq
Contributor III

Do you have any demo board about lpc546xx, for example lpcxpresso54628 or lpcxpresso54608, 

how about run your project on demo board?

Yes, I have LPCXpresso54628 EVB and I tested some code on it without problems.

However I don't think this issue is related to the application code in Flash. The effect is that debug probe (J-Link) isn't able to connect to the MCU through SWD pins and SWD mode is enabled by default on related pins.

I know the application code could disable SWD mode on the pins, but I tested this entering Bootloader in ROM (UART) pulling down ISP pins at reset.
ROM Bootloder doesn't disable SWD function, but my J-Link can't connect to these two MCUs even when ROM Bootloader started.

I think of two things:

  • OTP memory was written by error and now SWD functions is disabled. However I don't have any code and I never tried to access OTP memory. Could the OTP memory be written by other means on a custom board?
  • SWD pins are broken, for example for ESD. On my custom boards I don't have any ESD protection. However I have other boards based on LPC17xx without ESD protections on SWD pins and I neved had these kind of problems.

Another thing. I noticed that VBAT pin was left floating on my custom board. Now I fixed the problem connecting it to VDD, but the problem is still there. Could it be the cause of SWD lock?

 

0 Kudos
Reply

1,418 Views
giusloq
Contributor III

I made some other tests.

I downloaded FlashMagic and I can write new firmware through UART entering ROM Bootloader by ISP pins. The application that I download works well.

I created an application that re-configures SWD pins as GPIO and toggles them every 1 second: it works. So it seems SWD pins aren't broken.

Starting from SDK example, I created an application that reads OTP memory content, specifically Bank 3 Word 0 that should be the word used for ECRP. Here it is the code I used:

    ret = OTP_Init();
    if (ret == kStatus_Success) {
        PRINTF("OTP_Init() success\r\n");

        if (OTP_EnableBankReadLock(3, kOTP_Word0, 0, kOTP_LockDontLock) != kStatus_Success) {
        	PRINTF("OTP_EnableBankReadLock() error\r\n");
        }

    	uint32_t ecrp = OTPC->ECRP;
    	uint32_t user0 = OTPC->USER0;
    	uint32_t user1 = OTPC->USER1;
        PRINTF("ECRP: 0x%x\r\n\r\n", ecrp);
        PRINTF("USER0: 0x%x\r\n\r\n", user0);
        PRINTF("USER1: 0x%x\r\n\r\n", user1);
    } else {
        PRINTF("OTP_Init() error: %d\r\n\r\n", ret);
    }

This is what I receive from UART:

OTP ROM API driver version: 0x101
OTP_Init() success
ECRP: 0x80000001
USER0: 0x0
USER1: 0x0

I tried on a working LPCXpresso54628 EVB and I receive exactly the same info.

Except from a couple of reserved bits (the least and the most significant bits), all other bits are zero, so SWD should be enabled.

So, if OTP doesn't restrict SWD access and SWD pins work well when configured as GPIO, the question remains: why J-Link can't connect to the MCU?

Note that the same J-Link and cable works great with the EVB.

0 Kudos
Reply

1,398 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

If the same image can work well on EVK board, while there is issue with custom board, I think 

maybe it is the hardware board issue, please refer to SCH of EVK board to check.

Also check your SWD design refer to:

https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Design-Considerations-for-Debug/m-p/469565 

 

BR

Alice

0 Kudos
Reply

1,369 Views
giusloq
Contributor III

If the same image can work well on EVK board, while there is issue with custom board, I think maybe it is the hardware board issue, please refer to SCH of EVK board to check.

My schematic is very similar to the one of EVB. Moreover, initially the board worked well and I was able to program and debug through SWD and J-Link. This means there aren't critical issues with my custom board.

The problem arised during development after some days. I don't know what happened, the last solution is that SWD port broke for some reason (ESD?), but only for the SWD functionality, because SWD pins work well when configured as GPIO.

Is this possible? The strange thing is that this happened two times for two completely different custom boards and two different MCUs from LPC546XX series.

Also check your SWD design refer to:

https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Design-Considerations-for-Debug/m-p/469565 

 I checked it many times, there's no problem with that.

Here it is my schematic related to SWD.

nxp1.pngnxp2.pngnxp3.png

0 Kudos
Reply