2015年12月23日 星期三

2015年11月23日 星期一

CC2640 vs CC2541


1. compare CC2640 and CC254x.
http://referencedesigner.com/blog/ti-cc2640-vs-cc2540-ble/2506/

2. Compare CC26xx and Nordic nrf52832
http://referencedesigner.com/blog/ti-cc2650-cc2640-vs-nordic-nrf52832/2489/

3. The difference between CC2640 and CC2650:

Q: What is the difference between CC2640 and CC2650?

The multi-standard CC2650 wireless MCU supports BLE as well as other wireless protocols, such as 802.15.4. The CC2640 supports Bluetooth Low Energy only. All code generated from the BLE-Stack 2.0 SDK is binary compatible with both the CC2650 & CC2640. Additionally, IDE project configuration settings in the BLE-Stack v2.0 SDK for CC2650 & CC2640 are cross-compatible; however, it is strongly recommended to not change the CPU settings in the IDE. Although the CC2650 has the HW & ROM capability to support additional wireless protocols, a given SW build can only support one wireless protocol. from TI BLE wiki.
4. TI engineer answer:
https://e2e.ti.com/support/wireless_connectivity/f/538/p/417820/1486886#1486886
1) Basically because the radio is totally redesigned. 
2) This is just because the modern ARM processors are more efficient than the old 8051. Additionally we are using new production process, new technology, etc. Adding a built-in DCDC regulator also increases efficiency. Keep in mind though, that none of the numbers in the datasheet are for running both cores simultaneously. 
3) You are correct on CC2640CC2541 will not be able to fulfill all of 4.1 due to RAM limitations.
4) How many BLE devices may handle the cc2640? There was a limit of.... 3 (AFAIR) in cc2541
Our current number is 8
5) Everything is faster in the CC2640 compared to the CC2541. Really.
6) The CC2541 will still be supported by us. We also plan to update the BLE stack for CC254x to 1.4.1 this year. It you prefer a device that have been in the market for several years and is mature, and you can live with the current consumption and the 8051 core, the CC2541 is still a good part to use.
7) You can get the CC26xx SensorTag for $29 with a low cost debugger for just additional $15. Get a kit and check it out! 
from  

2015年11月5日 星期四

Android Studio - Study


Eclipse + plug-in Android ADT -->  Eclipse ADT bundle -> Android Studio
Good materials (Chinese)
http://www.sdk.tw/2014/12/android-sdk-android-studio.html

Download Android Studio 1.4.1 is about 1.2 GB.

There is a known issue about Tools.jar is not in Android Studio classpath.
Just change your JAVA_HOME to JDK path. The tools.jar is not in JRE but in JDK.

2015年11月3日 星期二

Connect cp2102 or FTDI to Android 3.1 +

The issue here is that the CP210x driver is not enabled in the Android kernel by default. So you will either need to build this driver in to your kernel to get the tty access and ability to use JavaComm.
The other option is to use the USB Host functionality and access your CP210x directly with it's API.
from Preston answered Dec 10 '13 at 15:19


Roger Clark 



The other people trying experience, still not work.
http://www.crifan.com/add_rts_and_dtr_support_for_silicon_labs_cp2102_in_usb_serial_for_android/

CP210x driver on Android 4.0.4
http://124.16.139.131:24080/lxr/source/kernel/omap/drivers/usb/serial/cp210x.c?v=android-4.0.4


It works if your Android kernel support CP210x or FTDI driver by using this App.
"USB Serial Terminal Lite"
https://play.google.com/store/apps/details?id=com.oneman.freeusbtools&hl=zh_TW


6/26/14




Ok.

Eventually solved my own problem.

When I imported the projects into Eclipse, the default Java Build path -> Source   location settings are are for /src and /gen
However the project sources for this are in /java/src/...

So I've moved the files into /src as this seem to be the default (possibly current best practice ???) - as I said, I'm new to Android dev, so I'm not sure what the norms are, but when you create an empty project in the latest version of Eclipse it puts the source files in /src

The issue of the library name was just syntax, i.e the project can be renamed in Eclipse from "main" to USBSerialLibrary using the Refactor -> Rename command.

The stuff in the HowTo about linking the library seems to be out of date as well. As far as I can see (and it works for me in Eclipse ADT  v22.6.2-1085508), is just to add the USBSerialLibrary project as a library to the Android setting in Properties.

BTW. I seem to need to compile as Android 4.2.2 because of a reference to JELLYBEAN in the code

I'm also getting lots of warnings, but normally isn't good news, however the only ones that probably needs to be dealt with in the long term is that

import android.widget.TwoLineListItem;

appears to be deprecated.

Anyway, I hope this helps anyone else just starting out on this journey ;-)

2015年10月5日 星期一

Javascript note

1. Older examples may use a type attribute: <script type="text/javascript">
    The type attribute is not required. JavaScript is the default scripting language in HTML. (from W3school).
2. Script function can put any where such as <body> or <head>.
    Keeping all code in one place, is always a good habit. 
    It is a good idea to place scripts at the bottom of the <body> element.
    This can improve page load, because HTML display is not blocked by scripts loading.
    (from W3school).
3. external file by using .js
  <script src="myScript.js"></script>

    The advantages: (from W3school)
  • It separates HTML and code
  • It makes HTML and JavaScript easier to read and maintain
  • Cached JavaScript files can speed up page loads
4. Display functions:

  • Writing into an alert box, using window.alert().
  • Writing into the HTML output using document.write().
  • Writing into an HTML element, using innerHTML.
  • Writing into the browser console, using console.log().
5. 

Max bonding number of TI CC2541

Below is from TI forum discussion:

Excess pairings over 10 are not stored (bond table is full). You will enter a successful connection.

In the bond manager when a new bond is to be stored, if bondIdx in the below code snippet is equal to GAP_BONDINGS_MAX then the bond will not be stored and the next time you connect you will have to repeat the pairing process over again.

// First see if we already have an existing bond for this device
bondIdx = gapBondMgrFindAddr( pBondRec->publicAddr );
if ( bondIdx >= GAP_BONDINGS_MAX )
{
bondIdx = gapBondMgrFindEmpty();
}


from https://e2e.ti.com/support/wireless_connectivity/f/538/t/388554


The white list for CC2540 and CC2541 has a maximum of 8 entries.
https://e2e.ti.com/support/wireless_connectivity/f/538/p/182903/1111969#1111969

Other Bluetooth connection limitation issue:
http://superuser.com/questions/332767/limit-to-the-number-of-devices-that-can-be-paired-with-a-bluetooth-device
Sony up to nine:
https://us.en.kb.sony.com/app/answers/detail/a_id/39047/~/what-is-the-maximum-number-of-bluetooth-wireless-devices-that-can-be-paired%3F

Provide some solution for fix the probelm.
such as FIFO loop to saving Key. 
https://e2e.ti.com/support/wireless_connectivity/f/538/p/458133/1654011


bcomdef.h
/** @defgroup BLE_NV_IDS BLE Non-volatile IDs
 * @{
 */
// Device NV Items -    Range 0 - 0x1F
#define BLE_NVID_IRK                    0x02  //!< The Device's IRK
#define BLE_NVID_CSRK                   0x03  //!< The Device's CSRK
#define BLE_NVID_SIGNCOUNTER            0x04  //!< The Device's Sign Counter

// Bonding NV Items -   Range  0x20 - 0x5F    - This allows for 10 bondings
#define BLE_NVID_GAP_BOND_START         0x20  //!< Start of the GAP Bond Manager's NV IDs
#define BLE_NVID_GAP_BOND_END           0x5f  //!< End of the GAP Bond Manager's NV IDs Range

// GATT Configuration NV Items - Range  0x70 - 0x79 - This must match the number of Bonding entries
#define BLE_NVID_GATT_CFG_START         0x70  //!< Start of the GATT Configuration NV IDs
#define BLE_NVID_GATT_CFG_END           0x79  //!< End of the GATT Configuration NV IDs

