Skip to content

Instantly share code, notes, and snippets.

@verticalgrain
Last active April 10, 2024 09:47
Show Gist options
  • Save verticalgrain/deae2821213a891747e08e2d6492808a to your computer and use it in GitHub Desktop.
Save verticalgrain/deae2821213a891747e08e2d6492808a to your computer and use it in GitHub Desktop.
NextThingCo C.H.I.P. Flashing guide as of November, 2018

Below are the steps required to flash a NextThingCo CHIP or PocketCHIP from the command line, as of November 2018. The web flasher no longer works, and there are numerous errors when flashing from the command line, mostly due to broken dependencies. The following method works for flashing a CHIP as of November 2018:

Note: Flashing must be done on Linux. Tested on Ubuntu and Rasparian. Mac OS seems to not work.

  1. Download and unpack the CHIP-SDK.zip from one of the following:
  1. Download and unpack CHIP-tools.zip from one of the following:
  1. Move the CHIP-tools directory inside CHIP-SDK directory (CHIP-SDK/CHIP-tools).

  2. Download the a CHIP image from one of the following:

Unzip it (if necessary) and move the desired image into the CHIP-SDK directory. In my case since I'm flashing the Pocketchip I used the stable-pocketchip-b128 image and I put it at CHIP-SDK/stable-pocketchip-b128.

  1. Navigate to the CHIP-SDK directory in terminal and run the build script: ./setup_ubuntu1404.sh The build script should run. Multiple errors will be shown, including a fatal error when the script tries to get the CHIP-tools from a non-existant repo. This can be ignored since we already downloaded the CHIP-tools directory in step 2.

  2. Put your CHIP in FEL mode by putting a jumper wire between GND and FEL. Connect the CHIP to your computer with USB (using the microUSB port on the CHIP, not the fullsize USB port).

  3. Navigate to the CHIP-tools directory in terminal at CHIP-SDK/CHIP-tools and run the update firmware script. Use the -L option to explicitly specify the firmware versions from the flash-collection directory: ./chip-update-firmware.sh -L ../stable-pocketchip-b128

References:

@Lorenz74
Copy link

I followed the instruction but I receive the following error:

$ ./chip-update-firmware.sh -L ../stable-server-b149
== Local directory '../stable-server-b149' selected ==
== preparing images ==
== Local/cached probe files located ==
== Staging for NAND probe ==
Image Name: detect NAND
Created: Fri Jan 13 19:12:37 2023
Image Type: ARM Linux Script (uncompressed)
Data Size: 97 Bytes = 0.09 KiB = 0.00 MiB
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 89 Bytes = 0.09 KiB = 0.00 MiB
waiting for fel...OK
waiting for fel.....OK
NAND detected:
nand_erasesize=400000
nand_oobsize=500
nand_writesize=4000
== Cached UBI located ==
Image Name: flash server
Created: Fri Jan 13 19:12:45 2023
Image Type: ARM Linux Script (uncompressed)
Data Size: 1784 Bytes = 1.74 KiB = 0.00 MiB
Load Address: 00000000
Entry Point: 00000000
Contents:
Image 0: 1776 Bytes = 1.73 KiB = 0.00 MiB
waiting for fel...OK
waiting for fastboot...fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.fastboot: invalid option -- 'i'
.TIMEOUT
failed to flash the UBI image

FLASH VERIFICATION FAILED.

TROUBLESHOOTING:

Is the FEL pin connected to GND?
Have you tried turning it off and turning it on again?
Did you run the setup script in CHIP-SDK?
Download could be corrupt, it can be re-downloaded by adding the '-f' flag

There is a solution ?

@Lorenz74
Copy link

Lorenz74 commented Jan 14, 2023

I solved the issue removing from the CHIP-tools scripts files the two strings “-i 0x1f3a” “-u”. The three files I edited are: chip-fel-flash.sh, chip-flash, common.sh.

@Alexander323Ch
Copy link

Resolví el problema eliminando de los archivos de scripts de CHIP-tools las dos cadenas "-i 0x1f3a" "-u". Los tres archivos que edité son: chip-fel-flash.sh, chip-flash, common.sh.

I am stuck in the same error as you modified them ?

@Lorenz74
Copy link

Simply with a text editor. Open the files search for the strings “-i 0x1f3a” “-u” and delete it.

@Alexander323Ch
Copy link

Just what you mention or do you have to delete more?

@Alexander323Ch
Copy link

and in which file do you do it, I need to flash my CHIP but it is having a hard time

@Lorenz74
Copy link

only this two string in the three files: chip-fel-flash.sh, chip-flash, common.sh.

@Alexander323Ch
Copy link

Perfect I just have to delete the following -i 0x1f3a
and also u

@Vashiru
Copy link

Vashiru commented Feb 19, 2023

@Alexander323Ch @Lorenz74 The coincidence of this conversation going on the day I decide to look into flashing one myself. Which OS did you attempt this on exactly?

@Alexander323Ch
Copy link

I am trying to flash the chip in ubuntu in its most current version

@Alexander323Ch
Copy link

and currently they do not work for me in the git clone method https://github.com/thore-krug/Flash-CHIP.git

@Alexander323Ch
Copy link

In that method it shows me errors such as time out or the most common one that is invalid option "i"

@Alexander323Ch
Copy link

can someone help me i'm giving up on this and i'm new to this world

@Lorenz74
Copy link

Lorenz74 commented Feb 20, 2023

Hi...below the instructions, this works also on current Ubuntu Version (the step 8 is the one that allow to flash NTC CHIP also on the most updated Ubuntu versions).

Below are the steps required to flash a NextThingCo CHIP or PocketCHIP from the command line, as of January 2023 (Ubuntu 22.10 Tested). The web flasher no longer works, and there are numerous errors when flashing from the command line, mostly due to broken dependencies. The following method works for flashing a CHIP as of January 2023:

Note: Flashing must be done on Linux. Tested on Ubuntu.

  1. Download and unpack the CHIP-SDK.zip from one of the following:
  1. Download and unpack CHIP-tools.zip from one of the following:
  1. Move the CHIP-tools directory inside CHIP-SDK directory (CHIP-SDK/CHIP-tools).

  2. Download a CHIP image from one of the following:

Unzip it (if necessary) and move the desired image into the CHIP-SDK directory. In my case since I'm flashing the NTC CHIP I used the stable-server-b149 image and I put it at CHIP-SDK/stable-server-b149.

  1. Navigate to the CHIP-SDK directory in terminal and run the build script: ./setup_ubuntu1404.sh The build script should run. Multiple errors will be shown, including a fatal error when the script tries to get the CHIP-tools from a non-existant repo. This can be ignored since we already downloaded the CHIP-tools directory in step 2.

  2. Put your CHIP in FEL mode by putting a jumper wire between GND and FEL. (see image below)
    https://ksr-ugc.imgix.net/assets/005/256/895/d2cdca49fbc785b4f636bedaf96b383d_original.jpg?w=639&fit=max&v=1453875954&auto=format&q=92&s=bff8004fdbb40a01bf0a5e675b8d1641

  3. Connect the CHIP to your computer with USB (using the microUSB port on the CHIP, not the fullsize USB port).

  4. Navigate to directory CHIP-SDK/CHIP-tools. Open with text editor the following files chip-fel-flash.sh, chip-flash, common.sh and remove the strings “-i 0x1f3a” and “-u”. Save the edited files.

  5. Navigate to the CHIP-tools directory in terminal at CHIP-SDK/CHIP-tools and run the update firmware script. Use the -L option to explicitly specify the firmware versions from the flash-collection directory: “sudo ./chip-update-firmware.sh -L ../stable-server-b149”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment