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.

LP-MSPM0G3519: Regarding Software Code Execution in Flash Area of LP-MSPM0G3519 Board

Part Number: LP-MSPM0G3519
Other Parts Discussed in Thread: MSPM0G3519

Tool/software:

Hello team,

we are using MCAL : MCAL_MSPM0_00.02.04.00 package

SDK : mspm0_sdk_2_04_00_06 version

we are facing issue in accessing flash area of the  LP-MSPM0G3519 Board. Our Software Code Execution is not Successful in Flash area.

So we wanted to if there is any precondition that we need to take care while accessing flash area.

We also referred the MCAL examples but our Autosar Os software execution fails in Flash area

Can you please let us know how much flash and SRAM we can use as part of LP-MSPM0G3519 Board. Also where we need to place the exception table or reset vector?

Thanking you.

Regards,

Pradeep R

  • Hi Pradeep,

    As for the Flash and SRAM mapping of MSPM0G3519, you could refer to the 8.8 Memory chapter in MSPM0G351x Mixed-Signal Microcontrollers With CAN-FD Interface datasheet (Rev. A). In summary, there is 128KB SRAM and 512KB available for MSPM0G3519.

    And for the interrupt vector table, it is defined in startup_ticlang.c file for MSPM0 MCAL examples (\mcal\examples\Adc\soc\MSPM0G351x\m0plus\startup_ticlang.c), if you are using a ticlang compiler. Just notice those peripheral interrupt handler vector has been used in the corresponding MCAL module source code.

    And for the issue you meet about program execution fail in flash, what kind of issue do you meet? The ECC error, or hard fault, or the flash data is not correct when downloading the program?

    Best Regards,

    Pengfei

  • Can you please let us know how much flash and SRAM we can use as part of LP-MSPM0G3519 Board. Also where we need to place the exception table or reset vector?

    In Arm cortex M0 core, interrupt vector table is placed at 0x0 address (start address in Flash of M0)

    Can you please let us know how much flash and SRAM we can use as part of LP-MSPM0G3519 Board. Also where we need to place the exception table or reset vector?
    As for the Flash and SRAM mapping of MSPM0G3519, you could refer to the 8.8 Memory chapter in MSPM0G351x Mixed-Signal Microcontrollers With CAN-FD Interface datasheet (Rev. A). In summary, there is 128KB SRAM and 512KB available for MSPM0G3519.
  • Hi Helic,

    Please find MOM for the debug session conducted on 06-08-2025.

    1. Any attempt to write on flash memory yeilds an "FLASH ERASE ERROR".

    During debug call together we checked to write our binary on internal flash. but could not succeed.
    Attempted flash earse manually from TRACE32 command -> Same observation as above.

    Please find attached error snippet from tarce32 and cmm script used by us to upload our binary.

    <CODE_CMM>

    ; -------------------------------------------------------------------------------------------
    ; @Title: Demo script for MSPM0GX51X on TI LaunchPad MSPM0 (FLASH)
    ; @Chip: MSPM0GX51X
    ; -------------------------------------------------------------------------------------------


    WinCLEAR

    entry &elffile
    if "&elffile"==""
    (
    &elffile="../../../output/bin/*.elf"
    )

    ; --------------------------------------------------------------------------------
    ; initialize and start the debugger
    RESet
    SYStem.CPU MSPM0G3519
    SYStem.CONFIG.DEBUGPORTTYPE SWD
    SYStem.Option DUALPORT ON
    SYStem.MemAccess DAP
    SYStem.Up

    data.set 0x20000000--0x2000FFFF %Word 0x0

    wait 5.s
    ; --------------------------------------------------------------------------------
    ; Flash programming

    ; prepare flash programming (declarations)
    DO ~~/demo/arm/flash/mspm0.cmm PREPAREONLY

    ; ReProgram Flash
    FLASH.ReProgram ALL
    Data.LOAD.Elf "&elffile"
    FLASH.ReProgram OFF

    ; --------------------------------------------------------------------------------
    ; Reset the target again
    SYStem.Up

    ; --------------------------------------------------------------------------------
    ; start program execution
    Register.Set PC boardResetStart
    ;WAIT !STATE.RUN()

    ENDDO

    </CODE_CMM>

    As discussed, please consult with your internal team and let us know possible solution ASAP as we are completely blocked by this issue.

    With Regards,

    Manjunath B

  • This is a example for factory reset steps, this will erase all Flash memory including nonmain(reset to default value)

    import pyocd
    from pyocd.core.helpers import ConnectHelper
    from time import sleep
    
    
    AHB_AP_ADDR = 0x0
    CGF_AP_ADDR = 0x1
    SEC_AP_ADDR = 0x2
    ET_AP_ADDR = 0x3
    PWR_AP_ADDR = 0x4
    
    DSSM_BC_FACTORY_RESET = 0x020A
    DSSM_BC_MASS_ERASE = 0x020C
    DSSM_BC_PW_AUTH = 0x030E
    DSSM_DATA_EXCHANGE = 0x00EE
    DSSM_WAIT_FOR_DEBUG = 0x0206
    
    DEBUGSS_SECAP_TCR_TRANSMIT_FULL_MASK = 0x00000001
    DEBUGSS_SECAP_TCR_TRANSMIT_EMPTY_MASK = 0x00000000
    DEBUGSS_SECAP_RCR_RECEIVE_FULL_MASK = 0x00000001
    DEBUGSS_SECAP_RCR_RECEIVE_EMPTY_MASK = 0x00000000
    SECAP_CTL_MASK = 0xFFFF
    SECAP_CMD_MASK = 0x00FE
    
    DSSM_CMD_RECEIVED = 0x0100
    DSSM_CMD_NOT_RECEIVED = 0x0101
    DSSM_ERROR_UNEXPECTED_COMMAND = 0x0102
    
    TXDATA_ADDR = 0x00
    TXCTL_ADDR = 0x04
    RXDATA_ADDR = 0x08
    RXCTL_ADDR = 0x0C
    RXCTL_DATA_AVAIL_MASK = 0x00000001 
    SEC_AP_ID_ADDR = 0xFC
    SEC_AP_ID_EXPECTED = 0x002E0000
    
    
    SYSCTL_RESETLVL_ADDRESS =   0x400B0300
    SYSCTL_RESETLVL_SYSRESET =  0x0
    SYSCTL_RESETLVL_BOOTRST =   0x1
    SYSCTL_RESETLVL_BSL_ENTRY = 0x2
    SYSCTL_RESETLVL_POR =       0x3
    SYSCTL_RESETLVL_BSL_EXIT =  0x4
    
    SYSCTL_RESETCMD_ADDRESS =   0x400B0304
    SYSCTL_RESETCMD_RESET =     0xE4000001
    
    def swdReset(debugPort,resetlevel:int):
        accessPort = debugPort.aps[AHB_AP_ADDR]
        accessPort.write_reg(SYSCTL_RESETLVL_ADDRESS, resetlevel)
        accessPort.write_reg(SYSCTL_RESETCMD_ADDRESS, SYSCTL_RESETCMD_RESET)
        
    def nReset(debugPort, msDelay:int):
        debugPort.assert_reset(True)
        sleep(msDelay/1000.0)
        debugPort.assert_reset(False)
        
        
    def issue_factory_reset():
        # Connect to the first available CMSIS-DAP probe
        session = ConnectHelper.session_with_chosen_probe(
            target_override="mspm0g3519",
            options={
                'auto_unlock': False,
                'frequency': 1000000  # 1 MHz clock
            }
        )
        
        if session is None:
            print("No CMSIS-DAP probe detected")
            return
        
        try:
            # Open the session
            #TODO: In flm_region_builder.py, remove workaround in _add_flash_subregions() once
            session.open()
            
            # Get the target
            target = session.target
            
            # Get the DP (Debug Port)
            dp = target.dp
            
            ap = dp.aps[SEC_AP_ADDR]
            
            if SEC_AP_ADDR < len(dp.aps):
                ap = dp.aps[SEC_AP_ADDR]
            
                # Read a register from this AP
                # This is just an example - replace with the actual register address
                address = SEC_AP_ID_ADDR  # Base address for the AP
                value = ap.read_reg(address)
                if value == SEC_AP_ID_EXPECTED:
                    print(f"AP[{SEC_AP_ADDR}] Register at 0x{address:02x}: 0x{value:08x}")
                    ap.write_reg(TXCTL_ADDR, DSSM_BC_FACTORY_RESET)
                    ap.write_reg(TXDATA_ADDR, 0)
                    
                    # Issue a device boot reset (nrst pulse  < 1s) to execute factory reset command
                    nReset(dp, 200)
                    
                    while (ap.read_reg(RXCTL_ADDR) & RXCTL_DATA_AVAIL_MASK) == 0:
                        pass
                    
                    #TODO: Add Password support
                    
                else:
                    print(f"Incorrect SEC_AP ID detected, no factory reset performed: AP[{address}] Register at 0x{address:02x}: 0x{value:08x}")
            else:
                print(f"AP[{SEC_AP_ADDR}] not available. Only {len(dp.aps)} APs detected.")
            
        finally:
            # Close the session
    
            session.close()
    if __name__ == "__main__":
        issue_factory_reset()
        
    
    

    Please try this to see whether we can erase Flash successfully.

  • As you said last meeting, there have already some 3rd tools supported by TI, which is compatible with your tools, and you show me that 3rd partner's name.

    Could you please show me again, I want to check internally to see whether we have some materials to support the same thing.

  • Hi Helic,

    Greeting of the day.

    please find my answer below

    As you said last meeting, there have already some 3rd tools supported by TI, which is compatible with your tools, and you show me that 3rd partner's name.
    --> I think we have some miscommuication here, as per our knowledge we didnt mention mention about any third party tool other than Trace32 debugger.
    --> We use only Trace32 debugger in our CI/CD environment, migrating complete devops for TI based CCS debugger is not possible.
    --> With Trace32 debugger we are able to program our code is possible, But we could not succeed in the same is on flash memory.
    --> We mentioned, we studied on internet that to enable flash and allow programming we need some "FIRMWARE", for this we need your input.

    Could you please show me again, I want to check internally to see whether we have some materials to support the same thing.
    --> We mentioned, We received one mail from your colleague , which pointing to www.ti.com/.../slaaeo5.pdf page which explains more about flash driver implementation.

  • --> With Trace32 debugger we are able to program our code is possible, But we could not succeed in the same is on flash memory.

    Error showed from your side is Flash erase error.

    So need to run a factory reset to erase all sector.

    --> I think we have some miscommuication here, as per our knowledge we didnt mention mention about any third party tool other than Trace32 debugger.

    Not the debugger maybe, but you showed me there has already some tools support these kind of function.

  • --> With Trace32 debugger we are able to program our code is possible, But we could not succeed in the same is on flash memory.
    Error showed from your side is Flash erase error.
    --> Yes we have "Flash erase error" while flasing through TRace32.

    So need to run a factory reset to erase all sector.
    --> could you please share more information on factory reset or any document how to to factory reset safely"

    Not the debugger maybe, but you showed me there has already some tools support these kind of function.
    --> Okay, but no other tool is used, than trace32.

  • --> could you please share more information on factory reset or any document how to to factory reset safely"

    python I shared is factory steps.

    --> Okay, but no other tool is used, than trace32.

    OK, fine, I remember that you show me some name, and said that this name tool also supported by TI, there should be some emm file support internally based on this name's tool.

  • OK, fine, I remember that you show me some name, and said that this name tool also supported by TI, there should be some emm file support internally based on this name's tool.
    --> TI is using Code composer studio.
    python I shared is factory steps.
    --> Shared python scrip as some ambiguious dereferencing
    eg . 1. debugPort.aps[AHB_AP_ADDR] line number 49 -> what is the base address of aps
    2. # Open the session line number 74 and 75
    #TODO: In flm_region_builder.py, remove workaround in _add_flash_subregions() once -> what flm_region_builder.py is meant for

    3. dp = target.dp line number 82 -> are you reading debug port type information here?

  • Let me check this internally.

  • Hi  ,

    Is it possible to include Trace32 relevant experts into today's call?

    Thanks,

    Senthil Kumar P R

  • Hi,

    for the tool chain expert, he doesn't have available for today's call.

    And we are trying to find some related cmm script file internally.

    Since we don't have debugger hardware from our side, is it possible that we provide the related materials or script to you and test further?

  • Hi  ,

    You please prepare the necessary materials and scripts and anyhow we have the debugger and H/W at our end so that we can try out during our today's call. It will be really good if some tool chain expert too join our today's call so that we can conclude it as we have a slated delivery to customer in the coming week where in we need to provide the software that can be programmed onto the FLASH.

    Thanks,

    Senthil Kumar P R

  • Materials may not be available at today's meeting.

    Tool chain expert is located in US and meeting time is not suitable for him.

    And he also need some time at least in tonight (Asia time) to get related materials.

    I will try monitor the progress carefully.

    Thanks for your patience.

  • Hi  ,

    Regarding your concern could you insert the command  FLASH.UNSECUREerase into your CMM script at the start of your device initialization? This should perform a factory reset sequence to clean out the device.

    I'm in discussion with Lauterbach in parallel to help investigate this issue.

    Thank you,

    Henry Nguyen

  •  Hi   ,

    Is the MSPM0G3519 device running at 80 MHz as well by the way. Is still issue still observed when the CPU runs at a lower frequency that is 32 MHz or less?

  • Hi Henry, 

    I attempted to erase and factory reset the flash using the command FLASH.UNSECUREerase. However, we are now facing a different issue — the device shows a “Debug port timeout at unknown” error, and we can no longer access it. We also tried reverting to SRAM programming, but encountered the same problem there as well. At this point, we are unable to flash either the FLASH or SRAM. Looks like we are blocked completely now.

    Thank you,

    Manjunath Bhavimani.

  • HI Manjunath,

    This is observed even after power cycling the board?

    After performing a factory reset it is typically recommended to power cycle.

    Thank you,

    Henry Nguyen

  • Register_dump.txt

    Hi Henry,

    We are running at 32MHZ. Please find the attached register dump file for your reference.

    Thank you,

    Manjunath Bhavimani

  • Hi Henry,

    Yes, We did power cycling after erase.

    Thank you

    Manjunath Bhavimani

  • Hi Manjunath,

    I have received a response from Lauterbach regarding the situation, could you provide detail as to what version of the tool are you using?

    On their side they were able to observe flash operation and factory reset execution without any issue which is leading me to think it might be related to version of the tooling itself.

    Thank you,

    Henry Nguyen

  • Hi Henry,

    We are using following version of T32 

    Nightly Build
    Software Version : N.2025.01.000176012
    Build : 176012.
    Compiled: Jan 17 2025 (04:36:02Z)

    Could you please let us know which version of T32 software is being used by Lauterbach and if possible, please share tested CMM with us, so that we don't break one more device.

    NOTE: We tried to connect our board after multiple power cycle, now we are not able to connect to our LP board due to earlier mentioned issue "Debug port timeout at unknown" on Thursday. Is there any way to recover this board back?

    With Regards,

    Manjunath Bhavimani

  • Hi Manjunath, I'm currently pending a response from the Lauterbach team but it is known to them this is urgent.

    Regarding recovering the board. It should have an xds110 on top, please utilize that to connect to ccs and utilize the factory reset sequence.

    https://dev.ti.com/tirex/explore/node?node=A__ANk2FOM4WUAtKZQLHOjtNw__MSPM0-SDK__a3PaaoK__LATEST

    Within this online document contains steps on how to perform the sequence on your device.

  • HI Manjunath,

    Please refer to this download provided by Lauterbach

    this is your requested TRACE32 software update.
     
     
    I m p o r t a n t :
    - This TRACE32 software version requires a license key (with a software maintenance contract) that covers 08/2025.
    - Please check this with the TRACE32 commands LICENSE.List or LICENSE.state.
    - For detailed licensing and installation information see the readme.txt included in this update.
    - This is an update and not a full installation.
     
    This update is available for 10 days and can be downloaded here:
    https://www.lauterbach.com/support/trace32_n_2025_08_000182980_arm_full_20250818153210.zip
    The password is: vy9QMpce2sSf
     
     
    Installation instructions:
    1. Close all TRACE32 instances
    2. Backup your existing TRACE32 installation
    3. Unpack the update archive into the TRACE32 installation directory (e.g. C:\T32) overwriting the existing files
    4. Start TRACE32 as usual
    For more details see https://www.lauterbach.com/pdf/updates.pdf
     
    Let me know once you have downloaded it so I can delete this specific message.
     
    Note:
    Interim software builds should be replaced by the next official software release.
    Release builds are produced twice a year after the TRACE32 software has gone through an intensive test phase.
    The release builds covers normally all changes from interim builds which were done before the release branch.
  • Hi Henry,

    Thank you for sharing patch of Lauterbach. 

    We tried with latest Trace32 patch, now we are able to flash our elf on flash memory and run the code successfully.

    However, after first flashing, when we tried to flash new elf, we are facing below error. The new elf can be flashed only after running command FLASH.Erase ALL manually in using trace32 GUI. If we try same command through CMM script, the erase and loading of elf fails as shown below.

    Similar behavior is observed in CCS too. Our CI/CD automation demands, flashing from CMM script. without manual intervention. Please suggest if this can be achieved through CMM script

    With Regards,

    Manjunath Bhavimani 

  • Hi Manjunath,

    Sorry for the late response, I have contacted them regarding this topic. Will update you asap once response is received.

    Thank you,

    Henry Nguyen