Skip to content

Instantly share code, notes, and snippets.

@billyargh
Last active November 17, 2024 02:19
Show Gist options
  • Save billyargh/945616a654aee25d657beb1278a604d9 to your computer and use it in GitHub Desktop.
Save billyargh/945616a654aee25d657beb1278a604d9 to your computer and use it in GitHub Desktop.

Resurrecting NTC C.H.I.P. computers

Introduction

I bought four of the Next Thing Co. (defunct since 2018) C.H.I.P. (CHIP hereafter) computers shortly after their successful Kickstarter campaign of 2015. The CHIP computer is an interesting beast. It was positioned as a competitor the orginal Raspberry Pi and only cost US$8.00 before shipping. The Raspberry Pi cost US$25 at the time. The CHIP had some features that the Pi did not at the time including built-in wi-fi and battery charging. It was also considerably smaller the original Pi.

The CHIP was shipped with Debian 8 (Jessie) and was a capable Linux computer. I had big plans for all of them, but the using one of them as an ad-blocking Pi-Hole was as far as I got. It worked well for that.

The other have been sitting idle for a few years and I thought it would be fun to put them back to use. I've started thinking about doing more IoT stuff, and these little guys are going to help me do it.

One of the four CHIPs is in a PocketCHIP shell/chassis/case which makes it a pretty cool handheld computer if you can get used to its keyboard. I think that this will be nice for remote control and monitoring of IoT gadgets. I have an HDMI "dip" that will allow me to connect one of them to a monitor as a desktop computer. The other two will be put to some sort of IoT "stuff".

Because it's been so long since I used them, I decided to flash them to their initial states and start again. The goal for the PocketCHIP is to bring it up to the latest version of Jessie, because I didn't want to break the Pocket Home interface, the goal for the HDMI CHIP is the same because I don't want to break the desktop (at least for now), and the goal for the other to machines is to make them headless servers running Debian 11 (bullseye). I will also be adding software that I frequently use to all of them.

Please note that the procedures documented here are time consuming, and that it is a PITA to start again from the flashing step.

Flashing

Unlike the Raspberry Pi which uses an SD Card to carry its operating system, the CHIP carries its operating system on onboard NAND memory, which requires the OS to be flashed. Of course nothing is available officially from NTC, but fortunately JF Possiblities created mirrors of the the information (including flashable system images) from NTC's long dead web site. Thank you to the person/people at JF Possibilities for doing this.

There are a number of web pages that try to explain how to flash the CHIP with a fresh system. I believe I tried all of the options and failed, until I installed Ubuntu 18.04 on an old laptop. Once I did this, the script on Thore Krug's github worked flawlessly (almost). I needed to install the pocketCHIP image to one of the CHIPs, the desktop image to another, and the headless server image to the two remaining CHIPs. I say "flawlessly (almost)" because I discovered one needs patience and perserverance to succeed. Sometimes flashing would fail, and I would diconnect the CHIP from USB, make sure that the connection between FEL and GND was correct, and try again. For one of the CHIPs, it took six attempts to

  1. Before you do any of the below, make sure that the computer you are flashing from is running Ubuntu 18.04 natively. Lorenz74 says in a comment below that they were able to do this on Ubuntu 22.10 by 'removing from the CHIP-tools scripts files the two strings “-i 0x1f3a” “-u”' in 'the files chip-fel-flash.sh, chip-flash, common.sh.' I haven't tried this.

To save the readers a click, the instructions from Thore Krug are duplicated here.

  1. Remove the CHIP from its case (in case you have a PocketCHIP).
  2. Connect the FEL and a GROUND pin of the CHIP (for example, with a paperclip).
  3. Connect the CHIP's micro USB port to a USB port of your Linux machine.
  4. In the Linux machine:
    • run git clone https://github.com/thore-krug/Flash-CHIP.git to clone this repository.
    • cd into the location where you stored this repository.
    • run sudo chmod +x Flash.sh
    • run ./Flash.sh
    • Select the version you want to install.
    • Wait until the installation finishes.
    • Enjoy!

At the end of all of this, the CHIP is a bootable Debian 8 (jessie) machine. The next step is to update to Debian jessie and set up the CHIPs as ssh servers.

Update to latest release of Debian 8 (jessie)

