Heads up! New Developer Preview programs are rolling out soon. Apply here and be one of the first to try new tools and provide feedback.

Realtek

Ameba D

This example functions as a light bulb device type, with on/off capabilities. The steps were verified on Ameba D board.

Initial setup

  1. Clone the Ameba SDK and check out v1.0-branch:
    mkdir ameba_matter
    cd ameba_matter
    git clone -b v1.0-branch https://github.com/pankore/ambd_sdk_with_chip_non_NDA.git
  2. Clone the connectedhomeip repository and checkout the specific SHA for the Ameba SDK:
    git clone https://github.com/project-chip/connectedhomeip.git
    cd connectedhomeip
    git switch v1.0-branch

Build the images

  1. Make sure you have the folder structure like so:
    ameba_matter/
    ├── ambd_sdk_with_chip_non_NDA
    └── connectedhomeip
  2. Initialize the connectedhomeiprepo:
    git submodule update --init --recursive
    source scripts/activate.sh
  3. Build the lighting-app
    $PWD/../ambd_sdk_with_chip_non_NDA/project/realtek_amebaD_va0_example/GCC-RELEASE/build.sh $PWD ninja $PWD/out lighting-app
    cd out ; ninja
    1. The output of the build is found at:
      connectedhomeip/out/asdk/image/km0_km4_image2.bin

Flash the board

Set up the Ameba D hardware as shown in the diagram:

image

  1. Go to the appropriate ImageTool directory for your computer. ImageTool is used for flashing the example to your board. All ImageTool versions are located at ambd_sdk_with_chip_non_NDA/tools/AmebaD/:
    OS ImageTool location
    Linux /Image_Tool_Linux/AmebaD_ImageTool
    MacOS 10.X /Image_Tool_MacOS/MacOS_v10/Ameba_1-10_MP_ImageTool_MacOS
    MacOS 11 /Image_Tool_MacOS/MacOS_v11/Ameba_1-10_MP_ImageTool_MacOS11
  2. For Linux, go to the /Image_Tool_Linux/AmebaD_ImageTool directory:
    cd ../../ambd_sdk_with_chip_non_NDA/tools/AmebaD/Image_Tool_Linux/
    1. Change the tool permissions if needed. For example, on Linux:
      chmod +x AmebaD_ImageTool
    2. Check the tool usage:
      ./AmebaD_ImageTool -help
  3. Flash the image to the Ameba D board. Connect the Micro-B USB to the board and connect the other side to the PC. Check the UART port and modify it if the UART port is not assigned to /dev/ttyUSB0:
    ./AmebaD_ImageTool -add device /dev/ttyUSB0
    command finish
    total device to add 1
    /dev/ttyUSB0 existed
  4. Copy the three Ameba D images you built earlier to the current directory (where ImageTool is):
    cp ../../../../connectedhomeip/out/asdk/bootloader/km0_boot_all.bin ./
    cp ../../../../connectedhomeip/out/asdk/bootloader/km4_boot_all.bin ./
    cp ../../../../connectedhomeip/out/asdk/image/km0_km4_image2.bin ./
  5. Combine the three images to generate Image_all.bin:
    ./AmebaD_ImageTool -combine km0_boot_all.bin 0x0000 km4_boot_all.bin 0x4000 km0_km4_image2.bin 0x6000
    command finish
    Combine Image Success
  6. Verify that the final setting has been set:
    ./AmebaD_ImageTool -show
    command finish
    Current Settings
    CPU      : AmebaD
    UART     : 1500000 bps parity:N flow control:False
    FW NAME  : Image_All.bin
    FW ADDR  : 0x08000000
    FW LEN   : 0
    OPTS     : keep data    :   True
           keep wifi cal:   True
           verification :   False
           reset device :   False
           factory mode :   False
           save log     :   True
    Port Settings
    PORT 0: active:True device:/dev/ttyUSB0
    PORT 1: active:False device:NONE
    PORT 2: active:False device:NONE
    PORT 3: active:False device:NONE
    PORT 4: active:False device:NONE
    PORT 5: active:False device:NONE
    PORT 6: active:False device:NONE
    PORT 7: active:False device:NONE
    PORT 8: active:False device:NONE
    PORT 9: active:False device:NONE
  7. On the Ameba D board, hold the UART_DOWNLOAD button and press the RESET button, then release the UART_DOWNLOAD button to enter the download mode.
  8. Flash the image to the Ameba D board:
    ./AmebaD_ImageTool -download
    log file = log_2021_11_15_23_42_10.txt
    [100, 0, 0, 0, 0, 0, 0, 0, 0, 0]command finish
    
    status: ['OK 53.0s', 'Check PORT', 'Off', 'Off', 'Off', 'Off', 'Off', 'Off', 'Off', 'Off']
    close log file

Reset the board

  1. Press the RESET button on the board to reboot the system.
  2. Open a serial console to the board with minicom or screen. For example, if the device is at /dev/ttyUSB0:
    screen /dev/ttyUSB0 115200
  3. If the Ameba D board has been paired before, it's recommended that you factory reset it before continuing. Enter ATS# in the console to do so:
    #
    ATS#
    xPortGetTotalHeapSize = 204800
    xPortGetFreeHeapSize = 104512
    xPortGetMinimumEverFreeHeapSize = 98176
    _[dct_init_valid_module]: erase flash address 0x001ec00

LED wiring

If you want to light an LED using the board, please connect the long leg of the LED (the positive leg) to B5 and connect the short leg of the LED (the negative leg) to GND. If your LED has no built-in resistor, a 220 ohm resistor must be connected between the LED and B5.

image

Next steps

When your Matter example has been successfully built, create a developer project.