- 本<泰凌微ble mesh藍牙模組天貓精靈學習之旅>系列博客學習由半顆心臟 潛心所力所寫,僅僅做個人技術交流分享,不做任何商業用途。如有不對之處,請留言,本人及時更改。
1、小白也痴迷,如何在 Linux環境搭建編譯燒錄 安信可TB02,點亮一盞LED燈;
2、如何實現 微信小程序藍牙控制 Ble Mesh模組 安信可TB02,全部開源!
3、簡單入門安信可TB-02開發開發板輕松接入天貓精靈,語音控制冷暖燈so easy!
4、如何在Android開發低功耗藍牙ble控制 TB-02 模塊,代碼工程全部開源!
5、 初認識阿里天貓精靈官方Genie BT mesh Stack框架, windows平台搭建打印Hello World!
文章目錄
前言
目前的天貓精靈也出來了三年了,對應支持接入方式多種多樣,以WiFi、雲雲對接最多,而藍牙mesh
協議對接始終沒有統一起來,而今年阿里IoT事業部悄悄地開源了一款天貓精靈生態的藍牙MeshSDK
,博主認為應該要統一常見的藍牙mesh模塊了;
Genie BT mesh Stack
是一套適用於天貓精靈生態的藍牙meshSDK,目前 Genie BT mesh Stack
支持多家芯片廠商方案,包括:telink,MTK,Nordic,下面跟着我的筆記一起領略下吧!
一 環境搭建
- 安裝Python2.7(
非3.8版本),下載地址:鏈接; - 通過Python工具安裝 aos-cube,安裝指令:
pip install aos-cube
- 下載天貓精靈mesh sdk代碼!
- 一個安信可TB-02藍牙mesh開發板。
- 一個泰凌程序下載板(泰凌型號通用),某寶自行購買。
1.1 安裝 Python2.7
安裝完畢之后,窗口輸入 python -V
即可看到版本信息!
1.2 安裝 aos-cube
aos-cube
是阿里OS系統編譯的一個工具,你可理解它是基礎編譯工具包!過程如下:
下載先升級 pip , 前提是您的電腦必須正確安裝py環境:
python -m pip install --upgrade pip
窗口輸入下面指令即可自動下載:
pip install aos-cube
最后,我們看看有沒有安裝成功,窗口輸入 aos
得到:
1.3 下載天貓精靈mesh sdk代碼!
為了提高下載速度,我克隆了一份放在了國內的碼雲,方便你我他!
git clone https://gitee.com/xuhongv/genie-bt-mesh-stack
1.4 下載固件燒錄工具
天貓精靈mesh框架的固件下載是根據芯片原廠的指導進行的,並非統一的串口下載,本文采用的是安信可TB-02模塊(TLSR825X 系列),所以采用的泰凌專用燒錄工具,點擊下載: BDT.zip
二 硬件接線
2.1 燒錄接線
燒錄器 | TB-02 |
---|---|
3V3 | 3V3 |
SWM | SWS |
GND | GND |
2.2 查看串口日志的接線
USB-TTL工具 | TB-02 |
---|---|
TXD | RXD |
RXD | TXD |
GND | GND |
三 編譯代碼
3.1 確保接線成功
打開下載工具,Device
— Connect
查看已經連接燒錄工具成功了啦!
3.2 擦除芯片內容
芯片選擇 8258,點擊 Erase 即可擦除!如下圖所示:
3.2 編譯代碼
在主目錄下面,輸入下面指令,即可編譯。
aos make bluetooth.helloworld@tc825x
窗口如下輸出,如果是第一次,還會下載對應的編譯工具鏈,速度會稍微慢點:
D:\SigMesh\genie-bt-mesh-stack (master -> origin)
$ aos make bluetooth.helloworld@tc825x
aos-cube version: 0.5.11
Build AOS Now
TOOLCHAIN_PATH=D:\SigMesh\genie-bt-mesh-stack\build/compiler/tc32/bin/
Compiling helloworld
Compiling auto_component
Making out/bluetooth.helloworld@tc825x/libraries/auto_component.a
Making out/bluetooth.helloworld@tc825x/libraries/helloworld.a
Making bluetooth.helloworld@tc825x.elf
Making bluetooth.helloworld@tc825x.bin
Making bluetooth.helloworld@tc825x.hex
no definite address hint,using default mem configuration
Making bluetooth.helloworld@tc825x.lst
AOS MEMORY MAP
|=================================================================|
| MODULE | ROM | RAM |
|=================================================================|
| genie_app | 0 | 7482 |
| log | 0 | 486 |
| helloworld | 0 | 810 |
| ref_impl | 0 | 712 |
| bt_common | 0 | 14088 |
| bt_mesh | 0 | 44159 |
| osal | 0 | 410 |
| libsoft-fp | 0 | 1032 |
| crc | 0 | 72 |
| tc32_825x | 0 | 17810 |
| cli | 0 | 9740 |
| kernel_init | 0 | 24 |
| tc32 | 0 | 424 |
| rhino | 0 | 20069 |
| bt_host | 0 | 38454 |
| liblt_8258 | 0 | 24532 |
| tc825x | 0 | 304 |
|=================================================================|
| TOTAL (bytes) | 0 | 180608 |
|=================================================================|
Adding Check bluetooth.helloworld@tc825x.bin
output done!
Build complete
Making .gdbinit
3.2 下載
首先找到對應的輸出二進制文件,在主目錄下面的 out 文件夾 – 例程文件夾 – libraries
文件夾,比如我的:
D:\genie-bt-mesh-stack\out\bluetooth.helloworld@tc825x\libraries\bluetooth.helloworld@tc825x.bin
打開串口調試助手,波特率921600,串口打印 Hello World 啦!
下篇為大家帶來天貓精靈語音控制的實現!
另外,不要把我的博客作為學習標准,我的只是筆記,難有疏忽之處,如果有,請指出來,也歡迎留言哈!
- 玩轉
esp8266
帶你飛、加群付費QQ
群,不喜的朋友勿噴勿加:434878850 - esp8266源代碼學習匯總(持續更新,歡迎star):https://github.com/xuhongv/StudyInEsp8266
- esp32源代碼學習匯總(持續更新,歡迎star):https://github.com/xuhongv/StudyInEsp32
- 郵箱聯系或者加群聯系我,就可以啦!
