微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > POWER_SAVING打开时,CC2541无法广播

POWER_SAVING打开时,CC2541无法广播

时间:10-02 整理:3721RD 点击:

POWER_SAVING打开时,CC2541无法广播CC2541。sniffer抓取不到任何数据。

目前我的BLE板子没有设计触发按键,所以需要蓝牙一直工作在低功耗广播状态下。我打算采取的方案是1S广播一次,400MS的任务定时。在没有广播或任务时,需要蓝牙进入低功耗P2模式。

这个是adveritise 设置

static uint8 advertData[] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
0x02, // length of this data
GAP_ADTYPE_FLAGS,
DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,

// service UUID, to notify central devices what services are included
// in this peripheral
0x03, // length of this data
GAP_ADTYPE_16BIT_MORE, // some of the UUID's, but not all
LO_UINT16( SIMPLEPROFILE_SERV_UUID ),
HI_UINT16( SIMPLEPROFILE_SERV_UUID ),

};

广播间隔是1S(1600)时sniffer可以偶尔收到数据包,但是大部分都是FCS错误(见附图)。200MS时完全收不到数据包。

电路板上没有设计外部 32.768H晶振, 在另外的论坛上搜到的相关解释:

问:

I had a project that worked just fine with the default power management settings.

Once I turned on the POWER_SAVING flag, the device started getting stuck when sleeping from the main loop.

Specifically, This behavior is presented in void halSleep( uint32 osal_timeout ) in hal_sleep.c, in line 344:

// check if radio allows sleep, and if so, preps system for shutdown
if ( LL_PowerOffReq(halPwrMgtMode) == LL_SLEEP_REQUEST_ALLOWED )

When stepping over the call to LL_PowerOffReq, the debugger stops responding and the device probably does too, for no good reason. When manually pressing the "break" button in the workbench, I reach llStopTimer2(), but never leaves there.

I can't step-in to the function because it has no source. When stepping through the assembly it's difficult to determine when exactly it gets stuck, since it does all sorts of banked-code trickery, various jumps etc, and the debugger responds VERY slowly to single-instruction stepping (don't understand why).

This happens right on the first sleep the device encounters. I'm working without any optimizations. Using CC-Debugger.

Any help will be appreciated.

答复:

Do you have an external 32.768Hz oscillator?

LLPowerOffReq doesn't really do anything interesting apart from stopping the MAC timer and syncing it with the sleep timer. Which will require a functional sleep timer.

没有32Khz外部晶振,不能进入sleep状态么?

没有回?还是自己顶吧。问题解决了。32Khz晶振必须焊上才能进入低功耗休眠状态(PM2)。无广播时电池电流约150uA。

但是有个疑问,没有32Khz晶振,系统自带的RC振荡器(32K)不能工作么?希望有大神来解释。

没有外部32KHz晶振也可以进入PM2的,需要修改main里的HAL_BOARD_INIT()这个宏。把切换到外部32KHz晶振的代码删掉即可,相关引脚也要做处理。

/* Board Initialization */
#define HAL_BOARD_INIT()                                                       \
{                                                                              \
  /* Set to 16Mhz to set 32kHz OSC, then back to 32MHz */                      \
  START_HSOSC_XOSC();                                                          \
  /*SET_OSC_TO_HSOSC(); 使用内部32K时钟*/                                                         \
  /*SET_32KHZ_OSC();*/                                                             \
  SET_OSC_TO_XOSC();                                                           \
  STOP_HSOSC();                                                                \
                                                                               \
  /* Enable cache prefetch mode. */                                            \
  PREFETCH_ENABLE();                                                           \
}

楼上正解,已标记为正确答案

/* Sleep Clock */

#define EXTERNAL_CRYSTAL_OSC 0x80 //0x00 // external 32kHz XOSC
#define INTERNAL_RC_OSC 0x80 // internal 32kHz RCOSC

这个可以定义使用外部还是内部32.768晶振……

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top