2018年12月13日 星期四

nRF52832 flash write,read,erase through BLE communication

1. Connect to nRF52832 Development Kit






























2.The app send flash read command to nRF52832




















3.nRF52832 receive flash read command will display 128 bytes read data from flash 0x3f000











4.The app send flash write command to nRF52832




















5.nRF52832 receive flash write command will generate 128 bytes random data and write to flash

6.Read and confirm
7.Write again 

8.Read and confirm 

9.The app send flash erase command




















10..nRF52832 receive flash erase command and erase success

11.Read and confirm

2017年2月7日 星期二

CC2540 / CC2541 BLE RTC TEST

CC2540 / CC2541 RTC TEST

1. Reset RTC to default (Default RTC  Time : 2000 Jan 01 00:00:00)

2.  Set the current time





























3. RTC check















4.Leap year




5. Long-term test accuracy ...



 

2017年1月18日 星期三

CC2530 Zigbee network device lost auto maintain associated

1.Network initial state





















2.Move 0xC6C4 out of zigbee network range
   00 : 45  >> 0xC6C4 out of range
   01 : 15  >> 0x2C5C get new short address and parent node


3.Check Coordinator child node and associated
4.Check 0x19B1 parent node,child node,associated
5.Move 0xC6C4 (0x00124B0002017DD6) into zigbee network range
   00 : 25  >> 0x00124B0002017DD6 join the zigbee


6.Check 0x00124B0002017DD6 short address,parent node,associated
7.Check 0x19B1 parent node,child node,associated





2017年1月15日 星期日

CC2530 When the device lost and the net association full how to join the new device to the zigbee net?

1. Define Zigbee Network Architecture













2.Coordinactor info check
3.Sensor Monitor

























4.Router 1~4 info check




















































































































5.The R3 power down to simulation the device lost and add the R5 to join the network


























6.Packet Sniffer to check the R5





















7.How does the R5 join to the network?


























8.To delete the 0x6B3E association list


























9.Check The R5 info





























10.Check The 0x6B3E Association List




2017年1月12日 星期四

CAN bus (Controller Area Network) - Signal Measure

● CAN Signal Measure

































● 8 Byte Data TX





CAN bus (Controller Area Network) - Bit Encoding

● CAN bus Non-Return-to-Zero-Coding










● CAN bus Bit-Stuffing Rule













● CAN bus Bit-Timing











● CAN bus Sub-Bit Segments






每一個 Bit Timing Segment 是由整數個單位時間所組成, 稱為 Time Quanta (TQ)
TQ 設定為 2*(BRP + 1 )*(Tosc) -> (Tosc = 1/Fosc)
更改Baud Rate的預除器(BRP) 將變更TQ 的時間 (Min = 1:1, Max = 1:64)



















● CAN bus Practical Bus Length












● CAN bus Resynchronization (1)














● CAN bus Resynchronization (2)















CAN bus (Controller Area Network) - Error Handling(2)

● CAN bus Error Handling - Error States of CAN Node














每一個 CAN node 都有各自獨立的 傳送以及接收錯誤計數器 :
         TEC ( Transmit Error Counter )
         REC ( Receive  Error Counter )
CAN 協定根據Error Counter 的內容將錯誤狀態分為三種 :
         Error Active、Error Passive、Bus-Off
根據 Node 的狀態不同, 控制 CAN Bus 的能力也跟著調整 ( Active > Passive > Bus-Off )
如果到達了 Bus-Off 的狀態條件 (TEC>255), CAN node將自身設定為完全離線狀態
進入Bus-Off狀態的Node ; CAN 定義了Recovery的程序以便使其重回到Active狀態











● Error-Active :
CAN node可以主動地傳送或接收訊息(messages)和Error-Frames(一般正常的工作模式)
偵測到錯誤時,CAN Node 將送出正常 Error Frame( 6 個 Dominate 位元的 Active Error Flag)
的方式將正傳送中的 message 中斷掉
這樣的做法違反了Bit-Stuffing的原則,所以其他的CAN Node也將產生它們自己的Error Frames(稱為錯誤回應旗標 -> Error Echo Flags)。
每當偵測到有錯誤發生, 適當的錯誤計數器,一旦Error Frame 完成後,bus 的活動又回到正常狀態,Message 將會被重新傳送

● Error-Passive :
當TEC或REC計數器超過了127,CAN Node變進入Error-Passive的狀態
Passive Error Flags的Error Frames將不會影響傳送中的 Message
當Error Frame完成後,處於Error-Passive的Node會等到以下條件符合才會被致能傳送
在Dominate位元之後有3個Recessive位元(Intermission)加上8個Recessive位元的時間長(Suspend Transmission)

● CAN bus Error Handling - Passive Error Frame









● CAN bus Error Handling - Suspend Passive Transmission








● Bus-Off :
當TEC計數器值超過 255,控制器將進入Bus-Off狀態
CAN Node將無法傳送或接收任何的Message或錯誤狀態
經過以下的程序,CAN Node可再度回到Error Active的狀態
接收到正確的Bus Recovery程序(11個連續的Recessive位元發生128次)
經由硬體或軟體的重置動作。
將控制器設定成Configuration Mode

● CAN bus Error Handling - Transmit Error Counter














● CAN bus Error Handling - Receive Error Counter














● 錯誤偵測的的重點整理
CAN Nodes可依錯誤的嚴重程度來自動地減少它們對Bus的控制能力
不同Error-States間的差異在於錯誤的Node該如何被限制行為
CAN對錯誤時的能力限制(Fault Confinement)可防止有缺陷的Node使得整個網路當掉
● CAN bus Overload Frame
當一個Node需要較多的時間來處理所接收的資料時,便送出Overload Frame
當間隔位元少於規定值時(最少要 3 個 recessive bits)也會發生
間隔位元(Intermission)使CAN Node有時間做內部資料處理









● Interframe Space
幀間空間包括Intermission、Bus idel
如果是"Error-Passive"的Node要發送報文時,Interframe Space除了Intermission、Bus idel,
還包括Suspend Transmission
不是“錯誤被動”的Node,Interframe Space如下 :









是“錯誤被動”的Node,Interframe Space如下 :