//----------could add for saving counter to deal with FIFO bonding info
// Customer NV Items - Range  0x80 - 0x8F - This must match the number of Bonding entries
#define BLE_NVID_CUST_START             0x80  //!< Start of the Customer's NV IDs
#define BLE_NVID_CUST_END               0x8F  //!< End of the Customer's NV IDs

/** @} End BLE_NV_IDS */

ti_51ew_cc2540b.xcl
// Internal flash used for NV address space.
// ---------------------------
//
// Address range for HAL_FLASH_PAGE_SIZE == 2048
-D_BLENV_ADDRESS_SPACE_START=0x7E800
-D_BLENV_ADDRESS_SPACE_END=0x7F7FF
//
// Address range for HAL_FLASH_PAGE_SIZE == 4096
//-D_BLENV_ADDRESS_SPACE_START=0x7D000

//-D_BLENV_ADDRESS_SPACE_END=0x7EFFF


http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/48352.aspx
注意下面的表述,也就是说2K,1K存数据,另1K是做备份。
The main reason for SNV is that it's only possible to erase a page, and not a small area of flash.  As you re-write a SNV data item, the SNV will create a new space for it and write it. The old space will be marked as invalid, and will become free again when that page is erased.  There is only one active page and then a mirror page where the valid items are copied to when the page gets full. I think the max size for everything in SNV is 1K (minus about 250K for bonding info).


How to implement saving FIFO bonding info to unlimit GAP_BONDINGS_LIMIT 10, could refer the above URL.
It add counter by using BLE_NVID_CUST_START to record the FIFO index, but it suggests to implement in the connection_terminate. I think it will have problem if bonding done at connection, you will never do the FIFO counter if power off the device before terminate connection event does.
Another way is add main.c to check bonding if full then clear one space for next bonding process. By this way, could add bonding counter to handle this.

OSAL API note:
There are some important considerations when using this API: 
1. These are blocking function calls and an operation may take several milliseconds to complete. This is especially true for NV write operations. In addition, interrupts may be disabled for several milliseconds. It is best to execute these functions at times when they do not conflict with other timing-critical operations. For example, a good time to write NV items would be when the receiver is turned off. 
2. Try to perform NV writes infrequently. It takes time and power; also most flash devices have a limited number of erase cycles. 
3. If the structure of one or more NV items changes, especially when upgrading from one version of a TI stack software to another, it is necessary to erase and re-initialize the NV memory. Otherwise, read and write operations on NV items that changed will fail or produce erroneous results. 

2015年9月29日 星期二

How to enable USB debugger at Android 5.0 (Lollipop)

This version hides the USB debugger function in setting. Need to call this function back by the steps below.

Go to setting --> about phone --> Tap build number seven times.
Then the system will show developer enable.
Go back setting and will find the developer setting. Enable USB debugger.

http://www.kingoapp.com/root-tutorials/how-to-enable-usb-debugging-mode-on-android-5-lollipop.htm

You have to enable USB debugging before plugging your device in to the computer. Unplug device then try to enable USB debugging. This should work. If so, you can then plug it back into the computer and it should work.

For Android 7, my phone is V20.
1. Check the driver install well.
2. Install SDK platform-tools - adb.
3. enable USB debugger first.
4. Setup PTP mode on the phone when plugging in USB.
5. Windows should automatically install the driver.
6. Then adb should be able to find your device. The command is such "adb devices".


2015年9月21日 星期一

JSON for binary data - interesting article


http://stackoverflow.com/questions/1443158/binary-data-in-json-string-something-better-than-base64

2015年8月13日 星期四

About MAC address ordering

From http://www.infocellar.com/networks/ip/mac-vs-ip.htm

Total 6 bytes - 
OUI - first 3 bytes Organizational unique identifier 
UAA - last 3 bytes Universally Adminstered Address

Ethernet bytes are transmitted big-endian but the bits are transmitted little-endian.

2015年8月2日 星期日

2G 時代OUT?


網路言論 (中國退出), 可能到2020年
http://www.techweb.com.cn/tele/2015-06-19/2165881.shtml


