Saturday, October 1, 2022

Windows 10: Flashing Colibri-T20 Iris 1.1B with Linux

 This is more like a scratch-pad than a full guide.

Files that I used:

1) https://docs.toradex.com/103231-tegra-update-tool.zip?v=21

2) https://docs.toradex.com/102307-tegra-wince-image.zip?v=19

3) https://files.toradex.com/Colibri/Linux/Images/Colibri-T20_LXDE-Image_2.8b7.-20200610.tar.bz2

 

First things first: Scan the QR code and keep a note of the serial number. If it's lost due to a failing update you'll have to enter it.

You'll need:

  • PC with Windows 10 with WSL (windows subsystem for linux) or a extra linux computer/vm
  • USB cable (USB to Micro-USB)
  • RS-232 serial port, either build-in or an USB to RS-232 adapter (a serial port adapter with 3.3V or 5V will not work)
  • USB stick (or Micro SD card and a card reader for the PC) with 1 or 2 GB

Optional: Flashing Windows CE (make sure everything works):

On the computer:

  • Connect the USB cable
  • Connect the serial adapter (if there's no build-in serial port)
  • Start a serial terminal, with either (9600 or 115200 baud, 8 data bits, no parity, one stop, no hardware/software flow control). The speed depends on the currently installed bootloader.

A good serial terminal: terminal-s for python (to install: pip install terminal-s). Start it with terminal-s, there's no need to specify the baud rate.

On the micro-controller:

  • Power off 
  • Connect pins 1 and 2 of jumper one, to enter recovery mode
  • Connect the USB cable
  • Connect the serial port X13 to the serial cable (X13.pin3 (RXD) to serial.pin3 (TXD), X13.pin5 (TXD) to serial.pin2 (RXD) and X13.pin9 (GND) to serial.pin9 (GND).
  • Power on

On the computer a new device will be recognized. Install the drivers provided with file (1). Then execute update.bat provided with file (1) and select a config file provided with file (2) to flash Windows CE on the micro-controller. On the serial console you'll see the progress. Now, you might power off, remove the connection at jumper one, and start Windows CE. Flashing works.

Flashing Linux

On the computer:

  • Prepare the USB stick (or Micro SD card) using diskpart
    Note: The filesystem fat is limited to 2 GB, when using a larger stick/card you'll have to adjust the create partition command.
    • start PowerShell (as Adminstrator), then diskpart and execute:
    • list disk
    • select disk [number of the USB stick]
    • convert gtp
    • create partition primary
    • list partition
    • format fs=fat
  • Prepare the linux files for the USB stick (or Micro SD card)
    Note: You might want to use a different folder than the Desktop to copy the files, as you wish.
    • start wsl (I used Ubuntu 20.04 LTS) and execute:
    • su
    • cd /tmp
    • mkdir output
    • wget https://files.toradex.com/Colibri/Linux/Images/Colibri-T20_LXDE-Image_2.8b7.-20200610.tar.bz2
    • tar xjvf Colibri-T20_LXDE-Image_2.8b7.-20200610.tar.bz2
    • cd Colibri-T20_LXDE-Image_2.8.7
    • ./update.sh -o /tmp/output
    • cp -r /tmp/output /mnt/c/Users/[your user name]/Desktop
    • cp ./colibri-t20_bin/u-boot-dtb-tegra.bin /mnt/c/Users/[your user name]/Desktop/
  • Copy the files from the Desktop to the prepared USB stick (or Micro SD card)
  • Copy nvflash.exe provided with (1) to Desktop/colibri-2
    and finally
  • Connect the USB cable
  • Connect the serial adapter (if there's no build-in serial port)
  • Start a serial terminal, with either (9600 or 115200 baud, 8 data bits, no parity, one stop, no hardware/software flow control). The speed depends on the currently installed bootloader.

On the micro-controller:

  • Power off 
  • Connect pins 1 and 2 of jumper one, to enter recovery mode
  • Insert the  USB stick (or Micro SD card) 
  • Connect the USB cable
  • Connect the serial port X13 to the serial cable (X13.pin3 (RXD) to serial.pin3 (TXD), X13.pin5 (TXD) to serial.pin2 (RXD) and X13.pin9 (GND) to serial.pin9 (GND).
  • Power on

On the computer, load the recovery boot block into the microcontroller

  • start PowerShell and execute:
  • cd C:/Users/[your user name]/Desktop/
  • .\nvflash.exe --bct colibri-t20\colibri_t20-256-v11-nand.bct --bl colibri-t20\u-boot-dtb-tegra.bin --go

On the computer, switch to the serial terminal, you might see something like this:

Toradex Flash Loader 2.6 for Tegra Built May  6 2019 17:38:39
DeviceUID: 0x0000000000000000028841C140E09297
WARNING: No PartitionTable Pointer found in BCT
Nand Boot Device
Micron M61A PS:4KB BS:512KB DS:0MB BCH16 ECC
Detecting Memory Size...
256MB RAM
AdjustingBCT: NAND, PageSize=4KB, BlockSize=512KB, RamSize=256MB, isApalis=0, isIT=0
WARNING: Config Block not found at default location
WARNING: Missing MAC Entry
WARNING: Missing HW Entry
WARNING: Missing PROD Entry

If so, first install Windows CE, that will fix the broken bootloader as well.

Or you might see something like this:

Toradex Bootloader 2.4 for Tegra Built Jan  7 2022 14:04:27

Press [SPACE] to enter Bootloader Menu

Colibri T20 256MB 1.1A  Serial: 4754078
RAM: 256 MB, CarveOut: 64 MB
Loading IM1 image from flash...Done(808ms)
Checking Image CRC...OK(46ms)
Decompressing IMAGE(17555884, 33594664) from 8201FD3C to 80016000...Done(374ms)
Jumping to image at 0x80016000...

That's good, all you'll have to do is press the SPACE bar and power-cycle the micro controller to the interactive bootloader menu:

Toradex Bootloader 2.4 for Tegra Built Jan  7 2022 14:04:27

Press [SPACE] to enter Bootloader Menu

BootLoader Configuration:

C) Clear Flash Registry
X) Enter CommandPrompt Mode
D) Download image to RAM now
F) Download image to FLASH now
L) Launch existing flash resident image now

Enter your selection:

 Select x and then execute at the 'Colibri T20 #' prompt:

Colibri T20 # run setupdate
Colibri T20 # run migrate_v2.3b7

Then, again press the SPACE bar and power-cycle the micro controller, to re-enter the interactive bootloader menu. Again, select x and then execute (replace the xxx with your serial number):

Colibri T20 # nand erase.chip
Colibri T20 # cfgblock create
Is the module an IT version? [y/N] y
Enter the module version (e.g. V1.2A): V1.1B
Enter module serial number: 002011000xxxxxxx
Toradex config block successfully written
Colibri T20 # setenv fdt_addr_r 0x01000000
Colibri T20 # saveenv
Colibri T20 # run setupdate
Colibri T20 # run update

On the micro controller:

  • Remove the connection between pins 1 and 2 at jumper one
  • Remove the USB stick (or micro SD card)
  • Connect a DVI (or DVI to HMDI adapter and an HDMI) display
  • Connect an USB hub with keyboard and mouse
  • Connect a network cable to the micro

To login at the serial terminal: username 'root', no password needed.

 

Note: I generated the serial number based on product images from the internet, and modified the first part with try-n-error to my module, because the serial number on my micro controller is not accepted. The second part is taken from my module, that part of the serial number is correct on my module.