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-MSPM0G3507: Software BSL Invoke is not working

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: UNIFLASH, MSPM0G3507

I'm trying to do a BSL entry through software (I have a UART application that communicates with the BSL), what I have currently is a very simple program that lights up the blue LED on the launchpad and waits for a bit of time before trying to invoke a software BSL entry:

#include "ti_msp_dl_config.h"

int main(void)
{
    SYSCFG_DL_init();
    DL_GPIO_setPins(LED_GROUP_PORT, LED_GROUP_BLUE_LED_PIN);

    delay_cycles(50000000);
    DL_SYSCTL_resetDevice(DL_SYSCTL_RESET_BOOTLOADER_ENTRY);

    while (1) {

    }
}


However, the BSL doesn't seem to be invoked and my program will run again (which of course will turn on the blue LED, wait for some time, then try to invoke BSL again and fails, hence it will be stuck in an infinite loop). What I'm currently expecting is that the LED should be off and BSL is invoked so that I can use my application to communicate with the BSL. As of now I was invoking the BSL using GPIO manually, which is not a good option for my development. Any idea what could be wrong here?

Please not that my application is not currently running as of testing the software BSL invoke, so my application is not mistakenly sending a START USER APP command.

Thank you for help.

  • Thank you. We have recreated this problem on our side. It seems it is related to some peripheral init. After the problem is clear, I will put the root cause on this post. 

    I am not sure if you can accept use some method to work around? (Use hardware invoke or use a flash bootloader instead.)

  • Issue summary:

    When trigger the bootloader by software in application code and the application code using the un-checked ECC SRAM(0x2020000 ~0x20208000), the bootloader trigger will be failed and the device will go back to application code.

    Workaround:

    Modify the un-checked SRAM length to 0x00007E00(default 0x00008000) in linker file can avoid this issue.

    This problem will be putted into Errata later.

  • Thanks for your reply, this indeed allows me to go into BSL mode through software, however, when I attempt to send a BSL Connection command (and other commands) to the BSL I get no response from the BSL. Once I do a hardware reset (by holding NRST and PA18 buttons on the LP) it starts accepting commands, which doesn't help in my case.

    Can you please verify if this issue also occurs on your side? It could be my program too but it is hard to tell from which side the issue resides.

    Thanks.

  • Is there any update on this?

  • You can try this invoke function


    #define SRAM_NO_ECC_START_ADDR (0x20200000)
    #define SRAM_NO_ECC_END_ADDR (0x20208000)

    #define SRAM_ECC_CODE_START_ADDR (0x20300000)
    #define SRAM_ECC_CODE_END_ADDR (0x20308000)

    void invokeBSL(void)
    {
    /* Clear SRAM */
    __disable_irq();
    uint32_t *addr = (uint32_t*) SRAM_ECC_CODE_START_ADDR;
    for(; addr < (uint32_t*)SRAM_ECC_CODE_END_ADDR; addr++)
    {
    *addr = 0U;
    }

    addr = (uint32_t*) SRAM_NO_ECC_START_ADDR;
    for(; addr < (uint32_t*)SRAM_NO_ECC_END_ADDR; addr++)
    {
    *addr = 0U;
    }
    SYSCTL->SOCLOCK.RESETLEVEL = DL_SYSCTL_RESET_BOOTLOADER_ENTRY;
    SYSCTL->SOCLOCK.RESETCMD =
    SYSCTL_RESETCMD_KEY_VALUE | SYSCTL_RESETCMD_GO_TRUE;
    }

  • I still get the same behaviour, once I start sending commands through UART after Software BSL Invoke I don't get any replies from the LP

  • You can try this project that I have verified. If it is not work on your side, it should be some hardware issue or software issue on host side.

    bsl_software_invoke_LP_MSPM0G3507_nortos_ticlang.zip

  • Hello Gary,

    I tried using your project with UniFlash by selecting the MSPM0G3507(Bootloader) programming option, I get "[ERROR_MESSAGE]Failed to receive expected data!" after attempting to load a program after invoking BSL

    Can you verify if it works with UniFlash?

    Thanks.

  • It is a CCS project, you need to open it with CCS and build it and download it by CCS

  • Hello Gary,

    Yes I have done these steps before, there seems to be a misunderstanding, so let me clarify what I did:
    1- I have flashed the project provided above to the LP-MSPM03507 using Code Composer Studio

    2- I have ran the project and pressed the S2 button on the right to invoke BSL

    3- The green LED is turned on, and within 1 second the BSL will be invoked

    4- Within 10 seconds of BSL invocation (and before it goes to sleep), I went ahead to the UniFlash and attempted to flash a dummy program, I had the UniFlash ready before hand:
     - In UniFlash I selected the MSPM0G3507(Bootloader) programming option
     - Selected the dummy program ti-txt file and configured the appropriate COM port

    5- UniFlash shows this error: [ERROR_MESSAGE]Failed to receive expected data! which is a similar error I'm getting when I flash using my own programming tool

    What I want to verify is whether these steps are correct and working as expected, because on my case there seems to be an issue. If I did the same programming steps with UniFlash while invoking BSL through NRST + PA18, everything works fine, but when BSL is invoked through software flashing doesn't seem to work.

    Thanks.

  • Please try this 

    void invokeBSL(void)
    {

    __asm(
    "ldr r4, = 0x41C40018\n" // Load SRAMFLASH register
    "ldr r4, [r4]\n"
    "ldr r1, = 0x03FF0000\n" // SRAMFLASH.SRAM_SZ mask
    "ands r4, r1\n" // Get SRAMFLASH.SRAM_SZ
    "lsrs r4, r4, #6\n" // Shift SRAMFLASH.SRAM_SZ to kB size
    "ldr r1, = 0x20300000\n" // Start of ECC-code
    "adds r2, r4, r1\n" // End of ECC-code
    "movs r3, #0\n"
    "init_ecc_loop: \n" // Loop to clear ECC-code
    "str r3, [r1]\n"
    "adds r1, r1, #4\n"
    "cmp r1, r2\n"
    "blo init_ecc_loop\n"
    "ldr r1, = 0x20200000\n" // Start of NON-ECC-data
    "adds r2, r4, r1\n" // End of NON-ECC-data
    "movs r3, #0\n"
    "init_data_loop:\n" // Loop to clear ECC-data
    "str r3, [r1]\n"
    "adds r1, r1, #4\n"
    "cmp r1, r2\n"
    "blo init_data_loop");

    SYSCTL->SOCLOCK.RESETLEVEL = DL_SYSCTL_RESET_BOOTLOADER_ENTRY;
    SYSCTL->SOCLOCK.RESETCMD =
    SYSCTL_RESETCMD_KEY_VALUE | SYSCTL_RESETCMD_GO_TRUE;


    }

  • Hello Gary,

    This solution couldn't invoke BSL successfully, it was resetting the LP and starting application again, which is the same issue we had at the beginning, however I managed to fix the issue using a very similar approach using the code below:

    void bsl_invoke(void)
    {
            /* Erase SRAM completely before jumping to BSL */
            __asm(
            #if defined(__GNUC__)
            ".syntax unified\n" /* Load SRAMFLASH register*/
            #endif
            "ldr     r4, = 0x41C40018\n" /* Load SRAMFLASH register*/
            "ldr     r4, [r4]\n"
            "ldr     r1, = 0x03FF0000\n" /* SRAMFLASH.SRAM_SZ mask */
            "ands    r4, r1\n"           /* Get SRAMFLASH.SRAM_SZ */
            "lsrs    r4, r4, #6\n"       /* SRAMFLASH.SRAM_SZ to kB */
            "ldr     r1, = 0x20300000\n" /* Start of ECC-code */
            "adds    r2, r4, r1\n"       /* End of ECC-code */
            "movs    r3, #0\n"
            "init_ecc_loop: \n" /* Loop to clear ECC-code */
            "str     r3, [r1]\n"
            "adds    r1, r1, #4\n"
            "cmp     r1, r2\n"
            "blo     init_ecc_loop\n"
            "ldr     r1, = 0x20200000\n" /* Start of NON-ECC-data */
            "adds    r2, r4, r1\n"       /* End of NON-ECC-data */
            "movs    r3, #0\n"
            "init_data_loop:\n" /* Loop to clear ECC-data */
            "str     r3, [r1]\n"
            "adds    r1, r1, #4\n"
            "cmp     r1, r2\n"
            "blo     init_data_loop\n"
            /* Force a reset calling BSL after clearing SRAM */
            "str     %[resetLvlVal], [%[resetLvlAddr], #0x00]\n"
            "str     %[resetCmdVal], [%[resetCmdAddr], #0x00]"
            : /* No outputs */
            : [ resetLvlAddr ] "r"(&SYSCTL->SOCLOCK.RESETLEVEL),
            [ resetLvlVal ] "r"(DL_SYSCTL_RESET_BOOTLOADER_ENTRY),
            [ resetCmdAddr ] "r"(&SYSCTL->SOCLOCK.RESETCMD),
            [ resetCmdVal ] "r"(
                SYSCTL_RESETCMD_KEY_VALUE | SYSCTL_RESETCMD_GO_TRUE)
            : "r1", "r2", "r3", "r4");
    }


    Which I happened to find the MSPM0 SDK Academy version 1.20.01.06
    https://dev.ti.com/tirex/explore/node?node=A__AEwa3SgQDeRlwqwIqUNu1g__MSPM0-SDK__a3PaaoK__LATEST

    Thank you.