中国联通2017年关闭2G网络 为3G和4G腾出网速
http://www.techweb.com.cn/tele/2015-07-12/2174257.shtml


实际上,早在2007年澳大利亚就彻底关闭CDMA网络,随后墨西哥、日本、印度、印度尼西亚、越南、孟加拉国、泰国、巴西等地区的运营商也先后关闭CDMA网络服务。
当然面临关闭的第二代移动通信网络的还有GSM,美国最大的移动运营商AT&T此前宣布,到2016年将会彻底关闭GSM网络,而该网络占用的资源将用于4G网络的建设。
但是,全球的2G网络并不会快速消失。对此,英国科技市场研究公司Ovum预测,2G网络要等到2020年才会完全消失,因为,目前移动运营商仍然通过GSM和CDMA等二代网络的语音通话、短信、漫游费等获取了不少营收。
from http://www.techweb.com.cn/tele/2015-05-11/2151172.shtml


網路消息:
美國AT&T宣布將于2017年以前關閉其2G
日本NTT DoCoMo、KDDI、SoftBank已完全停止2G服務
2010年芬蘭三大電信運營商也關閉了2G
      紐西蘭(Telecom)、韓國(KT)關閉了2G
      中國移動至少2018年內不關閉2G網絡
      台灣是民國106年6月 全面回收GSM 頻段

2015年7月31日 星期五

微信設備開發LOG

1. 硬件平台文檔: http://iot.weixin.qq.com/document-2_11.html
2. 設備 device_id 更新例子: http://www.6fcall.com/index.php?s=/Home-Index-content-id-31.html
3. 微信 advdata example: http://blog.csdn.net/haozi0_0/article/details/46878575
4. 微信開發歷程: 他人經驗: http://blog.csdn.net/haozi0_0/article/details/46790483
5. 到底可不可以連多個設備, 實測是可以的; 但通常其中一個不容易被連上; 以下內容真讓人CONFUSE, 有相互衝突; ???
6. 用户关注公众号的通知,和绑定设备的通知,到达的先后顺序不定。  確實, 向後台發送的訊息, 若多個訊息在發送, 間隔很短的時間, 通常小於一秒, 有可能不會照順序到達.


二、 微信客户端连接 BLE 设备
1. 微信扫描二维码,记录设备的 MAC 地址
2. 打开公众号,如果此时 BLE 设备开启了,则会自动连接
3. 如果微信再次扫描 BLE 设备(与第一个设备 MAC 地址不同),并添加到公众号,两个设备都开启,则微信客户端可以连接两个设备,微信客户端可以同时向两个设备发数据,但是仅限窗口模式,网页模式不可以用

Q:一个用户只能绑定一个设备吗? 
A:是。在已绑定设备且未解绑的情况下,再扫描绑定另一设备时,前者会被取代,绑定的
是后一设备。 
微信不建议允许同一用户绑定多个设备,若一定需要绑定多个设备,微信能在自定义菜单中
提供“添加设备”功能,由厂商负责管理。此时,通过扫描二维码的方式不能绑定新设备,
而需要用户在公众号内输入新设备的deviceID,由厂商在后台处理。 

Q:同一设备是否能被多个用户扫描绑定吗? 
A:是。 

Q:能否实现以下情况:用户A 与用户B都同时绑定设备 1和设备2? 
A:否。

7. 下載中心, 有很多好料的, 一點要看: http://iot.weixin.qq.com/download.html
8. 當然微信論壇也可以找到一些資訊, 只是可能會有問題石沈大海, 多爬一些文, 可能可以找到前人問過的問題和答案;

GPRS solution example:
http://www.letime.cn/news_show.asp?pageid=556&big_id=64&topid=5

三. 微信設備參數範例:
設備更新授權-
{
    "device_num": "1",
    "device_list": [
        {
            "id": "gh_76a56d632614_5091274d819bd813fb4853fa55a382cc",
            "mac": "BC6A2924EF78",
            "connect_protocol": "3",
            "auth_key": "1234567890ABCDEF1234567890ABCDEF",
            "close_strategy": "1",
            "conn_strategy": "1",
            "crypt_method": "0",
            "auth_ver": "0",
            "manu_mac_pos": "-1",
            "ser_mac_pos": "-2"
        }
    ],
    "op_type": "1"
}



