AM13E23019: How to disable the BSL invoke pin?

Part Number: AM13E23019
Other Parts Discussed in Thread: SYSCONFIG

Hello team,

can you please let me know how to disable the BSL invoke pin on AM13 if this pin is used differently in the design?

Is there any short C code example on how to do this?

Best regards
Manuel

 

  • Hi Manuel,

    You can refer to section 2.2 of AM13E230x Bootloader User guide for BSL invocation. We do have an option in TI Sysconfig tool to disable the BSL invoke pin by unchecking the option :


    Regards 
    Arpit 

  • Hi Arpit,

    thanks for this.

    Can you provide a C only example on how to do this since customer is not using SysConfig for their code.

    Best regards
    Manuel

  • Hi Manuel,

    They can refer to the following files:

    /* This file is AUTO GENERATED, DO NOT EDIT manually */
    
    
    /*
     * Copyright (c) 2024, 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.
     */
    
    #include "boot_config.h"
    
    /* Bootcode configuration */
    
    PLACE_IN_MEMORY(".BCRConfig")
    const bcUserCfg_t BCRConfig =
    {
        .BCR_CONFIG_ID          = BC_CFG_ID,
        .DEBUG_ACCESS           = BC_CFG_DEBUG_EN,
        .SWDP_MODE              = BC_CFG_SW_DP_EN,
        .BSL_PIN_INVOKE         = BC_CFG_BSL_PIN_INVOKE_DIS,
        .DEBUG_HOLD             = BC_CFG_DEBUG_HOLD_DIS,
        .CSC_EXISTS             = BC_CFG_CSC_DIS,
        .FLASH_BANK_SWAP_POLICY = BC_CFG_FLASH_BANK_SWAP_POLICY_DIS,
        .FAST_BOOT_MODE         = BC_CFG_FAST_BOOT_DIS,
    
        .SERVICES = {
            .BOOTLOADER_MODE    = BC_CFG_BOOTLOADER_MODE_EN,
            .MASS_ERASE_MODE    = BC_CFG_MASS_ERASE_EN,
            .FACTORY_RESET_MODE = BC_CFG_FACTORY_RESET_EN,
        },
    
        .PASSWORDS = {
            .MASS_ERASE = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .RSVD_MASS_ERASE = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .FACTORY_RESET = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .RSVD_FACTORY_RESET = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .DEBUG_LOCK = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .RSVD_DEBUG_LOCK = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            },
            .RSVD_PSWD = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            }
        },
    
        .SECURE_BOOT_MODE           = BC_CFG_SECURE_BOOT_DIS,
        .BC_RESERVED_0              = 0xFFFF,
        .USER_SECURE_APP_START_ADDR = 0xFFFFFFFF,
        .USER_SECURE_APP_LENGTH     = 0xFFFFFFFF,
        .USER_SECURE_APP_HASH       = {
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
        },
    
        .GSC_CONFIGS = {
            .BANK0_NM_USER_CONFIG   = BC_CFG_NONMAIN_WRITE_PROTECT_DIS,
            .BC_RESERVED_1          = 0xFFFF,
            .BANK0 = {
                .WRITE_ERASE_PROTECTION_A = 0xFFFFFFFF,
                .WRITE_ERASE_PROTECTION_B = 0xFFFFFFFF,
                .reserved1                = 0xFFFFFFFF,
                .reserved2                = 0xFFFFFFFF,
                .PRIVILEGE_PROTECTION_A   = 0xFFFFFFFF,
                .PRIVILEGE_PROTECTION_B   = 0xFFFFFFFF,
                .reserved3                = 0xFFFFFFFF
            },
            .BANK1 = {
                .WRITE_ERASE_PROTECTION_A = 0xFFFFFFFF,
                .WRITE_ERASE_PROTECTION_B = 0xFFFFFFFF,
                .reserved1                = 0xFFFFFFFF,
                .reserved2                = 0xFFFFFFFF,
                .PRIVILEGE_PROTECTION_A   = 0xFFFFFFFF,
                .PRIVILEGE_PROTECTION_B   = 0xFFFFFFFF,
                .reserved3                = 0xFFFFFFFF
            },
        },
        .BC_RESERVED_2 = {
                0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
        },
        .SYSPLL_CONFIG              = BC_CFG_PLL_NOPLL,
        .SYSPLL_CONFIG_QDIV         = 0xF,
        .SYSPLL_CONFIG_RDIV         = 0x0,
        .SYSPLL_SOURCE              = BC_CFG_PLL_SOURCE_SYSOSC,
        .SYSPLL_SETTLING_TIME       = 0xC8,
        .XTAL_STARTUP_MONITOR_TIME  = 0x8,
        .BC_RESERVED_3 = {
            0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
            0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF
        },
    
        .CRC = 0x6A4C7CB3
    };
    
    /* Bootloader configuration */
    
    PLACE_IN_MEMORY(".BSLConfig")
    const blUserCfg_t BSLConfig =
    {
        .BSL_CONFIG_ID = BL_CFG_ID,
    
        .BLINTERFACE_PINS = {
            .UART_RXD_pad_num       = 0x1,
            .UART_RXD_PF_mux_sel    = 0x7,
            .UART_TXD_pad_num       = 0x0,
            .UART_TXD_PF_mux_sel    = 0x7,
    
            .I2C_SDA_pad_num        = 0x16,
            .I2C_SDA_PF_mux_sel     = 0x4,
            .I2C_SCL_pad_num        = 0x17,
            .I2C_SCL_PF_mux_sel     = 0x4,
    
            .MCAN_RX_pad_num        = 0xB,
            .MCAN_RX_PF_mux_sel     = 0xA,
            .MCAN_TX_pad_num        = 0xC,
            .MCAN_TX_PF_mux_sel     = 0xA
        },
    
        .BSLPIN_INVOKE = {
            .Pin_data_0 = 0x86,
            .Pin_data_1 = 0x6
        },
    
        .READOUT = BL_CFG_READBACK_EN,
    
        .PASSWORD = {
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
        },
    
        .APP_REV_POINTER        = (uint32_t *)0xFFFFFFFF,
        .SECURITY_ALERT_LEVEL   = BL_CFG_SECURITY_IGNORE,
        .UART_BAUD_RATE         = BL_CFG_UART_BAUDRATE_9600,
        .I2C_SLAVE_ADDR         = 0x48,
        .RESERVED = {
            0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
            0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
        },
    
        .CRC = 0x98B4F994
    };
    4745.boot_config.h

    Do Note:

    For security purposes, AM13 devices require a valid NONMAIN Flash image at all times. When updating NONMAIN, the old NONMAIN configuration is erased, and the new configuration is programmed. Any interruption during the erase or re-program operations i.e., unplugging device, removing SWD jumpers, hitting reset by accident, cancelling the code download, an IDE crash, etc. can brick the device permanently. Improper configuration of NONMAIN Flash can also lead to permanent locking of the device.

    To minimize these risks, TI ** highly recommends ** adding and configuring this module only when one is ready to go to production. Click the checkbox to acknowledge the risks when using NONMAIN Flash, and refer to the relevant IDE guides in the Tools documentation directory in the SDK on how to properly program NONMAIN Flash.



    Regards 
    Arpit

  • Hello Arpit,

    can you please elaborate on how to use this?

    I see sections on the BSL_PIN_INVOKE, but how does this need to be modified in order to change the behaviour  and de-activate it?

    Best regards
    Manuel

  • Hi Manuel,

    So, if customer is not using the sysconfig to disable the BSL invoke, they need to configure the BCR (Boot Configuration Routine) manually.

    You need to create and program a Boot Configuration Routine (BCR) into NONMAIN flash. The device bootloader reads this
    record before your application runs, so it must be set up correctly before your main code executes.

    So, the NONMAIN flash region stores boot-time configuration. The bootloader reads this region at power-on, before jumping to your application. By default, SL pin invoke is enabled. To disable it you must write a valid BCRConfig struct to that region.

    Important: On some AM13E230X variants, NONMAIN flash is one-time-programmable (OTP). Verify every field carefully before flashing. A misconfigured BCR (for example, accidentally disabling debug access and mass erase with no recovery path) can make the device permanently unrecoverable.


    Basically, you need to add boot_config.c and boot_config.h files (provided in the above reply) to your project build and flash as normal. The only field we have changed from the default is:
    .BSL_PIN_INVOKE = BC_CFG_BSL_PIN_INVOKE_DIS,

    All other fields must be explicitly set to their correct values. Do not leave fields uninitialized as unspecified struct fields are zero-initialized (0x0000), which the bootloader treats as invalid and can accidentally disable debug access, SWD, and mass erase.

    The linker file already takes care of the NONMAIN Flash Address.

    Regards 
    Arpit 

  • Hello Arpit,

    is it possible to write to the nonmain flash area from the device itself? We want to check if the debug access is enabled, and if yes we want to disable it.

    Best regards
    Dario

  • Hi Dario,

    Let me look into the issue and get back to you.

    Regards 
    Arpit 

  • Hi Dario,

    Yes it is possible to write to the Non-main flash area from the device itself. 

    You can refer to the example in AM13x mcu_sdk: C:\ti\am13e230x_sdk_26_01_00_03\examples\boot\boot_config_nonmain_flash.

    You can also program the non-main configs from sysconfig (like the above example does).

    Regards,
    Shaunak