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.