Intel HEX - F/W burn code

https://en.wikipedia.org/wiki/Intel_HEX

example:
:1000830002243BE5C754F84401F5C7790122000077


  1. Start code, one character, an ASCII colon ':'.
  2. Byte count, two hex digits
  3. Address, four hex digits
  4. Record type (see record types below), two hex digits, 00 to 05 
  5. Data
  6. Checksum, two hex digits

Hex codeRecord typeDescriptionExample
00DataContains data and a 16-bit starting address for the data. The byte count specifies number of data bytes in the record. The example shown to the right has 0B (decimal 11) data bytes (6164647265737320676170) located at consecutive addresses beginning at address 0010.:0B0010006164647265737320676170A7
01End Of FileMust occur exactly once per file in the last line of the file. The data field is empty (thus byte count is 00) and the address field is typically 0000.:00000001FF
02Extended Segment AddressThe data field contains a 16-bit segment base address (thus byte count is 02) compatible with 80x86 real mode addressing. The address field (typically 0000) is ignored. The segment address from the most recent 02 record is multiplied by 16 and added to each subsequent data record address to form the physical starting address for the data. This allows addressing up to one megabyte of address space.:020000021200EA
03Start Segment AddressFor 80x86 processors, specifies the initial content of the CS:IP registers. The address field is 0000, the byte count is 04, the first two bytes are the CS value, the latter two are the IP value.:0400000300003800C1
04Extended Linear AddressAllows for 32 bit addressing (up to 4GiB). The address field is ignored (typically 0000) and the byte count is always02. The two encoded, big endian data bytes specify the upper 16 bits of the 32 bit absolute address for all subsequent type 00 records; these upper address bits apply until the next 04 record. If no type 04 record precedes a 00 record, the upper 16 address bits default to 0000. The absolute address for a type 00 record is formed by combining the upper 16 address bits of the most recent 04 record with the low 16 address bits of the 00 record.:02000004FFFFFC
05Start Linear AddressThe address field is 0000 (not used) and the byte count is 04. The four data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.:04000005000000CD2A

2015年7月30日 星期四

Is it possible to wake up phone by NFC when lock mode?

from http://stackoverflow.com/questions/10733723/launching-nfc-when-screen-is-locked-in-android.
According to Google, Android-powered devices must be unlocked in order to scan an NFC tag [1]. Also the Google Wallet concerns privacy and security, and works only in unlocked state [2].


2015年7月29日 星期三

iOS External Accessory Programming Topics

https://developer.apple.com/library/ios/featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html

from https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf
Third-party accessories can use the iPod Accessory Protocol (iAP) to access advanced features of iOS devices. One such feature is the ability to communicate securely with third-party iOS applications via the iOS External Accessory Framework. For information about the External Accessory Framework, see http://developer.apple.com/library/ios/#featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html on the Apple iOS Developer site. To incorporate iAP into an accessory design, the accessory developer must be a member of the Apple MFi licensing program and integrate specific MFi hardware into the accessory. For further information about MFi, see developer.apple.com/programs/mfi.

iOS devices do not implement the Bluetooth RFCOMM (SPP) profile. from Bluegiga.
Instead Bluetooth accessories can use iAP profile to exchange data with iOS devices – iAP is RFCOMM based connection (similar to SPP) – It uses Apple proprietary iAP application protocol – Allows data exchange between Apps and the accessory • Audio, Human Interface (HID), PAN accessories and Bluetooth Smart devices are outside MFi program

Bluegiga:
iWRAP also implements 13 other Bluetooth profiles – Serial Port Profile – A2DP – Hands-Free Profile – Human Interface Device Profile – Health Device Profile – etc.
– Uses SPP to communicate with an Android App
– Uses iAP to communicate with an iOS App

2015年7月28日 星期二

CCC 第一批实施强制性产品认证的产品目录 - SRRC

http://www.ccc-cn.org/ccccatalog.htm

