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.

[参考译文] MSPM0G3507:MSPM0 实时固件更新 (LFU) 引导加载程序实施问题。

Guru**** 2553450 points
Other Parts Discussed in Thread: MSPM0G3507

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1536718/mspm0g3507-mspm0-live-firmware-update-lfu-bootloader-implementation-problem

器件型号:MSPM0G3507


工具/软件:

大家好、TI 专业知识

我恳请各位协助解决这一问题。

芯片型号: MSPM0G3507SRHBR [VQFN]

SDK 版本:1.00.01.03

我尝试使用“MSPM0 实时固件更新 (LFU) 引导加载程序实现“指南中的示例、  

首先、我将引导加载程序代码刷写到芯片中。 然后、我使用示例文件中提供的基于 Python 的 PC 软件。 但它无法识别来自芯片的 UART 信号。 使用  MSPM0G3507 LaunchPad 进行测试时、它会正常工作。

在示例引导加载程序代码中、UART 0 的定义方式如下、

/* Defines for UART_0 */
#define UART_0_INST                                                        UART0
#define UART_0_INST_IRQHandler                                  UART0_IRQHandler
#define UART_0_INST_INT_IRQN                                      UART0_INT_IRQn
#define GPIO_UART_0_RX_PORT                                                GPIOA
#define GPIO_UART_0_TX_PORT                                                GPIOA
#define GPIO_UART_0_RX_PIN                                        DL_GPIO_PIN_11
#define GPIO_UART_0_TX_PIN                                        DL_GPIO_PIN_10
#define GPIO_UART_0_IOMUX_RX                                     (IOMUX_PINCM22)
#define GPIO_UART_0_IOMUX_TX                                     (IOMUX_PINCM21)
#define GPIO_UART_0_IOMUX_RX_FUNC                      IOMUX_PINCM22_PF_UART0_RX
#define GPIO_UART_0_IOMUX_TX_FUNC                      IOMUX_PINCM21_PF_UART0_TX
#define UART_0_BAUD_RATE                                                  (9600)
#define UART_0_IBRD_32_MHZ_9600_BAUD                                       (208)
#define UART_0_FBRD_32_MHZ_9600_BAUD                                        (21)

但在我们的设计中、我们将这些引脚用于 UART、

