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.

[FAQ] AM625: UART Uniflash Flashing Speed Optimization

Part Number: AM62xx
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG

How can flashing speed be improved in UART Uniflash using a higher baud rate? 

Overview
Flashing speed using UART Uniflash on the AM62XX platform can be partially improved. A full increase is not possible due to an inherent limitation in the boot process handled by the ROM Bootloader (RBL).

  • Technical Background
    The ROM Bootloader always loads the first-stage image (sbl_uart_uniflash_stage1) at a fixed baud rate of 115200. This baud rate is hardcoded in ROM and cannot be modified.

    However, after the first-stage bootloader is successfully loaded, it is possible to switch to a higher baud rate for all subsequent flashing stages, which significantly reduces the overall flashing time.

    Recommended Approach


    1. Update Baud Rate in Firmware
    - Modify the UART baud rate in the SysConfig (.syscfg) file for both:
    * sbl_uart_uniflash_stage1
    * sbl_uart_uniflash_stage2

    Steps:

    • Open the respective .syscfg files.

    • Navigate to the UART configuration section (as shown in the image).

    • Update the baud rate to a higher value (e.g., 460800 or above).

    Reference:

    • The image below highlights where the UART baud rate can be configured within SysConfig.

    • Refer to the UART baud rate table shown in the image for valid values based on clock settings.

    Increase the baud rate to a higher value such as 460800bps or higher,depending on system stability.

    2. Modify the Flashing Tool (uart_uniflash.py)
    - Keep the initial baud rate at 115200 to match the ROM Bootloader requirement.
    - After Stage 1 is loaded, update the script to switch to the higher baud rate for all subsequent flashing operations.

    Resulting Flash flow
    - Step 1: ROM Bootloader loads Stage 1 at 115200 baud (fixed)
    - Step 2: Flashing tool switches to higher baud rate
    - Step 3: Stage 2 and remaining images are flashed at the accelerated baud rate

    Additional Resources
    - Patch file

    diff --git a/uart_uniflash.py b/uart_uniflash_modified.py
    index f4ecaf00..5995c49e 100644
    --- a/uart_uniflash.py
    +++ b/uart_uniflash_modified.py
    @@ -213,7 +213,7 @@ def parse_response_evm(filename):
         return status
     
     # Sends the file to EVM via xmodem, receives response from EVM and returns the response status
    -def xmodem_send_receive_file(filename, serialport, baudrate=115200, get_response=True):
    +def xmodem_send_receive_file(filename, serialport, baudrate=230400, get_response=True):
         status = False
         timetaken = 0
         if not os.path.exists(filename):
    @@ -398,7 +398,7 @@ def main(argv):
                     cfg_flash_writer_file = filecfg.cfgs[filecfg.flash_writer_index].flashwriter
                     print("Executing command {} of {} ...".format(1, len(filecfg.cfgs)))
                     print("Found flash writer ... sending {}".format(cfg_flash_writer_file))
    -                status, timetaken = xmodem_send_receive_file(cfg_flash_writer_file, serialport, get_response=False)
    +                status, timetaken = xmodem_send_receive_file(cfg_flash_writer_file, serialport, 115200,get_response=False)
                     print("Sent flashwriter {} of size {} bytes in {}s.".format(cfg_flash_writer_file, os.path.getsize(cfg_flash_writer_file), timetaken))
                     print("")

    These modifications enable faster flashing while remaining compliant with the ROM boot constraints of the AM62X device.

    Note: 

    1.The higher baud rate configuration has been tested and verified up to 921600 baudrate. Stability at higher baud rates may vary depending on the host system, UART hardware, and cable quality.

    2.This solution has been validated on the SK-AM62A platform; however, the same approach can be applied across other devices in the AM62x family