目錄
- 聯盛德 HLK-W806 (一): Ubuntu20.04下的開發環境配置, 編譯和燒錄說明
- 聯盛德 HLK-W806 (二): Win10下的開發環境配置, 編譯和燒錄說明
- 聯盛德 HLK-W806 (三): 免按鍵自動下載和復位
- 聯盛德 HLK-W806 (四): 軟件SPI和硬件SPI驅動ST7735液晶LCD
- 聯盛德 HLK-W806 (五): W801開發板上手報告
- 聯盛德 HLK-W806 (六): I2C驅動SSD1306 128x64 OLED液晶屏
- 聯盛德 HLK-W806 (七): 兼容開發板 LuatOS Air103
- 聯盛德 HLK-W806 (八): 4線SPI驅動SSD1306/SSD1315 128x64 OLED液晶屏
- 聯盛德 HLK-W806 (九): 軟件SPI和硬件SPI驅動ST7789V液晶LCD
- 聯盛德 HLK-W806 (十): 在 CDK IDE開發環境中使用WM-SDK-W806
- 聯盛德 HLK-W806 (十一): 軟件SPI和硬件SPI驅動ST7567液晶LCD
- 聯盛德 HLK-W806 (十二): Makefile組織結構和編譯流程說明
- 聯盛德 HLK-W806 (十三): 運行FatFs讀寫FAT和exFat格式的SD卡/TF卡
介紹
W806是32位MCU, 1MB flash, 288K內存, MCU部分是T-HEAD 800 系列的XT-E804
- XT-E804 是平頭哥(被阿里收購前的中天微電子)的MCU, 屬於T-HEAD 800 系列
- T-HEAD 500, 600 和 800 系列屬於 CSKY 架構(與RISC-V接近)
- T-HEAD 500 和 600 系列基於 CSKY V1
- T-HEAD 800 系列基於 CSKY V2
- 聯盛德和合宙的部分芯片型號, MCU部分是一樣的
- 合宙Air101, XT-E804的QFN32封裝
- 聯盛德W800, XT-E804加上自研的2.4G無線部分, QFN32封裝
- 聯盛德W806, 合宙Air103, XT-E804的QFN56封裝
- 聯盛德W801, XT-E804加上自研的2.4G無線部分, QFN56封裝
關於CSKY架構
CSKY架構在2018年底被合並入Kernel. 關於這個架構, Bergmann的評論:
In commenting on C-SKY, Arnd Bergmann commented that C-SKY might end up being the last new CPU architecture added to the kernel... He rightfully points out that most vendors now not part of the ARM/x86/POWER bandwagon are pursuing RISC-V based designs, which is already part of the mainline kernel. For low-power devices ARM and RISC-V are likely the future and with those architectures there isn't much of an advantage for hardware vendors to pursue their own architectures from scratch. On the high performance computing front, nothing is expected to unseat x86_64 and POWER anytime soon... If any new CPU targets are added to the Linux kernel in the coming years, it's likely to be some virtual target. One more general comment: I think this may well be the last new CPU architecture we ever add to the kernel. Both nds32 and c-sky are made by companies that also work on risc-v, and generally speaking risc-v seems to be killing off any of the minor licensable instruction set projects, just like ARM has mostly killed off the custom vendor-specific instruction sets already. If we add another architecture in the future, it may instead be something like the LLVM bitcode or WebAssembly, who knows?
另一個評論:
While there isn't anything preventing new architectures from being introduced, the general trend is that fewer and fewer architectures are being developed. x86, ARM, and now RISC-V are fulfilling more and more use cases. It's much cheaper to tweak an existing processor or platform than to invent your own from nothing. With RISC-V, this becomes even more the case since there are no royalties involved. MIPS also went open source recently, which is popular in routers and embedded devices. AFAIK, C-SKY doesn't exist for technical reasons, it only exists because the Chinese wanted their own architecture.
W806芯片參數
封裝
- QFN56, 6mm x 6mm, pin間距0.35mm
MCU 特性
- 集成 32 位 XT804 處理器,工作頻率 240MHz,內置 DSP、浮點運算單元與安全引擎
- 內置 1MB Flash,288KB RAM
- 集成 PSRAM 接口,支持最高 64MB 外置 PSRAM 存儲器
- 集成 6 路 UART 高速接口
- 集成 4 路 16 比特 ADC,最高采樣率 1KHz
- 集成 1 個高速 SPI 接口(從接口),支持最高 50MHz
- 集成一個主/從 SPI 接口
- 集成 1 個 SDIO_HOST 接口,支持 SDIO2.0、SDHC、MMC4.2
- 集成 1 個 SDIO_DEVICE,支持 SDIO2.0,最高吞吐率 200Mbps
- 集成 1 個 I2C 控制器
- 集成 GPIO 控制器,最多支持 44 個 GPIO
- 集成 5 路 PWM 接口
- 集成 1 路 Duplex I2S 控制器
- 集成 LCD 控制器,支持 4x32 接口
- 集成 1 個 7816 接口
- 集成 15 個 Touch Sensor
供電
- 3.3V 單電源供電
- 支持工作、睡眠、待機、關機工作模式
- 待機功耗小於 10uA
關於W806和Air103
W806和Air103實質上是同一款芯片, 從pin腳定義可以看到是pin-pin對應的. 在合宙的WIKI上也注明了"本芯片與聯盛德w806可互換".
HLK-W806 開發板
這個板子在淘寶上的實際售價差不多在8 RMB, 加上一些商家優惠, 可以真正做到低於0.99 USD, 這個價格的32位MCU, 性價比完勝STC的那些8位MCU了.
正面
背面
參數
- MCU – WinnerMicro W806 32-bit XT804 MCU
- 2x24排針
- Debugging – CH340 via micro USB port
- Misc – Reset and Boot buttons
- Power Supply – 5V via micro USB port
- 尺寸65 x 26 mm
使用
下載
- https://occ.t-head.cn/community/download 下載編譯工具
- 導航->工具->工具鏈-800系列->(當前是V3.10.29)
- 根據自己的操作系統, 下載對應版本, 對於Ubuntu20.04, 下載 csky-elfabiv2-tools-x86_64-minilibc-yyyymmdd.tar
- 如果上面的鏈接有問題或者無法注冊, 可以通過百度盤下載 https://pan.baidu.com/s/1Mp-oHNM3k4Hb8vEybv8pZg code:vw42
安裝
上面下載的tar.gz文件外層路徑用的是./
目錄, 建議放到一個單獨的目錄中解壓, 或者指定解壓目錄解壓目錄, 參考命令如下
mkdir csky-elfabiv2-tools-x86_64-minilibc-20210423
tar xvf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz -C csky-elfabiv2-tools-x86_64-minilibc-20210423/
移動到/opt下, 目錄可以自己定, 設置權限禁止普通用戶修改
cd /opt/toolchains/
sudo mv ~/Download/csky-elfabiv2-tools-x86_64-minilibc-20210423/ .
sudo chown -R root:root csky-elfabiv2-tools-x86_64-minilibc-20210423/
不需要添加系統路徑
編譯
導出此項目
git clone https://github.com/IOsetting/wm-sdk-w806.git
運行menuconfig, 配置工具路徑
cd wm-sdk-w806
make menuconfig
在menuconfig界面中, Toolchain Configuration -> 第二個toolchain path, 將剛才的路徑填進去, 需要完整路徑, 帶最后的斜桿, 例如
/opt/toolchains/csky-elfabiv2-tools-x86_64-minilibc-20210423/bin/
其他不用動, Save后退出menuconfig
執行編譯
make
寫入開發板
首先通過dmesg
,lsusb
, ls /dev/tty*
等命令確定自己開發板在系統中對應的USB端口, 例如ttyUSB0
.
運行menuconfig, 配置端口名稱
cd wm-sdk-w806
make menuconfig
在menuconfig界面中, Download Configuration -> download port, 填入開發板在你的系統中對應的USB端口, 例如ttyUSB0
, 注意這里只需要填純端口名, 不需要用完整的路徑. 可以調高波特率加快下載,只支持115200
, 460800
, 921600
, 1000000
, 2000000
, Save后退出menuconfig
執行燒錄
make flash
根據輸出的提示, 按一下reset鍵就會開始下載. 如果前一次寫入的固件已經開啟了USE_UART0_AUTO_DL
則不需要按鍵, 會自動開始下載
enerate compressed image completed.
build finished!
connecting serial...
serial connected.
wait serial sync......... <----- 這里按下reset
please manually reset the device. <----- 或者這里
....
serial sync sucess.
mac CC-CC-CC-CC-CC-CC.
start download.
0% [###] 100%
download completed.
reset command has been sent.
下載完成后, 下載工具會發送復位指令, 復位成功后程序會自動開始執行. 如果自動復位失敗, 則需要按一下Reset鍵手工復位.
更多下載選項
顯示串口列表
make list
燒錄並打開串口監視器
make run
只打開串口監視器
make monitor
問題
如果出現can not open serial make: *** [tools/w806/rules.mk:158: flash] Error 255
錯誤, 檢查一下是否有其他串口軟件占用了這個端口, 如果有需要先關閉