LX2160ARDB – How to update composite firmware in FlexSPI NOR Flash and SD/eMMC card using an SD card

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LX2160ARDB – How to update composite firmware in FlexSPI NOR Flash and SD/eMMC card using an SD card

LX2160ARDB – How to update composite firmware in FlexSPI NOR Flash and SD/eMMC card using an SD card

 

The below steps are used to update composite firmware image in FlexSPI NOR flash and SD/eMMC card using an SD card.

  1. Load composite firmware image on SD card
    • Option 1: Using HxD editor on Windows system
    • Option 2: Using Linux system
  2. Program updated composite firmware in SD card
  3. Program updated composite firmware in FlexSPI NOR flash (DEV#0 and DEV#1)
  4. Program updated composite firmware in eMMC card

NOTE: Examples shown below use the LX2160ARDB Rev 2 image names. The same examples are applicable for LX2160ARDB Rev 1 also by replacing the Rev 2 image name with the corresponding Rev 1 image name.

Step 1: Load composite firmware image in SD card

Option 1: Using HxD editor on Windows system

The below steps describe how to use an HxD editor on a Windows machine to program firmware image on SD card without partitioning the card.

NOTE: Use the following link to download the HxD editor for Windows: https://mh-nexus.de/en/hxd/.

  1. Download composite firmware image on Windows machine using the following links:
  2. Format SD card.
  3. Open HxD editor and run as administrator.
  4. Open firmware_lx2160ardb_rev2_uboot_sdboot.img binary file in HxD editor.
  5. Copy the binary file (CTRL + A and CTRL + C).
  6. Plug the SD card either directly into the slot available on your Windows machine or using a memory card adapter/reader.
  7. Open disk (SHIFT + CTRL +D).

    Open diskOpen disk NOTE: Uncheck the 'Open as Readonly' option while opening the disk.

  8. Go to SD block (or sector) 8 (0x1000).

    HxD Editor - Sector 8HxD Editor - Sector 8

  9. Paste the copied binary image content (CTRL + B). Make sure to copy the image at SD block no. 8.
  10. Save the content.
  11. Repeat above steps to load firmware_lx2160ardb_rev2_uboot_xspiboot.img and firmware_lx2160ardb_rev2_uboot_emmcboot.img binary image in SD card.

    For example: Load firmware_lx2160ardb_rev2_uboot_xspiboot.img image in SD card at block no. 150500 and firmware_lx2160ardb_rev2_uboot_emmcboot.img image in SD card at block no. 300500.

    NOTE: Make sure that you load these images in SD blocks so that the images do not get overwrite.

  12. Eject the SD card.

Option 2: Using Linux system

  1. Download composite firmware image on Linux machine using the following links:
  2. Format SD card (optional, required if the card already has some data so to ensure that images have been loaded to card without conflicting with the existing data).

  3. Load composite firmware image to SD card.
    • For SD boot: dd if=firmware_lx2160ardb_rev2_uboot_sdboot.img of=/dev/sdb bs=512 seek=8
    • For FlexSPI boot: dd if=firmware_lx2160ardb_rev2_uboot_xspiboot.img of=/dev/sdb bs=512 seek=150500
    • For eMMC boot: dd if=firmware_lx2160ardb_rev2_uboot_emmcboot.img of=/dev/sdb bs=512 seek=300500
  4. Eject the SD card.

Step 2: Program updated composite firmware in SD card

NOTE: Since the updated composite firmware is now available at required block (SD start block no. in SD card, therefore, you can boot the board using SD card using following steps.

  1. Insert the SD card in SD slot of LX2160ARDB.
  2. Set switch settings to boot from SD card : SW1[1:4] = 1000 
  3. Restart the board.

The board boots from updated composite firmware (SD boot) image loaded in the SD card. The U-Boot log displays:

Model: NXP Layerscape LX2160ARDB Board

Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from SD

Step 3: Program updated composite firmware in FlexSPI NOR flash (DEV#0 and DEV#1)

  1. Insert the SD card in SD slot of LX2160ARDB.
  2. Set switch settings to boot from SD card=> SW1[1:4] = 1000
  3. Restart the board and stop at U-Boot prompt.
  4. Load firmware_lx2160ardb_rev2_uboot_xspiboot.img at 0xa0000000 (DDR address) using the following command:

    => mmc read 0xa0000000 <start_block_number> <block_count>

    where, <start_block_number> - start block number in SD card where you have loaded the firmware. For example, if you have loaded firmware at SD card block 150500, start_block_number in hex is 24be4

    <block_count> - number of blocks in SD card that needs to be read as per the file size. It is calculated as ‘file size /512’ + ‘few sectors for rounding up so that last block is not missed’. If firmware file size is 52158124 (31bdeac hex), block_count is 52158124/512 = 101871 (18DEF hex) + 10 (A hex) = 101881 (18DF9 hex).

    For example: => mmc read 0xa0000000 24be4 18DF9

  5. Program default FlexSPI NOR flash:

    =>sf probe 0:0

    =>sf update 0xa0000000 0x0 <firmware_lx2160ardb_rev2_uboot_xspiboot.img _filesize_in_hex>

    For example: => sf update 0xa0000000 0x0 31BDEAC   

  6. Program alternate FlexSPI NOR flash:

    => sf probe 0:1

    => sf update 0xa0000000 0x0 <firmware_lx2160ardb_rev2_uboot_xspiboot.img _filesize_in_hex> 

  7. Restart the board to boot from FlexSPI NOR flash 0 (DEV#0).
    • Switch settings to boot from DEV#0: SW1[1:8] = 1111 1000
    • The U-Boot log shows the following message:

      Model: NXP Layerscape LX2160ARDB Board

      Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#0

  8. Restart the board to boot from FlexSPI NOR flash 1 (DEV#1) as well.
    • Switch settings to boot from DEV#1
      • SW1[1:4] = 1111 1001 

The U-Boot log shows the following message:

Model: NXP Layerscape LX2160ARDB Board

Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from FlexSPI DEV#1

Step 4: Program updated composite firmware in eMMC card

  1. Insert the SD card in SD slot of LX2160ARDB.
  2. Set switch settings to boot from SD card: SW1[1:4] = 1000
  3. Restart the board and stop at U-Boot prompt.
  4. Load firmware_lx2160ardb_rev2_uboot_emmcboot.img at 0xa0000000 (DDR address) using the following command:

    => mmc dev 0; mmc read 0xa0000000 <start_block_number> <block_count>

    where, <start_block_number> - start block number in SD card where you have loaded the firmware. For example, if you have loaded firmware at SD card block 300500, start_block_number in hex is 495D4

    <block_count> - number of blocks in SD card that needs to be read as per the file size. It is calculated as ‘file size /512’ + ‘few sectors for rounding up so that last block is not missed’. If firmware file size is 52158124 (31bdeac hex), block_count is 52158124/512 = 101871 (18DEF hex) + 10 (A hex) = 101881 (18DF9 hex).

    For example: => mmc read 0xa000000 495D4 18DF9

  5. Program eMMC card.

    => mmc dev 1; mmc write 0xa0000000 8 18DF9

  6. Restart the board to boot from eMMC.

Set switch settings to boot from eMMC card.

SW1[1:8] = 1001 1000

The U-Boot log shows the following message:

Model: NXP Layerscape LX2160ARDB Board

Board: LX2160ACE Rev2.0-RDB, Board version: B, boot from eMMC

Comments

Hi Thanks a lot for all the explanation

 

Booting under SD works fine !

- I have used this link

       wget https://www.nxp.com/lgfiles/sdk/lsdk2012/firmware_lx2160ardb_rev2_uboot_sdboot.img

- copy file under USB key

- format SD under FAT32

- copy Uboot binary under the SD card, from linux (under USB key device): first 8x512 bytes are skipped

       dd if=firmware_lx2160ardb_rev2_uboot_sdboot.img of=/dev/sdb bs=512 seek=8

- put SD under board, boot from SD works fine !

     I can see : 

    U-Boot 2020.04-gf46a944f71 (Dec 11 2020 - 04:35:59 +0800)

After that I have tried to update XSPI device : 

so I have used the corresponding link :  

      wget https://www.nxp.com/lgfiles/sdk/lsdk2012/firmware_lx2160ardb_rev2_uboot_xspiboot.img

using same USB key device, from linux

copy the binary under SD card at an offset 150500 block of 512 bytes :

        dd if=firmware_lx2160ardb_rev2_uboot_xspiboot.img of=/dev/sdb bs=512 seek=150500

I check the size of binary data  (under USB key)
         size memory of firmware_lx2160ardb_rev2_uboot_xspiboot.img = 52.531.420 bytes (=32190DC)

So I have then typed this command, from uboot (as well launched previously from SD card)

mmc read 0xa0000000 24be4 190d2
(offset of 150500 blocks of 512 octets -> 150500 => 0x24be4)
(190d2 as 52.531.420 bytes/512 = 102600 => 0x190C8, and I add 10 blocs (+0x0a) => 0x190d2


Outpu Results :

MMC read: dev # 0, block # 150500, count 102610 ... 102610 blocks read: OK

And Just to finish to write into the NorFlash "Bank 0"

=> sf probe 0:0
SF: Detected mt35xu512aba with page size 256 Bytes, erase size 128 KiB, total 64 MiB


=> sf erase 0 +32190DC
SF: 52559872 bytes @ 0x0 Erased: OK
=> sf write 0xa0000000 0x0 32190DC
device 0 offset 0x0, size 0x32190dc
SF: 52531420 bytes @ 0x0 Written: OK

So XSPI erase+write seems OK but when I try to boot on XSPI BANK 0

DEL 19 is lighed, FAN is running a lot ???? and nothing is written ou serial console  : the Uboot is not correctly launched, why ?

 

If someone has an idea how to write correctly on XSPI BANK 0 from uboot shell ?

If I missed something ? I don't see a mistake ....

 

Thanks for any help

 

VBR

Thierry LOUSSOT

No ratings
Version history
Last update:
‎04-20-2021 12:06 AM
Updated by: