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.

[参考译文] MSP430FR5872:通过软件调用 BSL

Guru**** 2511985 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1128279/msp430fr5872-invoking-bsl-through-software

器件型号:MSP430FR5872
  1. 我正在开发基于器件型号 MSP430FR5872IPMR 的产品。 我打算实现一个依赖 UART BSL 并通过软件进入 BSL 模式的固件更新系统。 到目前为止、用户指南和数据表建议我可以通过禁用中断、然后将程序计数器值设置为0x1000来进入 BSL 模式。 我已经尝试过这种方法、然后尝试运行不受保护的 BSL 命令(特别是擦除大容量存储器命令)、但芯片没有响应。 实际上、我注意到正常程序流中断(我的 LED 停止闪烁)、但我无法与 BSL 代码交互。 请告知我应该如何使用软件进入 BSL 模式。 硬件序列正常工作。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    高模式、

    如果跳转至地址0x1000、则应正确进入 BSL 模式。 您的代码是什么样的?  

    [引用 userid="513720" URL"~μ C/support/microcontroller /msp-lower-power-microcontroller 组/msp430/f/msp-lower-microcontroller 论坛/1128279/msp430fr5872-inverting-BSL-Through -software"]硬件序列有效

    当您说硬件序列正常工作时、您是否意味着 在使用硬件调用后、您能够通过 BSL 和 UART 进行正确编程?  

    您是否遵循 UART BSL 命令的正确格式?

    此致、
    Brandon Fisher

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这是我运行失败的代码:

    #include <msp430.h>
    
    void main(void) {
        WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
        PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                                // to activate previously configured port settings
    
        P1DIR |= 0x01 << 0;                     // Set P1.0 to output direction (RED LED)
        P9DIR |= 0x01 << 7;                     // Set P9.7 to output direction (GREEN LED)
    
        P1OUT |= 0x01 << 0;                     // Start P1.0 as output HIGH
        P9OUT |= 0x01 << 7;                     // Start P1.0 as output HIGH
    
        P1OUT |= 0x01 << 1;                     // Button needs a pull-up resistor
        P1REN |= 0x01 << 1;
    
        volatile unsigned int pressCount = 0;   // volatile to prevent optimization
    
        for(;;) {
            volatile unsigned int i;            // volatile to prevent optimization
    
            if (! (P1IN & (0x01 << 1)) ){       // Is the Button pushed?
                P1OUT ^= 0x01 << 0;             // Toggle RED using exclusive-OR
    
                pressCount++;
    
                if (pressCount >= 10){
                    P9OUT ^= (0x01 << 7);       // Toggle GREEN using exclusive-OR
                    
                    //Jump to BSL here
                    __disable_interrupt();      // disable interrupts
                    ((void (*)())0x01000)();    // jump to BSL
                }
    
                i = 20000;                      // SW Delay
                do i--;
                while(i != 0);
            }
        }
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    通过按如下方式修改代码(第30行)并运行整体擦除 BSL 命令、该问题已得到解决。

    #include <msp430.h>
    
    void main(void) {
        WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
        PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                                // to activate previously configured port settings
    
        P1DIR |= 0x01 << 0;                     // Set P1.0 to output direction (RED LED)
        P9DIR |= 0x01 << 7;                     // Set P9.7 to output direction (GREEN LED)
    
        P1OUT |= 0x01 << 0;                     // Start P1.0 as output HIGH
        P9OUT |= 0x01 << 7;                     // Start P1.0 as output HIGH
    
        P1OUT |= 0x01 << 1;                     // Button needs a pull-up resistor
        P1REN |= 0x01 << 1;
    
        volatile unsigned int pressCount = 0;   // volatile to prevent optimization
    
        for(;;) {
            volatile unsigned int i;            // volatile to prevent optimization
    
            if (! (P1IN & (0x01 << 1)) ){       // Is the Button pushed?
                P1OUT ^= 0x01 << 0;             // Toggle RED using exclusive-OR
    
                pressCount++;
    
                if (pressCount >= 10){
                    P9OUT ^= (0x01 << 7);       // Toggle GREEN using exclusive-OR
    
                    MPUCTL0 = MPUPW;            //Disabling the MPU
                    
                    //Jump to BSL here
                    __disable_interrupt();      // disable interrupts
                    ((void (*)())0x01000)();    // jump to BSL
                }
    
                i = 20000;                      // SW Delay
                do i--;
                while(i != 0);
            }
        }
    }
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    高模式、

    很高兴听到您的解决方案。 现在、我将把这个线程标记为已关闭。 如果您在线上遇到任何其他问题、请随时发表另一篇文章。

    此致、
    Brandon Fisher

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Brandon、

    在关闭线程之前、请向我简单介绍一下 BSL 代码是否完全存在于存储器的受保护区域中、或者说明文件中所述的0x1000到0x100F 区域是否不受保护。 目前、我必须禁用芯片的存储器保护才能访问 BSL。 是否有其他方法可以使 BSL 代码可访问?

    此致、

    图形

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    高模式、

    您的原始 BSL 调用应该起作用。  

    您尝试编程什么二进制文件? 如果这试图访问一个受保护的存储器区域、那么 MPU 可能会触发一个 NMI。  

    此致、
    Brandon Fisher

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    高模式、

    您的原始 BSL 调用应该起作用。 跳转到 BSL 不应要求这样做。

    您尝试编程什么二进制文件? 如果这试图访问一个受保护的存储器区域、那么 MPU 可能会触发一个 NMI。  

    此致、
    Brandon Fisher