The instructions below are for headless server and desktop CHIPs. See below for PocketCHIP.

  1. Remove the FEL-GND jumper and unplug the CHIP to shut it down. Reconnect the CHIP to the Ubuntu 18.04 machine (a real one, not virtual!) through USB.
    Your CHIP should reboot, and should be ready after a minute or two.
    If the LEDs are not flashing, the CHIP is not yet ready for the next step.
    If they are flashing, wait another minute :). It takes a fairly long time for the CHIP to boot.
  2. Open a terminal on the Ubuntu machine and type screen /dev/ttyACM0 at the prompt. This creates a serial connection between the terminal and CHIP.
  3. If you see a login prompt, great. Login with user chip and password chip. Remember to change the password later. If you don't get a password prompt right away, try pressing some keys a few times. I suspect there are keys that should be pressed. I tried Ctl-A, Ctl-B, return, I didn't notice which of them worked :) If this fails, unplug the CHIP, plug it back in, and retry.
  4. Connect the CHIP to wi-fi. I did this using sudo nmtui and selecting the appropriate access point using the correct password. After you've connected to wi-fi and exited nmtui, you can sudo nmtui again to change the hostname of your CHIP from chip, if you want. It's a really good idea to do this if you're working with multiple CHIPs. Exit nmtui.
  5. Note the IP address for your CHIP with ip addr. We will use this to log in the to CHIP with ssh later. Mine was 10.0.0.128. Yours will probably be different and will likely start with 192.168.
  6. Update your apt sources with sudo nano /etc/apt/sources.list. It should like this after your edits.
deb http://archive.debian.org/debian/ jessie main contrib non-free
deb-src http://archive.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

deb http://chip.jfpossibilities.com/chip/debian/repo jessie main
deb http://chip.jfpossibilities.com/chip/debian/pocketchip jessie main

Note that the references to opensource.nextthing.co have been replaced by chip.jfpossibilities.com. Thanks again to JF Possibilities.

  1. Update your sources with sudo apt update. This will take a while, and may seem to be stuck. Be patient.

  2. Install the openssh server and keyrings with

sudo apt install openssh-server debian-keyring debian-archive-keyring

This will allow us to connect to the CHIP with ssh which I prefer to screen.
I prefer emacs to nano, so I also installed emacs at this stage using this command instead.

sudo apt install openssh-server debian-keyring debian-archive-keyring emacs-nox

This takes some time.

  1. Shutdown the CHIP with sudo shutdown now, unplug it from USB, plug it back in, and wait patiently for in to reboot.

  2. Connect to CHIP from an Ubuntu terminal with ssh [email protected], using your own CHIP's IP address, of course. Login with user chip and password chip.

  3. Update CHIP to the latest version of Debian 8 (jessie) with sudo apt upgrade. Note that we did sudo apt update in a previous step. It is possible that you do not need to do this step if you're upgrading to Debian 9 (stretch) or later.

  4. Something weird seems to happen to wi-fi with the upgrade. If you edit /etc/NetworkManager/NetworkManager.conf to the following, you should be OK when you reboot the CHIP.

[main]
plugins=ifupdown,keyfile

[connection]
wifi.mac-address-randomization=1

[device]
wifi.scan-rand-mac-address=no

[ifupdown]
managed=false

[keyfile]
unmanaged-devices=interface-name:wlan1
  1. Wait a long time, for sudo shutdown now, unplug and replug CHIP, wait for it to boot, and ssh [email protected] again. You now have a CHIP running the latest Debian 8 (jessie). I stopped at this point for my pocketCHIP and HDMI CHIP. I probably with never update the pocketCHIP to a newer version of Debian. I may update the HDMI CHIP at some later time.

For PocketCHIP, do step 1 and then put the CHIP back into its shell/chassis/case, and go to the terminal app. Skip step 2. Steps 3 through 9 are done on the PocketCHIP itself, not through screen /dev/ttyACM0. When I tried using screen for the PocketCHIP, it would disconnect before I could accomplish anything useful. Perhaps screen will work for you. I hope so, because typing on the PocketCHIP is a little awkward.

Updating to Debian 9 (stretch), 10 (buster), and 11 (bullseye)

I don't plan to use my headless CHIPs with any sort of GUI, so I decided to update them to the current version of Debian. I did this by updating jessie to stretch, then from stretch to buster, and then from buster to bullseye. From here I assume that you can ssh into your CHIP.

From jessie to stretch

  1. Edit /etc/apt.sources.list to look like the following.
