/
Device programming

Device programming

NXP Flasher provides the entire programming chain specific to the iMX.RT family via USB interface. Programming can be done in parallel for up to 8 devices using any USB port on the host computer.

To successfully program the devices the following steps need to be followed. Not all of them are necessary which depends on the type of file to be loaded.

 

  1. The first step is to select a microcontroller model

  2. Connect up to 8 devices to the USB ports and run a scan to identify the paths to the ports where the devices are connected. And check MCU connection after scan.

  3. Add the files to be programmed:

    1. Flashloader

    2. Image (.bin, .s19 or .sb)

    3. Fuses values programmed in OTP

  4. Memory Configuration

  5. Memory Erase

  6. Memory Read & Verify

 

Selecting target MCU

The first mandatory step is to select the microcontroller you want to program. The variants supplied can be found in the field MPU/MCU/Board Type:

The first step is to select the microcontroller you want to program. The variants supplied can be found in the MPU/MCU/Board Type field. The field is divided into further options (Family. Group and Name) to help you search for a model.

USB HID ports scan and device identification

Connect up to 8 devices to any USB host port on the host computer.

Scanning and identifying are based on searching for USB HID devices with a given VID and PID number. Therefore, it is important to make sure before scanning that you have chosen the right microcontroller model for the USB port.

For scanning devices, the application includes a dedicated window which can be found in Setup -> USB Location

Scanning does not perform on its own. It is up to the user to select one of two options:

  • Automatically scan all devices. The list of detected ports has a random order.

  • Scanning and adding individual devices when the user wants to manually order the ports in the list.

Automatic scanning of all devices

This is a faster method, recommended when the order of the ports in the list is not important in programming. After connecting all devices, check the checkbox "Automatic selection from min Port/Hub to max." Then the "Scan" button will be unlocked, press it and wait until the list completes according to the number of connected devices

 

Manual Selection

This method should be used if the order of ports in the list is important in programming.

In this method, connect one device at a time and press the "Add one USB" button.

Check MCU connection

After a successful scan, the "Target Device Programming Results" field in the main window is filled with "USB P.H No" according to the list obtained after the scan process. A next to USP P.H indicates that the connection is active.

If the device is disconnected, the automatic check will be indicated by

To manually check the connection, check the "Enable" checkboxes and then click the button. This option also helps to detect whether the Flashloader is already running on the microcontroller or not.

The example below shows the connection to three of the five selected microcontrollers without Flashloader.

If the Flashloader was previously loaded and running, the connection check result will be indicated by in the “Flashloader Init” column.

If the connection fails it will be indicated by in the "Final" column

Browsing for firmware files

NXP Flasher allows programming of all file types (.bin, .s19, .sb) provided for the iMX.RT family of microcontrollers, including OTP memory. Programming of images and OTP can only be done by connecting to a bootloader application called "Flashloader".

Flashloader File

The MCU Flashloader is a specific implementation of the MCU bootloader. It provides a standard interface to the device using any of the peripherals supported by the bootloader on a given NXP device.

It is possible to use Flashloader in two options:

  • the default version of the Flashloader provided with the NXP Flasher

  • or to use your own compiled version by providing the file path by clicking button.

Default Flashloader

The default Flashloader image files are located in the NXP Flasher installation folder under the path ..... and are copies of the files provided by MCUXpresso Secure Provisioning.

User defined Flashloader

To use your own compiled version by providing the file path by using the button “Open Flashloader File“.

In order to have a user Flashloader in the programming process, additional settings need to be made in the Setup -> Memory Options window.

 

In this window you should check the "User" checkbox in “Flashloader Setup“ field and then set the desired addresses:

  • Load Address → Flashloader uploading address (usually RAM),

  • Jump Address → Flashloader startup address,

  • VID → Flashloader USB Vendor ID when flashloader is running,

  • PID → Flashloader USB Product ID when flashloader is running.

To confirm the modification, press the "OK" button.

Loading Flashloader to MCU

After configuring the Flashloader loading options, check if it will load and run. After configuring the Flashloader setup, check if it will load and run. To do this, click button and wait for a response. Successful upload and run of Flashloader will be indicated by in "Load", "In" and “Final“ columns.

Flashloader Reset

If the Flashloader is running it is possible to reset it and return to the primary MCU bootloader. To perform a Flashloader reset, click on the right side of the main window.

If the Flashloader was not started before the Reset command, the operation will fail.

 

Image File

MCU configuration and programming depends on the image file type selected: .bin, .s19 or .sb.

Binary Image File

A binary file only contains data that is not memory-mapped. To properly upload a .bin file, you must previously configure the memory and set the address of loading the file into memory.

S-record Image File

 

Secure Binary File

Writing Image

The write process of an image depends on the type of image file. The table below summarizes:

Operation

Binary File

S-record File

Secure Binary File

Operation

Binary File

S-record File