http://www.boot.com.tw/ccc/folder03/f03o.htm



http://www.srrccn.org/chinese.htm

关于明确移动通信模块强制性认证有关要求的通知
关于明确移动通信模块强制性认证有关要求的通知
各直属检验检疫局,各省、自治区、直辖市质量技术监督局:
随着移动通信技术的广泛应用,越来越多的产品中集成了移动通信模块。近日,我委收到部分地方质检部门和相关企业关于带有移动通信模块的产品(如采用CDMA/GSM/GPRS等移动通信方式实现远程数据监控的“用电管理终端”、“GPS监控终端”等产品)是否属于强制性认证范围,以及如何实施认证的问询。根据《强制性产品认证管理规定》和《第一批实施强制性产品认证的产品目录》,采用GPRS、GSM、CDMA、TD-SCDMA、WCDMA、CDMA2000五种制式的移动用户终端产品应当申请3C认证。现将上述五种制式移动通信模块及相关产品的强制性认证有关要求明确如下:
一、移动通信模块或者带有移动通信模块的产品(以下简称模块及相关产品)可接入公共通信网,具备3C目录内移动用户终端产品的功能,应申请3C认证,符合移动用户终端的3C认证检测要求。实施认证时,如模块可从产品上分离,则模块单独申请认证即可,检测在模拟最终使用环境状态下进行;如模块不可分离,则应送带有移动通信模块的产品或已能建立通信功能的中间产品进行检测认证。
二、如带有移动通信模块的产品除移动通信功能外,还具备3C目录内其他产品的功能,则还应符合相应产品强制性认证实施规则的要求。
三、预定在工业环境中和预定在室外环境中使用的模块及相关产品目前不属3C认证范围。
二○一一年七月十四日
备注:强制性产品认证管理规定:http://cccwto.com/1690.html
移动通信模块申请3C认证指南:http://cccwto.com/944.html

GSM双频GPRS手机进网(CTA)介绍
http://wenku.baidu.com/view/18cdc679a26925c52cc5bf73.html?re=view

http://www.atl-lab.com.tw/images/news/03_CTA091029.pdf

CCC、CTA认证流程介绍
http://sgststatics.sgst.cn/uploadfile/2013/1025/20131025051524948.pdf

2015年7月14日 星期二

USB pin define

http://chunchaichang.blogspot.tw/2012/06/usb.html

採光罩 survey

玻璃建議:
1. 玻璃水平施工 最低安全標準應用5mm+ 5m m膠合安全玻璃 
    (5mm光強化玻璃+5mm光白膜膠合安全玻璃)

結構:
1. 採用10H型鋁鋼構
2. 橫樑立柱是採用12×20H型鋁鋼構(單位:cm)
http://yp.518.com.tw/product-prod_info.html?rid=2&a=1269025&sr=2050
3. 鋁鋼構介紹: here

第一代的H型鋁鋼構為實心鋁擠型,並不是作為採光罩用途,而是做為建物表面飾材。
第二代的H型鋁鋼構著眼於第一代實心鋁擠型成本太高,故製作空心模。
第三代的H型鋁鋼構正式進入採光罩計畫,由於鋁料的厚度不能太薄,且為求達到同等鋼構的組織架構,所以製作成本高。故早期規劃製作H型鋁鋼構者,以專題建案及H型鋁鋼構鍾愛者居多。

其實H型鋁鋼構的擠型模,是非常難以擠型的料;就因為它的工型翅膀,在擠型抽出的同時,必須克服鋁擠型變形!H型鋁鋼構的料厚、空心,若擠型抽出變形對於施工者與現場施工,會產生主架料與連結副架料的接觸面無法完全吻合! 
傳統PC採光罩:易碎 易氧化 不耐擊 不安全 無防盜功能 不美觀。
南方松:雖然美觀耐撞擊不生鏽的優點,但是長久下來,所吸收的雨水將導致與玻璃接合面鬆脫;加上是木造材質,容易有腐蝕的危險存在。
白鐵:耐撞擊、質硬、不易生鏽的優點,但是並非完全不生鏽,如果烤漆,漆也容易脫落。
鐵材:耐撞擊、耐強壓的優點,缺點是容易生鏽,無法達到美觀之效果。

