2017年1月12日 星期四

CAN bus (Controller Area Network) - 概述

● 一種差動串列協定,提供高安全及有效率的即時控制。具備了強大的偵錯和優先權判機制,這樣的機制下,網路訊息的傳輸變的更可靠而有效率

● 利用訊息識別(Message Identifier)來定義內容和資訊的優先順位,以進行資訊的傳遞

● CAN BUS優點

1. 低成本:
CAN具有的完善的通信協定,由CAN控制器晶片及其介面晶片來實現,降低系統開發難度,縮短了開發周期

2. 高的BUS利用率:
CAN的所有節點共用一條BUS,可以任意的增加或減少節點(不得超過最大節點數)。

3. 遠的數據傳輸距離:
CAN的最大傳送距離為 10KM,此時的最大數據傳輸率為 5K bit/s

4. 高的數據傳輸率:
CAN的最大數據傳輸率為 1M bit/s,此時的最大傳送距離為 30M

5. 根據報文的ID決定接收或屏蔽該報文:
每個CAN上的節點都能收到所有的報文,每一筆資料均由標誌符(ID)來指定功能訊息、 優先級訊息,可以支援任意的增加或刪除節點,以及由節點自行判斷各訊息的優先程度,使CAN匯流排構成的網路各節點之間的資料通信即時性強,提高系統的可靠性和系統的靈活性

6. 可靠的錯誤處理與偵錯機制:
CAN BUS針對硬體和軟體均設計有偵錯機制

7. 發送的訊息遭到破壞後可自動重發: 
當偵測到發送失敗,不論是優先權不足或是BUS ERROR,會自動重發訊息

8. 節點在錯誤嚴重的情況下具有自動退出總線的功能:
當某一節點的硬體或軟體不良造成 BUS 有嚴重的錯誤時,會自動將自己關閉,避免影響其它節點的傳輸

● CAN BUS與一般的傳輸介面不相同的地方
1. 報文優先權 (prioritization of messages):
依據報文的優先權來傳遞資料
2. 保證延遲時間 (guarantee of latency times):
CAN BUS可以在一定的研遲時間,自行將訊號同步
3. 設置靈活 (configuration flexibility):
可以任意的增加或刪除節點
4. 時間同步的多點接收 (multicast reception with time synchronization):
送出的資料每個節點都會接收,非點對點傳輸
5. 多主機 (multimaster):
每個節點都是主機 (Master),無主僕之分
6. 錯誤偵測和標定 (error detection and signaling):
會自動偵錯並記錄次數。

7. 總線一有空就自動傳送被破壞的報文:
當傳送有誤時會自動再送,而非回應無法傳送

8. 將節點的暫時性與永久性錯誤分開,並且可以自動關閉錯誤節點 : 遇到節點嚴重錯誤,會自動關閉節點,待特定條件後重開

2016年8月4日 星期四

CC2540 / CC2541 AES-CBC Encrypted / Decrypted for Notification

1.Notification Process






















2.Set KEY and IV






























3.Encrypted notification data and transmit to central

4.Central receive encrypted data





























5.Central enter IV and KEY






























6.Central decrypted





























7.Central enter wrong IV to decrypted



























































8.Central enter wrong KEY to decrypted



CC2540 / CC2541 AES-CBC Encrypted / Decrypted for Write

1.Write Process















2.Set IV.



















3.Set KEY.






























4.Encrypted write data and transmit to peripheral.
 5.Peripheral receive encrypted data



6.Peripheral enter KEY and IV





































7.Peripheral decrypted 

CC2540 / CC2541 AES-CBC Encrypted / Decrypted for Write

1.Write Process















2.Set IV.



















3.Set KEY.






























4.Encrypted write data and transmit to peripheral.
 5.Peripheral receive encrypted data



6.Peripheral enter KEY and IV





































7.Peripheral decrypted 

2016年7月6日 星期三

CC2541 Create 128 UUID and Custom UUID

TI Tutorial :
http://processors.wiki.ti.com/index.php/Tutorial:_How_to_Create_a_Custom_Bluetooth_Smart_Embedded_Application_with_the_CC2650DK

define 128-bit UUID : F000-EE00-0451-4000-B000-000000000000
define Characteristic 1 Properties : Read
define Characteristic 2 Properties : Write / Notify
define Characteristic 3 Properties : Read

1.Advertising Packet

















2.Central(Android phone) connection with CC2541





















3.Check characteristic properties


































4.Read characteristic 1 default value


















5.Peripheral (CC2541) set characteristic 1 value:


























6.Read characteristic 1 Value
















7.Central (Android phone ) write data to peripheral (CC2541) 

















8.Peripheral (CC2541) receive the write data

























9.Enable Notification

















10.Peripheral (CC2541) send notification data to central (Android phone )  

























11.Central receive the notification data

















12.Read characteristic 3 default value

















13.Peripheral (CC2541) set characteristic 3 value

























14.Read characteristic 3 value