Secure Binary File

Memory Configuration

User defined

User defined

Included in file

Image Load Address

User defined

Included in file

Included in file

Erase range

User defined

Extracted from the file

Included in file

OTP File

The OTP memory contains fuse bits that configure and protect the program loaded into the internal or external flash memory. In the iMX.RT 10xx family of microcontrollers, there is an OTP area of 64 32-bit words. Generating, modifying, and using fuse bit value files is possible in several ways:

  • Using MCUXpresso Secure Provisioning software, the resulting file is in .Json format (recommended option for consistency of OTP and image file values)

  • Using a dedicated "Setup -> OTP Configuration" window where the user can enter or modify OTP word values himself. (This option is recommended if you need to modify single words which were not set in MCUXpresso Secure Provisioning)

  • Using other software to generate binary files (not recommended)

Using MCUXpresso Secure Provisioning output .Json file

MCUXpresso Secure Provisioning provides a fully integrated software package that prepares the image file for production. This software enables the generation of a set of image encryption keys with which the image is secured and generates the appropriate fuse bit values.

After the image is loaded, keys are generated and signed, a set of fuse bit values is generated and exported to a .json file

Browsing OTP File

NXP Flasher for OTP programming accepts two file types:

  • .bin file of fixed size 256 bytes

  • .json file generated in the "OTP Configuration" window in MCUXpresso Secure Provisioning.

The OTP file is loaded by clicking the button. In the pop-up window, you can specify one of two file types.

If a .json file is selected then .json file is loaded, it is automatically converted into a 256 byte binary file. The resulting binary file is saved under the same name and path as the .json file.

Viewing and modifying an OTP file and viewing current MCU OTP status

After OTP file loading it is possible to preview and modify the fuse values in a dedicated window "Setup -> OTP Configuration". The window displays a list of fuse bits that are relevant to programming.

  • The "Current Value" column shows the fuse word values read from the selected target.

  • The "Required Value" column displays the fuse word values loaded from the OTP file

  • The window does not display all words at once, to view subsequent values, select the appropriate page by checking the checkbox "Page 1" or "Page 2".

Writing OTP

The configuration for writing and verifying values in OTP is in the "OTP Options" section.

The first step is to load the OTP data file by “Open OTP File“ button. Acceptable formats are .bin and .json. The .json file is parsed and its data is saved to the .bin file. The format of the .json file is the same as the output file from MCUxpresso Secure Provisioning software.

In the second step:

choose to unlock the “Write” button by “Button enable“ checkbox.

or allow OTP programming in the "Autoprogram" sequence.

In the third step, you can write the OTP values with the "Write" button if the Flashloader is loaded, or via the "Autoprogram" button

Locking MCU

MCU locking is accomplished by setting the fuse bits in the first word of the OTP memory area. This value is also in the OTP file, but is ignored when programming the OTP memory. Locking the processor is the last programming step and can be done manually or as the last "Autoprogram" procedure.

Manual MCU locking

Manual CPU locking is available in the "OTP Options" field in the main window. First, make sure that the OTP file is loaded and that the value of the first OTP word is non-zero. Then unlock the "Lock" button by checking the "Button Enable" checkbox.

MCU Locking in Autoprogram

The MCU lockout procedure can be invoked as the last step of the Auto Program sequence. In order to lock the processor it is necessary to check the "Lock in Autoprogram" checkbox.

Memory Configuration

Memory configuration is necessary for devices with external flash memory and must be done if .bin or .s19 files are to be written. The .sb files contain memory configuration commands, so it is possible to skip the memory configuration commands.

Setting the memory configuration words

Boot device

Address →

 

Running Configure memory

After setting the Configuration Words in the "Memory Configuration" window and starting Flashloader, you can configure the external memory by clicking the button

Checking memory configuration

The current status of the memory configuration can be displayed in the "Reports" field of the main window. To achieve this, click the button. Then the report will be displayed for the selected target:

Erase Memory

The NXP-flasher allows for whole memory or block erase. Settings of deleting operations are located in "Memory Options" window.

 

For erase to be successful you must:

  • Verify that the connection to the target device was successful.

  • Upload Flashloader

  • Configure memory

  • Set erase range

Read Memory

The memory reading range is defined in the "Memory Options" window.

There are two memory range options to choose from:
User: The user must specify the read starting and ending address.

File: The memory range defines the content and size of the file.

Verify Memory

Memory verification compares the memory contents with a file. Verification includes the memory range defined in "Memory Options".

 

Related content

Windows GUI
Windows GUI
More like this
Flashloader Downloading
Flashloader Downloading
More like this
GangFlasher-N
GangFlasher-N
More like this
USB HID Device scanning
USB HID Device scanning
More like this
1. Getting Started with FP/GP-M DLL
1. Getting Started with FP/GP-M DLL
More like this
1. Introduction
1. Introduction
More like this