This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hi,
We have been using a MSPM0L1305 on a product for a couple of years, and have now added the locking of the unit through the Non-Main region. In development we are using the XDS110 to make a mass erase/factory reset of the device to be able to program it again.
In production we are using a Segger JLink which does not seem to have the functionality to do the unlocking. We can see that it should be possible to use the DSSM commands through SWD, but we can not find any documentation on this.
Is it possible to get some documentation on how to use the DSSM commands to factory reset a device without a XDS110? Or is there something else that can be done?
Best regards
Mohammad
Hi Mohamad,
Please refer to this JLinkScript to perform a reset via Segger's toolchain.
Thank you,
Henry Nguyen
Hi Henry,
Thank you for the reply. I have tried a little bit of everything but it does not seems to work. I have tried to add some "JLINK_SYS_Report1" to try and debug and it is running the script as the first thing, but we are not receiving the "Command successfully sent".
I can see that "secap_rxctl_read", "secap_rxctl_read & secap_ctl_mask" and "secap_rxctl_read & secap_txctl_transmit_full_mask" are all "0x0".
Is there something I am missing, or is there some other information that I could use to debug further?
Here is what it says:
C:\Users>"C:\Program Files\SEGGER\JLink_V798i\JLink.exe" -JlinkScriptFile "C:\CCM_Resources\Resources\Firmware\Scripts\Factory_reset.JLinkScript"
SEGGER J-Link Commander V7.98i (Compiled Sep 18 2024 15:51:27)
DLL version V7.98i, compiled Sep 18 2024 15:50:31
Connecting to J-Link via USB...O.K.
Firmware: J-Link V12 compiled Aug 22 2024 13:27:55
Hardware version: V12.00
J-Link uptime (since boot): 0d 01h 27m 36s
S/N: 822006762
License(s): GDB
USB speed mode: High speed (480 MBit/s)
VTref=3.283V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: MSPM0L1305
Type '?' for selection dialog
Device>
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>swd
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "MSPM0L1305" selected.
Connecting to target via SWD
InitTarget() start
Beginning sequence
InitTarget() end - Took 201ms
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 has been 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
Beginning sequence
InitTarget() end - Took 204ms
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 has been 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
Error occurred: Could not connect to the target device.
For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
J-Link>
Best regards
Mohammad
Hello Mohammad,
Just to be sure do you have the nRST line connected? If you do then could you probe the nRST line to ensure it is toggling properly?
To execute a DSSM command it is a requirement that the device performs an nRST toggle so the BOOTCODE can run again.
Thank you,
Henry Nguyen
Hi Henry,
They have moved the setup, but I will go there tomorrow with a scope and make sure nRST goes low correctly.
I have been erasing/programming this unit many times, also just before I tried the new firmware with the locking enabled. The nRST should be wired correctly but there could always be something. I can still program PCBs that has not been locked (it is in a fixture).
It looks like this with a unlocked unit:
C:\Users>"C:\Program Files\SEGGER\JLink_V798i\JLink.exe" -JlinkScriptFile "C:\CCM_Resources\Resources\Firmware\Scripts\Factory_reset.JLinkScript"
SEGGER J-Link Commander V7.98i (Compiled Sep 18 2024 15:51:27)
DLL version V7.98i, compiled Sep 18 2024 15:50:31
Connecting to J-Link via USB...O.K.
Firmware: J-Link V12 compiled Aug 22 2024 13:27:55
Hardware version: V12.00
J-Link uptime (since boot): 0d 00h 48m 22s
S/N: 822006762
License(s): GDB
USB speed mode: High speed (480 MBit/s)
VTref=3.294V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: MSPM0L1305
Type '?' for selection dialog
Device>
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>s
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "MSPM0L1305" selected.
Connecting to target via SWD
InitTarget() start
Beginning sequence
Command successfully sent
InitTarget() end - Took 207ms
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
Beginning sequence
Command successfully sent
InitTarget() end - Took 202ms
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[5]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001, ADDR: 0x00000000)
AP[1]: MEM-AP (IDR: 0x002E0001, ADDR: 0x01000000)
AP[2]: JTAG-AP (IDR: 0x002E0000, ADDR: 0x02000000)
AP[3]: MEM-AP (IDR: 0x002E0003, ADDR: 0x03000000)
AP[4]: MEM-AP (IDR: 0x002E0002, ADDR: 0x04000000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xF0000000
CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
Found Cortex-M0 r0p1, Little endian.
FPUnit: 4 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ F0000000
[0][0]: E00FF000 CID B105100D PID 000BB4C0 ROM Table
ROMTbl[1] @ E00FF000
[1][0]: E000E000 CID B105E00D PID 000BB008 SCS
[1][1]: E0001000 CID B105E00D PID 000BB00A DWT
[1][2]: E0002000 CID B105E00D PID 000BB00B FPB
Memory zones:
Zone: "Default" Description: Default access mode
Cortex-M0 identified.
J-Link>
Best regards
Mohammad
Thanks for letting me know Mohammad, I have another quick question. When you say locked do you mean you modified NONMAIN to lock the device?
If that is the case could you let me know what modifications did you do exactly to lock the device?
Hi Henry,
Yes it is locked through the NONMAIN region. I have forwarded the question to the software department, but I am not sure if they will answer today or tomorrow. They have made the modifications to NONMAIN and tested that it could be unlcoked with the XDS110. I only have the hex files of the unlocked and locked firmware.
Best regards
Mohammad
Hi Henry,
Here the answer from our software department. I can see that there is a function to put in a password. Would this also be needed when making a complete factory reset? I will have a look at NRST signal in a bit.
It is our understanding that the device is considered to be in security level 1 with custom restrictions. Close to the descriptions mentioned in the reference manual.
SW-DP Policy -> Enabled
App Debug -> Enabled with Password
Mass Erase -> Enabled
Factory Reset -> Enabled
TI FA -> Enabled
Hi Henry,
I have a scope on now and it goes down to 0V when trying to communicate. I can see that the time it is low corresponds to the timeouts in the script. If I change the delays, the time it is low also changes correspondingly. Reset signal.png
Best regards
Mohammad
Hey Mohamad,
Could you refer to these updated scripts. Modified it to attempt it a couple more times if the first attempt fails.DSSM_Command.JLinkScriptDSSM_Command_Pass.JLinkScript
Hi Henry,
First of all, thank you. It worked with "_DAP_FACTORY_RESET" instead of "_DAP_MASS_ERASE", and after 2 to 3 tries. We can look into way it still needs 2 to 3 tries. We use "DSSM_Command.JLink" because we have not setup a lock, and it should not be necessary when doing a factory reset according to our SW department.
Here are some points of what we have tried:
1) All 3 units that I have been working with before the new script, do not work with the new script, and seem "dead". The application is not starting up, so it has somehow been deleted, but the new script does not work either.
- The last couple of days I have tried different things in "Factory_Reset.JLinkScript". I tried to change to "_DAP_FACTORY_RESET", and I did try to add 1 retry, but at that time it might be that they were already dead.
- "Factory_Reset.JLinkScript" also works on new units if I change it to "_DAP_FACTORY_RESET" and try 2 times.
2) Today I have tried with 3 new unit. I have tried to factory resseting them and locking them several times and it could always unlock them. Sometimes it needs 2 tries and sometimes 3 tries.
Thank you for spending your time on this.
Best regards
Mohammad