相較之下,H型鋁鋼構綜合了以上幾種材料的優點,並且改善了以上材質的缺點,取代了以往材質之採光罩,而成為了新一代採光罩,並被業界所廣泛使用!

2015年7月8日 星期三

RSSI signal for CC2541

from http://e2e.ti.com/support/wireless_connectivity/f/538/p/212876/809168
The panel is placed a std. distance away from a BLE gateway that's also based upon the CC2541 chip.   The RSSI is monitored with an internal .net application.  Most of the advertisers consistently display RSSI values in the -29 to -32 range on all three channels.  A few, however, will display in that range for two of the channels, but in the -48 to -52 for the other channel... and it's not any one specific channel that's always the "bad" channel.  And if I "spin" the panel in 90 degree increments, the same advertisers are inconsistent, so it's not related to position on the panel or orientation.  I also see "good" advertisers go "bad" for awhile, then go back to "good"... this testing is taking place in an isolated test bed so interference is minimal.

Sometime, the value is not changed.
http://e2e.ti.com/support/wireless_connectivity/f/538/p/407118/1443292


  • Excellent link budget (up to 96 dB), enabling long-range applications. 
  • Accurate digital received signal-strength indicator (RSSI) 
Sensitivity -96 dBm
High/Standard Gain Mode -70 dBm (BT spec)
http://pideu.panasonic.de/pdf/168Datasheet.pdf 

RSSI for distance indicator: comment from TI engineer:
http://e2e.ti.com/support/wireless_connectivity/f/538/p/311434/1086588
Unfortunately, RSSI is not a good indicator of distance or location because there are so many environmental factors that can affect the signal strength. The BT-SIG is working on some modifications to the BLE protocol that will allow for location and distance calculations; however those are based on very low-level changes to the protocol and are probably a few years away from being adopted.

You likely won't be able to see much difference in the RSSI value between 0-10 ft and the results will not be consistent.  The Proximity profile defines the behavior when a device moves away from a peer device so that the connection is dropped or the path loss increases above a preset level, causing an immediate alert.  It is not meant to distinguish between gradual distance changes.


Improving RSSI Readout Accuracy It is important to be aware that in a real system, the output power from the transmitter and variations in the transmission path will contributes to the RSSI inaccuracy. However, there are certain steps one can do, to improve the RSSI readout accuracy 1) Calculate an average RSSI value based on several readouts. (From TI document) 
http://www.ti.com/lit/an/swra114d/swra114d.pdf


RSSI calculation for CC254x: (From https://e2e.ti.com/support/wireless_connectivity/f/538/t/140189)
After connecting to a peripheral device.  I'm able to call the HCI_ReadRSSI (0x1405) command.  The RSSI values that I get are ranging from 0xB7 (183) to 0xCA (202).  I have set the RxGain to High using the HCIExt_SetRxGain, so the RX sensitivity is -93 dBm. 
The number is signed (2's complement), so 0xB7 means -73 and 0xCA means -54. If your design differs from the reference design, you may need to compensate for differences in the balun gain, other than that, you can take the number directly as a dBm number.
When you call the HCI_ReadRSSI command, the software calculates the RSSI in dBm. The packet sniffer output, which was used in the original question, is a raw number. It is still in dB, but with a different reference. To find the dBm number, a value such as -93 must be added. The number depends on the receiver gain mode, which is taken into account when using HCI_ReadRSSI.
For raw data, should do the calculation:
Packet index: 5
Length: 48
Raw data (hex): D6 BE 89 8E 00 25 30 B2 00 FF EE CC 02 01 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 92 E2 95 3AA5
RSSI [dBm]: -36
CRC OK: 1
I assume 3A is the rssi value.
Sensitivity Best (-93 dBm).
-93d + 58d = -35 --> (0 to -35) = -36

About dB & dBm (Chinese)
http://zhidao.baidu.com/question/14279833.html