Other Parts Discussed in Thread: SYSCONFIG
I am using MSPM0G3507 on a custom board and debugging it with a J-Link PLUS debugger.
Our board was designed by an idiot and among many other problems, BSL_Invoke pin is pulled-up by the surrounding circuity, resulting in the board starting in the bootloader instead of the main program.
I tried remedying this by moving the BSL_Invoke pin to PA2, which happens to have a pull-down on our board. I did this by first inspecting the memory in the NONMAIN flash section, copying the existing values and modifying only registers BSLCONFIG0 (0x41C0010C) and BSLCRC (0x41C00154). A new C source file was created:
#include <stdint.h> __attribute__((section(".BCRConfig"))) __attribute__((retain)) const uint32_t bcr_config[] = { 0x00000001, /* 0x41C00000 - BCRCONFIGID */ 0xAABBAABB, /* 0x41C00004 - BOOTCFG0 */ 0xAABBAABB, /* 0x41C00008 - BOOTCFG1 */ 0xFFFFFFFF, /* 0x41C0000C - PWDDEBUGLOCK[0] */ 0xFFFFFFFF, /* 0x41C00010 - PWDDEBUGLOCK[1] */ 0xFFFFFFFF, /* 0x41C00014 - PWDDEBUGLOCK[2] */ 0xFFFFFFFF, /* 0x41C00018 - PWDDEBUGLOCK[3] */ 0xAABBFFFF, /* 0x41C0001C - BOOTCFG2 */ 0xAABBAABB, /* 0x41C00020 - BOOTCFG3 */ 0xFFFFFFFF, /* 0x41C00024 - PWDMASSERASE[0] */ 0xFFFFFFFF, /* 0x41C00028 - PWDMASSERASE[1] */ 0xFFFFFFFF, /* 0x41C0002C - PWDMASSERASE[2] */ 0xFFFFFFFF, /* 0x41C00030 - PWDMASSERASE[3] */ 0xFFFFFFFF, /* 0x41C00034 - PWDFACTORYRESET[0] */ 0xFFFFFFFF, /* 0x41C00038 - PWDFACTORYRESET[1] */ 0xFFFFFFFF, /* 0x41C0003C - PWDFACTORYRESET[2] */ 0xFFFFFFFF, /* 0x41C00040 - PWDFACTORYRESET[3] */ 0xFFFFFFFF, /* 0x41C00044 - FLASHSWP0 */ 0xFFFFFFFF, /* 0x41C00048 - FLASHSWP1 */ 0xFFFFFFFF, /* 0x41C0004C - BOOTCFG4 */ 0xFFFFFFFF, /* 0x41C00050 - APPCRCSTART */ 0xFFFFFFFF, /* 0x41C00054 - APPCRCLENGTH */ 0xFFFFFFFF, /* 0x41C00058 - APPCRC */ 0x1879DAC3 /* 0x41C0005C - BOOTCRC */ }; __attribute__((section(".BSLConfig"))) __attribute__((retain)) const uint32_t bsl_config[] = { 0x00000001, /* 0x41C00100 - BSLCONFIGID */ 0x02150216, /* 0x41C00104 - BSLPINCFG0 */ 0x03020301, /* 0x41C00108 - BSLPINCFG1 */ 0xFFFF0287, /* 0x41C0010C - BSLCONFIG0 - PA2, HIGH, IOMUX7 */ 0xFFFFFFFF, /* 0x41C00110 - BSLPW[0] */ 0xFFFFFFFF, /* 0x41C00114 - BSLPW[1] */ 0xFFFFFFFF, /* 0x41C00118 - BSLPW[2] */ 0xFFFFFFFF, /* 0x41C0011C - BSLPW[3] */ 0xFFFFFFFF, /* 0x41C00120 - BSLPW[4] */ 0xFFFFFFFF, /* 0x41C00124 - BSLPW[5] */ 0xFFFFFFFF, /* 0x41C00128 - BSLPW[6] */ 0xFFFFFFFF, /* 0x41C0012C - BSLPW[7] */ 0xFFFFFFFF, /* 0x41C00130 - BSLPLUGINCFG */ 0xFFFFFFFF, /* 0x41C00134 - BSLPLUGINHOOK[0] */ 0xFFFFFFFF, /* 0x41C00138 - BSLPLUGINHOOK[1] */ 0xFFFFFFFF, /* 0x41C0013C - BSLPLUGINHOOK[2] */ 0xFFFFFFFF, /* 0x41C00140 - BSLPLUGINHOOK[3] */ 0xFFFFFFFF, /* 0x41C00144 - PATCHHOOKID */ 0xFFFFFFFF, /* 0x41C00148 - SBLADDRESS */ 0xFFFFFFFF, /* 0x41C0014C - BSLAPPVER */ 0x0048FFFF, /* 0x41C00150 - BSLCONFIG1 */ 0x561226C8 /* 0x41C00154 - BSLCRC */ };
After flashing, I tried power cycling the microcontroller several times and I could see it jumping straight into the main program.
I then excluded this C source file from build, so that I would not be rewriting the NONMAIN section on every start of a debugging session. I have successfully reprogrammed the MCU several times after this.
This is where it gets confusing. I had to work on something else and upon returning to it a couple of hours later, it would no longer allow me to connect to it.
When trying to connect to it within CCS, the following would be reported:
Error connecting to the target:
Could not connect to target.
I tried connecting to it through the J-Link Commander console. This is the output:
Connecting to target via SWD InitTarget() start DAP initialized successfully. No PWR-AP detected. InitTarget() end - Took 11.3ms Found SW-DP with ID 0x6BA02477 DPIDR: 0x6BA02477 CoreSight SoC-400 or earlier Scanning AP map to find all available APs AP[0]: Stopped AP scan as end of AP map seems to be reached Iterating through AP map to find AHB-AP to use Attach to CPU failed. Executing connect under reset. DPIDR: 0x6BA02477 CoreSight SoC-400 or earlier Scanning AP map to find all available APs AP[0]: Stopped AP scan as end of AP map has been reached Iterating through AP map to find AHB-AP to use Could not find core in Coresight setup InitTarget() start DAP initialized successfully. No PWR-AP detected. InitTarget() end - Took 11.3ms Found SW-DP with ID 0x6BA02477 DPIDR: 0x6BA02477 CoreSight SoC-400 or earlier Scanning AP map to find all available APs AP[0]: Stopped AP scan as end of AP map seems to be reached Iterating through AP map to find AHB-AP to use Attach to CPU failed. Executing connect under reset. DPIDR: 0x6BA02477 CoreSight SoC-400 or earlier Scanning AP map to find all available APs AP[0]: Stopped AP scan as end of AP map has been reached Iterating through AP map to find AHB-AP to use Could not find core in Coresight setup Cannot connect to target.
I found a similar thread on this forum which suggested running the MSPM0_Mailbox_FactoryReset_Auto() script, but as I don't have an XDS110, this is unfortunately not an option.
And ideas how I might be able to salvage this chip? I'm hoping to avoid having to transplant a new IC onto this board.