BLE CC2541低功耗測試實驗 晶元驗證篇

2021-07-22 20:03:03 字數 4372 閱讀 5280

通過檢視晶元手冊cc2541的電氣特性表,cc2541低功耗(lowpower)有三種狀態:powermode1(簡稱:pm1)、powermode2(簡稱:pm2)、powermode3(簡稱:pm3)。

描述

它們分別對應功耗的典型值(單位:μa)如下表:

lowpowerstate

typical value

pm1270μa

pm21μa

pm30.5μa

本實驗是要驗證cc2541晶元在三種不同的狀態下負載電流值大小,所以說,我會在系統上電後直接配置完所有pin腳狀態以及相應的模式,然後,觀察電流錶電流值的變化。

偽**實現

/*配置pin腳的狀態*/

/*配置lowpowermode狀態*/

/*直接進入while狀態*/

注意事項:

1. 因為配置完直接就進入了while(1)迴圈,除錯的時候一定要把看門狗去掉,剔除巨集wdt_used。

2. 燒錄完**後,切記一定要拔掉ccdebugger**器,**器本身也消耗電流。

p0sel=0x00;

p1sel=0x00;

p2sel=0x00;

p0dir=0x00;

p1dir=0x00;

p2dir=0x00;

p0inp=0x00;

p1inp=0x00;

p2inp=0x00;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(0);

pcon = 1;

while(1);

p0sel=0x00;

p1sel=0x00;

p2sel= 0x00;

p0dir=0x00;

p1dir=0x00;

p2dir=0x00;

p0inp=0x00;

p1inp=0x00;

p2inp=0x00;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(1);

pcon = 1;

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0x00;

p1inp = 0x00;

p2inp = 0x00;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(1);

sleepcmd |= bv(0);

pcon = 1;

p0sel=0x00;

p1sel=0x00;

p2sel=0x00;

p0dir=0x00;

p1dir=0x00;

p2dir=0x00;

p0inp=0x00;

p1inp=0x00;

p2inp=0x00;

p2inp |=bv(5);

p2inp |=bv(6);

p2inp |=bv(7);

sleepcmd &= ~bv(0);

sleepcmd &= ~bv(1);

sleepcmd |= bv(0);

pcon = 1;

while(1)

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0x00;

p1inp = 0x00;

p2inp = 0x00;

p2inp |= bv(5);

p2inp |= bv(6);

p2inp |= bv(7);

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(1);

pcon = 1;

while(1);

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0x00;

p1inp = 0x00;

p2inp = 0x00;

p2inp |= bv(5);

p2inp |= bv(6);

p2inp |= bv(7);

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(1);

sleepcmd |= bv(0);

pcon = 1;

while(1);

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0xff;

p1inp = 0xfc;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(0);

pcon = 1;

while(1);

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0xff;

p1inp = 0xfc;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(1);

pcon = 1;

while(1);

p0sel = 0x00;

p1sel = 0x00;

p2sel = 0x00;

p0dir = 0x00;

p1dir = 0x00;

p2dir = 0x00;

p0inp = 0xff;

p1inp = 0xfc;

sleepcmd &= ~ bv(0);

sleepcmd &= ~ bv(1);

sleepcmd |= bv(0);

sleepcmd |= bv(1);

pcon = 1;

while(1);

電阻狀態\模式

powermode 1

powermode 2

powermode 3

上拉254.2μa

1.2μa

0.4μa

下拉254.4μa

1.2μa

0.37μa

高阻601.3μa

182.4μa

398.9μa

BLE CC2541之指令週期

一 簡介 本文介紹cc2541的指令週期,以及如何利用指令週期來計算乙個延時函式的時長。二 實驗平台 協議棧版本 ble cc254x 1.4.0 編譯軟體 iar 8.20.2 硬體平台 smart rf 主晶元cc2541 博主 甜甜的大香瓜 897503845 qq.com 香瓜ble之cc2...

cc2541 低功耗廣播

設定2541 廣播有幾個引數 gap setparamvalue tgap lim adv timeout,5 廣播持續時間 5s what is the advertising interval when device is discoverable units of 625us,160 100m...

BLE CC2541之通過廣播傳送自定義資料

一 簡介 本文以 bleperipheral為例,將自定義的資料寫入廣播資料中,通過乙個週期事件定時重新整理廣播資料。二 實驗平台 協議棧版本 ble cc254x 1.4.0 編譯軟體 iar 8.20.2 硬體平台 smart rf 主晶元cc2541 usb dongle 博主 甜甜的大香瓜 ...