1. Flashing Debian

For assistance: contact CTHINGS.CO Support at support.cthings.co.

1.1. Goals

This guide explains how to flash (to eMMC) an Edge IoT Gateway (S) with the CTHINGS.CO Debian image.

1.2. Prerequisites

You will need:

  1. A gateway;

  2. A router or other network setup providing DHCP (ideally with PoE capability if not using the power supply and a working internet connection) and Ethernet cables;

  3. Appropriate Debian image for the device. It is recommended to ask the Embedded team for the latest image;

  4. A quality microSD card (at least 16 GB in size) and a computer and/or dongle to flash it with; and

  5. Tools to disassemble the gateway.

1.3. Steps

1.3.1. Flashing the microSD card

  1. Optionally, it is recommended to validate the SHA256 checksum of the image to ensure that it is not corrupted.

  2. Extract the .zip file containing the Debian image.

  3. Flash the extracted .img file to a microSD card using a software tool such as Etcher.

1.3.2. Configuring the device to boot from microSD

  1. Disassemble the device (four screws are located under the rubber feet).

  2. Insert the microSD card into the slot.

  3. Locate the small array of two DIP switches next to the microSD slot. Both switches must be set to the ON position.

    Note

    There may be a small piece of Kapton tape over the switch from manufacturing — remove and discard it.

    For more information about the possible configurations of the DIP switch array, see the table below:

    Boot Select Switch Configuration

    Boot Source

    Switch 1

    Switch 2

    SD

    ON

    ON

    eMMC

    OFF

    ON

1.3.3. Configuring the microSD card for eMMC flashing

Note

These steps constitute a one-time process necessary for preparing the microSD card for flashing the eMMC on the devices. Once completed, the same microSD card may be used to flash multiple devices if desired.

  1. Power on the device and ensure both the gateway and your computer are on the same network. Ethernet is recommended — Wi-Fi requires manual setup via serial console. Using a PoE router simplifies flashing multiple devices.

  2. Identify the IP address of the device from your router or using an IP scanner.

  3. Establish an SSH connection to the gateway using:

    • Username: ct

    • Password: cthingsco

    You may be prompted to change the default password. This does not affect the flashed image.

  4. Transfer the necessary files required for flashing the device’s eMMC It is recommended to transfer these files to the /home/ct directory using the SFTP or SCP protocol. The easiest way to do this is using software like FileZilla (client), scp, or sftp. This is a list of useful files to transfer:

    • Debian OS image (the same .zip file used to flash the microSD card);

  5. Unzip the Debian OS image on the gateway(filenames may be different if using newer software):

    $ cd /home/ct
    $ sudo apt update -y && sudo apt install -y unzip
    $ unzip cthingsco-edge-gw-s-debian-bookworm-base-20250206.zip
    
  6. At this stage, the microSD card is ready and reusable for flashing multiple devices.

1.3.4. Flashing eMMC

Warning

After flashing the eMMC, the device will always boot from eMMC and no longer to be able to boot from the microSD even if the DIP switch array is set to boot from the microSD. This is because the U-boot in the microSD will attempt to boot from eMMC first (and succeed). If you’d like to know how to override this, contact CTHINGS.CO support.

  1. Run the following commands to flash the eMMC of the device (adjust filenames as needed for your .img and u-boot.bin files). The entire output has been shown for reference:

    $ sudo su
    $ cd /home/ct
    $ echo 0 > /sys/class/block/mmcblk2boot0/force_ro
    $ echo 0 > /sys/class/block/mmcblk2boot1/force_ro
    $ dd if=u-boot.bin of=/dev/mmcblk2boot0 bs=64k oflag=direct
    18+1 records in
    18+1 records out
    1192768 bytes (1.2 MB, 1.1 MiB) copied, 0.0486544 s, 24.5 MB/s
    
    $ dd if=u-boot.bin of=/dev/mmcblk2boot1 bs=64k oflag=direct
    18+1 records in
    18+1 records out
    1192768 bytes (1.2 MB, 1.1 MiB) copied, 0.0422211 s, 28.3 MB/s
    
    $ dd if=cthingsco-edge-gw-s-debian-bookworm-base-20250224.img \
        of=/dev/mmcblk2 bs=64k oflag=direct status=progress
    65536+0 records in
    65536+0 records out
    4294967296 bytes (4.3 GB, 4.0 GiB) copied, 77.0236 s, 55.8 MB/s
    
    $ sync
    
  2. Unplug power (or PoE cable) until the power LED turns off.

  3. Set the DIP switches back to eMMC mode (see table above) and remove the microSD card.

  4. Power the device back on and identify its IP address. Attempt to SSH into the device. You will be asked to change the default password.

  5. Reassemble the device.

Note

To obtain the latest Debian image for Edge IoT Gateway (S), please contact CTHINGS.CO Support at support.cthings.co.