deb http://deb.debian.org/debian/ stretch main contrib non-free
deb-src http://deb.debian.org/debian/ stretch main contrib non-free

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free

Note that all occurences of jessie were replaced with stretch and the lines referencing chip.jfpossilities.com were deleted.

  1. Do a full upgrade with sudo apt update && sudo apt full-upgrade. I responded 'yes' to prompts asking if I wanted to restart services, and 'no' to prompts asking if I wanted to replace configuration files.

  2. Shutdown and reboot.

From stretch to buster

Repeat the above replacing stretch with buster.

From buster to bullseye

Repeat the above steps by replacing buster with bullseye.

PocketCHIP customization

I am now running a PocketCHIP with the most current version of Debian 8 (jessie). That's really outdated, but will work for me. I found a blog post from Steve McGrath describing how he set up his PocketCHIP in 2016. There are some very good ideas there:

  • disabling the SSH server from starting automatically is better for security than leaving it on all the time
  • aliases are very helpful if you use a small keyboard like that on the pocketCHIP
  • dwm seems to be a suitable web browser for the pocketCHIP. !!!TODO!!! write some more about how to get this running.
  • a reminder that Pocket Home settings can be set by editing /usr/share/pocket-home/config.json

The best reason to use PocketCHIP is the fantastic gaming platform PICO-8. Version 0.2.5e of this software can be downloaded from the developer, Lexaloffle. You will need to edit the Pocket Home settings to access this from the home screen.

Some of the CLI based games are a lot of fun. You can install the ones I did with

sudo apt install bsdgames nethack-console pacman4console nsnake moon-buggy ninvaders greed

I particularly enjoy adventure, nethack, and greed. Have fun.

Credits

I borrowed heavily from luzhuomi when doing this. His instructions seem to indicate a successful upgrade of the PocketCHIP to Debian 10 (buster), but when I tried it, I lost the Pocket Home interface. Debian 11 seems to work fine on the PocketCHIP for me when I followed the headless server instructions, but the interface was just a dumb terminal. You might have better luck.

@Lorenz74
Copy link

Lorenz74 commented Jan 15, 2023

Is a real machine. Ubuntu 22.10. Anyway yesterday 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. It seems that those fastboot options are not needed and blocks the flash process. So in the end all worked fine.

@billyargh
Copy link
Author

billyargh commented Jan 15, 2023

Cool. Glad you figured it out. My solution was to install 18.04 on an old laptop. Your solution is more elegant.

@liquiddandruff
Copy link

liquiddandruff commented Apr 9, 2023

Thanks for the writeup!!

One of my CHIPs had a corrupt /etc/group so I hacked around for it to go through with the full-upgrade to Debian 9.

The upgrade went through but unfortunately I hit permission denied errors after reboot. ssh into chip/root both failed with permission denied errors, and usb uart login returned permission denied immediately on login attempt. I see the banner changed to Debian 9 so the upgrade mostly worked.

Well, time to reflash and try the upgrade again 😅

edit: I went through the process using USB passthrough on WSL2 on Windows. Everything worked up till the fastboot stage, then Windows wasn't able to know what drivers to use (it kept showing up as "USB download gadget" even after trying several other drivers).

On my second attempt (now with an M2 Mac Air) I went through with https://github.com/Thore-Krug/Install-Flash-Chip-Mac . Everything mostly was straightforward but I hit the same '-i' unrecognized flag issue as earlier. Removing -i and -u helped but the script got stuck at wait_for_fastboot--it didn't quit the loop even though fastboot devices showed the devices.

So I CTRL+C'd the script and then ran the command manually:

$ sudo fastboot flash UBI Chip-tools-Mac/.new/firmware/images/chip-400000-4000-500.ubi.sparse
Sending sparse 'UBI' 1/11 (28672 KB)        OKAY [   1.961s]
....
Finished. Total time: 185.855s

Then I powercycled the CHIP with the FEL removed and it booted!

Thanks again for putting this all together!!!

@BoWalka
Copy link

BoWalka commented Nov 17, 2024

I know this is an old thread but this was my problem I had the wrong version of fastboot.
https://dl.google.com/android/repository/platform-tools_r26.0.0-linux.zip
Once you download and extract the file, just back up the old fastboot folder, move it and replace it with the new fastboot.

from this blog post
https://www.suramya.com/blog/2023/08/getting-my-pocket-c-h-i-p-to-finally-work/comment-page-1/

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