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.

MSPM0G3519: Software debug port configuration issue

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

Hi ,

i am checking security level testing with mspm0g3519 controller. i have one question why factory reset is not working when SW-DP disabled from BCR configuration.

TRM mentioned factory reset,mass erase are DSSM command and DSSM command dosent require to access physical debug port. 

I tried to factory reset the boards using UNIFLASH tool as well ass factory reset script that uses DSSM commands,but result is same.   

9697f16a-d4be-4aca-bff9-944bf332dd21.png

image.png

  • Hi,

    DSSM command is sent through SEC-AP port. And if you disable the DP port, then GUI can not send command to MCU through SWD.

  • Thanks Zoey, its good insight but this is not what exactly i am looking for. i tried device’s SWD Security Level 1 configuration, and the TRM states that in this mode the SW‑DP remains enabled while individual debug‑related functions (application debug, mass erase, factory reset, TI FA) can be independently enabled or disabled.

    According to Section 2.6.1.1.2 – SWD Security Level 1, my understanding is that:

    I should be able to disable application debug access (.debugAccess = 0)
    while still keeping factory reset enabled
    as long as the SW‑DP interface is enabled (.swdpMode = 1)
    This interpretation suggests that factory reset should work even when application debug is disabled.

    However, in actual testing, factory reset only works when both:

    .swdpMode and.debugAccess are enabled.
    If .debugAccess is disabled, the factory reset command fails, even though the TRM implies that these functionalities can be controlled independently.

    Why does factory reset require .debugAccess to be enabled, despite the TRM indicating that these features can be independently controlled at SWD Security Level 1?

  • Hi Zoey,

    I'm a colleague of Mehul.
    When can we expect a response?
    This is somewhat urgent.

    Ciao,
    Chris.

  • Hi,

    I am ooo currently. Will be back to look into this later

  • And when is "later"?

  • Hi Zoey, did you find time to look into questions I have posted above? We require clarification on these doubts and questions at the earliest as they are critical for our next steps.

  • Hi,

    I am just back to office after my personal leave. 

    I have tested from my side. That, if only disable the debugAccess port with swdpMode enabled, then I can still do the factory reset. Could you share me with your configuration in sysconfig? 

  • Hi Zoey,

    const BCR_Config BCRConfig =
    {
        .bcrConfigID          = 0x4000000,
        .debugAccess          = BCR_CFG_DEBUG_ACCESS_DIS,
        .swdpMode             = BCR_CFG_SWDP_EN,
        .tifaMode             = BCR_CFG_TIFA_DIS,
        .bslPinInvokeEnable   = BCR_CFG_BSL_PIN_INVOKE_EN,
        .staticWriteProtectionMainLow  = 0x6,
        .staticWriteProtectionMainHigh = 0xfffff80f,
        .staticWriteProtectionNonMain  = BCR_CFG_NON_MAIN_STATIC_PROT_EN,
        .debugHold            = BCR_CFG_DEBUG_HOLD_DIS,
        .CSCexist             = BCR_CFG_CSC_EXIST,
        .flashBankSwapPolicy  = BCR_CFG_FLASH_BS_EN,
        .fastBootMode         = BCR_CFG_FAST_BOOT_DIS,
        .bootloaderMode       = BCR_CFG_BOOTLOADER_MODE_DIS,
        .massEraseMode        = BCR_CFG_MASS_ERASE_EN,
        .factoryResetMode     = BCR_CFG_FACTORY_RESET_EN,
        .passwordMassErase    = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .passwordFactoryReset = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .passwordDebugLock    = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .bc_reserved_0                 = 0xFFFFU,
        .secureBootMode                = BCR_CFG_SECURE_BOOT_DIS,
        .userSecureAppStartAddr        = CFG_DEFAULT_VALUE,
        .userSecureAppLength           = CFG_DEFAULT_VALUE,
        .userSecureAppHash = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .staticWriteProtectionMainHigh_2 = 0xfffff800,
        .userCfgCRC                    = 0xf911b056,
    };
  • Hi Mehul,

    As Zoey said, when only disable the debugAccess port with swdpMode enabled, the factory reset function could still work.

    I try to make the complete same configuration with you, and I find I have a different "userCfgCRC" value with you attached. Notice that this CRC value should be calculated according to NONMAIN content and will be checked during boot process. So if any changes made for NONMAIN configuration, the CRC value should also be updated accordingly. And I strongly recommend to use sysconfig to configure NONMAIN if you want to make any changes on it. 

    For your current project, I think by changing the .userCfgCRC as 0xC6FB7DF could solve your problem.

    - NONMAIN CRC when debugAccess enabled:

    - NONMAIN CRC when debugAccess disabled:

    Best Regards,

    Pengfei

  • Hi Xie. Will it be possible to share generated .c file? I believe CRC is dependent on all other BCR parameter as well. I just want to see those setting to get that CRC value. 

  • Here you are.

    /*
     * Copyright (c) 2023, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ============ boot_config.c =============
     *  Configured MSPM0 NONMAIN options
     *
     *  DO NOT EDIT - This file is generated by the SysConfig tool.
     */
    
    #include "boot_config.h"
    #include "ti_msp_dl_config.h"
    
    /* Bootcode configuration */
    
    PLACE_IN_MEMORY(".BCRConfig")
    const BCR_Config BCRConfig =
    {
        .bcrConfigID          = 0x4000000,
        .debugAccess          = BCR_CFG_DEBUG_ACCESS_DIS,
        .swdpMode             = BCR_CFG_SWDP_EN,
        .tifaMode             = BCR_CFG_TIFA_DIS,
        .bslPinInvokeEnable   = BCR_CFG_BSL_PIN_INVOKE_EN,
        .staticWriteProtectionMainLow  = CFG_DEFAULT_VALUE,
        .staticWriteProtectionMainHigh = CFG_DEFAULT_VALUE,
        .staticWriteProtectionNonMain  = BCR_CFG_NON_MAIN_STATIC_PROT_DIS,
        .debugHold            = BCR_CFG_DEBUG_HOLD_DIS,
        .CSCexist             = BCR_CFG_CSC_NOT_EXIST,
        .flashBankSwapPolicy  = BCR_CFG_FLASH_BS_DIS,
        .fastBootMode         = BCR_CFG_FAST_BOOT_DIS,
        .bootloaderMode       = BCR_CFG_BOOTLOADER_MODE_EN,
        .massEraseMode        = BCR_CFG_MASS_ERASE_EN,
        .factoryResetMode     = BCR_CFG_FACTORY_RESET_EN,
        .passwordMassErase    = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .passwordFactoryReset = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .passwordDebugLock    = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .bc_reserved_0                 = 0xFFFFU,
        .secureBootMode                = BCR_CFG_SECURE_BOOT_DIS,
        .userSecureAppStartAddr        = CFG_DEFAULT_VALUE,
        .userSecureAppLength           = CFG_DEFAULT_VALUE,
        .userSecureAppHash = {CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE,
            CFG_DEFAULT_VALUE, CFG_DEFAULT_VALUE},
        .staticWriteProtectionMainHigh_2 = CFG_DEFAULT_VALUE,
        .userCfgCRC                    = 0xe52fbae2,
    };
    
    
    /* Bootloader configuration */
    
    PLACE_IN_MEMORY(".BSLConfig")
    const BSL_Config BSLConfig =
    {
        .configID                          = 0x4000000,
        .interfacePins.UART_RXD_pad_num    = DEF_UART_RXD_PAD,
        .interfacePins.UART_RXD_PF_mux_sel = DEF_UART_RXD_MUX,
        .interfacePins.UART_TXD_pad_num    = DEF_UART_TXD_PAD,
        .interfacePins.UART_TXD_PF_mux_sel = DEF_UART_TXD_MUX,
        .interfacePins.I2C_SDA_pad_num     = DEF_I2C_SDA_PAD,
        .interfacePins.I2C_SDA_PF_mux_sel  = DEF_I2C_SDA_MUX,
        .interfacePins.I2C_SCL_pad_num     = DEF_I2C_SCL_PAD,
        .interfacePins.I2C_SCL_PF_mux_sel  = DEF_I2C_SCL_MUX,
        .pin.pinData0                      = DEFAULT_BSL_PIN_INVOCATION_DATA0,
        .pin.pinData1                      = DEFAULT_BSL_PIN_INVOCATION_DATA1,
        .memoryRead         = BSL_CFG_MEMORY_READOUT_DISABLE,
        .password           = {0x761396af, 0x5f63720f,
            0x5a4ab4bd, 0x9fc3630a, 0xf930af12,
            0x5ceea650, 0x88e11b97, 0x51409ce8},
        .pluginType         = BSL_CFG_PLUGIN_TYPE_ANY,
        .flashPluginEnable  = BSL_CFG_PLUGIN_FLASH_NOT_EXIST,
        .pluginSramSize     = 0xff,
        .pluginHook[0]      = CFG_DEFAULT_VALUE,
        .pluginHook[1]      = CFG_DEFAULT_VALUE,
        .pluginHook[2]      = CFG_DEFAULT_VALUE,
        .pluginHook[3]      = CFG_DEFAULT_VALUE,
        .uartBaudRate       = DEF_UART_BAUD_RATE,
        .BSLAlternateConfig = BSL_CFG_FLASH_BSL_NOT_EXIST,
        .BSLAlternateAddr   = CFG_DEFAULT_VALUE,
        .appRev             = (uint32_t *) CFG_DEFAULT_VALUE,
        .securityAlert      = BSL_CFG_SECURITY_IGNORE,
        .i2cSlaveAddress    = 0x48,
        .userCfgCRC         = 0x1f158c95,
    };
    
    /* Added for secondary_bsl to build */
    /* 'main' function will never get called */
    #if defined(__ti_version__) || defined(__TI_COMPILER_VERSION__)
    __attribute__((weak)) int main(void)
    {
        return (0);
    }
    #elif defined(__IAR_SYSTEMS_ICC__)
    __weak int main(void);
    #elif (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined(__GNUC__)
    __attribute__((weak)) int main(void);
    #else
    #error "Non-Main table currently not supported for this compiler"
    #endif
    

  • Thanks, Zoey & Xie. I noticed in the shared .c file that static write protection has not been configured. As I understand it, if factory reset is enabled and SWDP is enabled, I should still be able to perform a factory reset on the board regardless of whether debug access is enabled or disabled. Correct?
    Also, I am using SysConfig to generate this configuration file.
  • Hi,

    In the file I shared, I have not configured the static write protection with all is 0xFFFFFFFF. But to answer your question -- Yes, you can do factory reset with SWDP enabled and debug access disabled.

  • Hi Zoey  & Xie ,Now I  understood the issue, .userCfgCRC  was incorrect and that's why configuration was not working as expected. Tested sysconfig generated config and its working as expected.  

**Attention** This is a public forum