MSPM0G3519: Factory reset using command line.

Part Number: MSPM0G3519
Other Parts Discussed in Thread: UNIFLASH,

Hi guys, 

I am utilizing standalone command line functionality of uniflash to generate pkg of executables. I have seen that if i use/configure nonmain region in code and program that code. next time without doing factory reset i am not able to program a device. 

Why do i need to do factory reset in this case?

Second thing if it is mendatory to do factory reset then what command sequence is use to do that? Is there any other way todo factory reset other that UNIFLASH?

  • Hi Mehul,

    A factory reset should only be required to override static write protections set in place if the application is attempting to overwrite the protected main and/or nonmain sectors. What configuration changes are you making to Non-Main?

    Also, what erase method are you choosing? In my testing, I successfully reconfigured non-main without a factory reset when using the following option:

    You can send DSSM commands over SWD to factory reset the device. Section 4 of the Hardware Programming and Debugger Guide for MSPM0 goes over DSSM commands.

    Best Regards,
    Brian

  • Ok but I am writing a script and, in that script, I want to do factory reset first before flashing new code. How can I do that?

    I have done some BCR config changes in nonmain like SWP, disable bsl invoke pin etc.

    Same erase method I am using as you shown in picture.

  • Ok but I am writing a script and, in that script, I want to do factory reset first before flashing new code. How can I do that?

    I have done some BCR config changes in nonmain like SWP, disable bsl invoke pin etc.

    Same erase method I am using as you shown in picture.

  • Hi Mehul,

    The following script can be run from within the same directory as the dslite script and performs a factory reset on the connected MSPM0G3519:

    @echo off
    setlocal
    
    REM =========================================================================
    REM Factory Reset Script for MSPM0G3519
    REM =========================================================================
    REM This script performs a factory reset on the MSPM0G3519 device using
    REM TI UniFlash DSLite command line tool.
    REM =========================================================================
    
    echo =========================================================================
    echo MSPM0G3519 Factory Reset Script
    echo =========================================================================
    echo.
    echo This script will perform a factory reset on your MSPM0G3519 device.
    echo.
    echo WARNING: This will erase all flash memory and restore factory settings!
    echo          All application code and data will be permanently lost!
    echo.
    echo Press Ctrl+C to cancel, or
    pause
    
    REM Path to this batch script
    set SCRIPT_PATH=%~dp0
    
    REM Path to DSLite executable
    set DSLITE_EXE=%SCRIPT_PATH%ccs_base\DebugServer\bin\DSLite.exe
    
    REM Path to configuration file
    set CCXML_CONFIG=%SCRIPT_PATH%user_files\configs\MSPM0G3519.ccxml
    
    REM Check if DSLite executable exists
    if not exist "%DSLITE_EXE%" (
        echo ERROR: DSLite executable not found at:
        echo %DSLITE_EXE%
        echo.
        echo Please ensure UniFlash is properly installed.
        pause
        exit /b 1
    )
    
    REM Check if configuration file exists
    if not exist "%CCXML_CONFIG%" (
        echo ERROR: Configuration file not found at:
        echo %CCXML_CONFIG%
        echo.
        echo Please ensure the MSPM0G3519.ccxml file exists.
        pause
        exit /b 1
    )
    
    echo.
    echo Step 1: Connecting to device...
    echo.
    
    REM Perform Automatic Factory Reset
    echo Executing Automatic Factory Reset...
    echo Command: "%DSLITE_EXE%" flash --config="%CCXML_CONFIG%" --post-flash-device-cmd=AutomaticFactoryReset -e
    echo.
    
    "%DSLITE_EXE%" flash --config="%CCXML_CONFIG%" --post-flash-device-cmd=AutomaticFactoryReset -e
    
    echo.
    echo =========================================================================
    echo Factory Reset Completed Successfully!
    echo =========================================================================
    echo.
    echo The MSPM0G3519 device has been reset to factory defaults.
    echo All flash memory has been erased.
    echo.
    pause
    exit /b 0
    

    Best Regards,
    Brian