我认为这就是 UART 通信的问题。 可以帮助我更改此引脚多路复用器配置。 但此示例工程没有用于设置或更改任何配置的“System Configuration“。

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

    尊敬的 Kaushika:

    LFU 与基于 ROM 的 BSL 一起使用、因此 MSPM0 的引脚多路复用和波特率是固定的。

    如果要使用不同引脚、则需要修改 MSPM0 的 NONMAIN。

    如果要使用不同的波特率、您可以使用闪存 UART 脉冲接口、或使用 BSL 命令动态修改 UART 波特率。

    直接更改 LFU 代码不起作用、我们应将这两个代码都配置为生效。

    B.R.

    Sal

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

    我解决了上述问题、成功更改了 UART 引脚。

    我还在 MSPM0 LaunchPad 的应用程序代码中将 LED 更改为 RGB、并关闭红色 LED 闪烁。 但引导加载程序代码的红色 LED 仍在闪烁。 我认为引导加载程序仍然与应用程序代码并行工作。  

    我还需要在应用中使用 UART 通信。 如何在引导加载程序也正在寻找 UART 接收时执行该操作。

    我已取消注释这些行、并按如下方式修改了应用程序。 然后可以将 UART 用于应用代码。 但无法再次唤醒引导加载程序。

    SCB->VTOR = APP_AREA_1_START_ADDR;

    SCB->VTOR = APP_AREA_2_START_ADDR;

    void main_tasks_create(void)
    {
        /* Create the queue. */
        xQueue = xQueueCreate(mainQUEUE_LENGTH, sizeof(uint32_t));
    
        if (xQueue != NULL) {
            /*
             * Start the two tasks as described in the comments at the top of this
             * file.
             */
            xTaskCreate(
                    prvBootloader_Task, /* The function that implements the task. */
                    "BSL", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
                    configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
                    NULL, /* The parameter passed to the task - just to check the functionality. */
                    mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
                    &Bootloader_Handler); /* The task handle is not required, so NULL is passed. */
    
            xTaskCreate(
                    prvRTOS_LED0_Toggle_Task,
                    "LED",
                    configMINIMAL_STACK_SIZE,
                    (void *) mainQUEUE_SEND_PARAMETER,
                    mainQUEUE_SEND_TASK_PRIORITY,
                    &RTOS_LED_Toggle_Handler);
    //        BSL_PI_sendByte(0xBB);
            app_area_flag = TI_MSPBoot_AppMgr_AppisValid();
    //        app_area_flag = 1;
            BSL_PI_sendByte(app_area_flag);
            switch (app_area_flag)
            {
                case 1:
                    xTaskCreate(
                            (TaskFunction_t)(*(uint32_t *)(APP_AREA_1_START_ADDR + 4)),
    //                        prvRTOS_LED0_Toggle_Task2,
                            "App",
                            config_test_STACK_SIZE,
                            NULL,
                            mainQUEUE_SEND_TASK_PRIORITY,
                            &App_Handler);
                    vTaskSuspend(Bootloader_Handler);
                    SCB->VTOR = APP_AREA_1_START_ADDR;
    //                BSL_PI_sendByte(0x11);
                    break;
                case 2:
                    xTaskCreate(
                            (TaskFunction_t)(*(uint32_t *)(APP_AREA_2_START_ADDR + 4)),
                            "App",
                            config_test_STACK_SIZE,
                            NULL,
                            mainQUEUE_SEND_TASK_PRIORITY,
                            &App_Handler);
                    vTaskSuspend(Bootloader_Handler);
                    SCB->VTOR = APP_AREA_2_START_ADDR;
                    break;
                default:
                    break;
            }
     //       BSL_PI_sendByte(0x22);
            /* Start the tasks. */
            vTaskStartScheduler();
        }
    
        /*
         * If all is well, the scheduler will now be running, and the following
         * line will never be reached.  If the following line does execute, then
         * there was insufficient FreeRTOS heap memory available for the idle
         * and/or timer tasks to be created.  See the memory management section on
         * the FreeRTOS web site for more details.
         */
        for (;;)
            ;
    }

    以下是修改后的应用程序代码。 其 UART 回显正在工作、但 LED 闪烁不工作。 LED 在没有 UART 功能的情况下工作。

    #include "ti_msp_dl_config.h"
    
    #define APP_AREA_1_START_ADDR       0x4000
    
    volatile uint8_t gEchoData = 0;
    
    void Delay_for_tasks_switch(uint32_t delay_ms);
    
    int main(void)
    {
        SYSCFG_DL_init();
    
        SCB->VTOR = APP_AREA_1_START_ADDR;
    
        NVIC_EnableIRQ(TIMER_0_INST_INT_IRQN);
    
        DL_TimerG_startCounter(TIMER_0_INST);
    
        /*  UART Initializing */
            // RX interrupt is enabled
            DL_UART_Main_enableInterrupt(UART_0_INST, DL_UART_MAIN_INTERRUPT_RX);
            NVIC_ClearPendingIRQ(UART_0_INST_INT_IRQN);
            NVIC_EnableIRQ(UART_0_INST_INT_IRQN);
            delay_cycles(160000);
    
        while (1) {
            Delay_for_tasks_switch(1000);//must be call for tasks switch.
    
            DL_GPIO_togglePins(GPIO_GRP_0_PORT, GPIO_GRP_0_RGB_B_PIN);
            delay_cycles(16000000);
            DL_GPIO_togglePins(GPIO_GRP_0_PORT, GPIO_GRP_0_RGB_R_PIN);
            delay_cycles(16000000);
        }
    }
    
    
    void Delay_for_tasks_switch(uint32_t delay_ms)
    {
        ((void (* )(uint32_t xTicksToDelay))(*(uint32_t *)(0x3FF0)))(delay_ms);
    }
    
    
    void UART_0_INST_IRQHandler(void)
    {
        uint32_t intSource = DL_UART_Main_getPendingInterrupt(UART_0_INST);
    
        switch (intSource) {
            case DL_UART_MAIN_IIDX_RX:
                gEchoData = DL_UART_Main_receiveData(UART_0_INST);
    
                // Echo back the character
                DL_UART_Main_transmitData(UART_0_INST, gEchoData);
    
                break;
            default:
                break;
    
        }
    }

    如何在运行应用程序代码时暂停引导加载程序、并在需要时唤醒以更新固件。

    我还尝试使用.syscfg 创建一个新的应用程序代码。 还添加了必要的内容。 它是通过 GUI 正确下载的。 但没有工作。  

    请帮助解决此问题。

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

    尊敬的 Kaushika:

    如何在运行应用程序代码时暂停引导加载程序、以及在需要时唤醒以更新固件。

    我查看了 LFU 的文档、在执行应用程序时会自动暂停引导加载程序。

    如果执行该应用程序时出错、我建议您检查加载的应用程序(由调试器读取)并检查它是否有任何问题。

    基本原则是:

    引导模式将检查应用状态、并启用可用的应用。 应用开始执行后、引导将暂停。

    我还需要在应用中使用 UART 通信。 如何在引导加载程序也正在寻找 UART 接收时执行此操作。

    该参考工程不支持在引导和应用程序中使用相同的外设。

    B.R.

    Sal