This document explains how to set up a Linux environment, build the sdk_app_helloworld application, flash it to the BL602 and verify the output through a serial port reader.
2.1. Installing prerequisites and cloning repository¶
The project requires a C/C++ compiler, Python 3 interpreter, Python package manager (pip), make, git and a serial port reader (screen is used).
First, set BL60X_SDK_PATH to the location of the pine64/bl_iot_sdk repository.
Next, set CONFIG_CHIP_NAME to the make of the chip in this case BL602.
If the repository is already cloned, pwd can be used to correctly set the environment variable:
In order to build all example projects write make in the project directory.
In order to build only a single example go to the directory of the example and write make.
In order to build sdk_app_helloworld:
cdcustomer_app/sdk_app_helloworld
make
Build artifacts will be located in the build_out folder in each example.
Change into the output of the example you want to flash and ensure that the .bin file exists:
Download the latest blflash version and chmod it to be executable:
chmod+xblflash*
Alternatively it is available from the Arch User Repository: blflash for the latest release and blflash-git for the latest commit.
Invoke the blflash binary with the flash<project_name>.bin--port<port> arguments.
If the board is connected via USB and no other devices are connected the port is likely going to be /dev/ttyUSB0.
If in doubt, get a list of USB ports with ls-la/dev/|grepUSB.
If you do not have any such device, ensure your kernel has the ch341 driver enabled.
Boufallo Lab has their own proprietary flashing program.
It can be found by at their official site.
If a login page is reached, click the button labeled “Dev Zone”.
Extract the .zip file and execute BLDevCube.
Select BL602/604 as the ChipType and click Finish.
Notice that the application might be very slow after clicking Finish.
Set the application up as shown in the image below:
Important settings are:
Change the jumper on IO8 to cover L and press the reset button.
Open screen with a baud rate of 2000000 (two million) and the same port used in Flashing.
screen/dev/ttyUSB02000000
The terminal should be blank.
If you’re being spammed with unknown symbols change jumper pin IO8 to L and press RESET.
After pressing RESET the following should be in the terminal: