RENESAS BLE 實作課程 Jack Chen Victron Technology CO., LTD 2015 Renesas Electronics Corporation. All rights reserved.

Similar documents
SSL VPN User Manual (SSL VPN 連線使用手冊 )

Oxford isolution. 下載及安裝指南 Download and Installation Guide

PC Link Mode. Terminate PC Link? Esc. [GO]/[Esc] - - [GO]/[Esc] 轉接座未放滿. Make auto accord with socket mounted? [GO]/[Esc] Copy to SSD E0000

一般來說, 安裝 Ubuntu 到 USB 上, 不外乎兩種方式 : 1) 將電腦上的硬碟排線先予以排除, 將 USB 隨身碟插入主機, 以一般光碟安裝方式, 將 Ubuntu 安裝到 USB

桌上電腦及筆記本電腦安裝 Acrobat Reader 應用程式

港專單一登入系統 (SSO) 讓本校的同學, 全日制及兼職老師只要一個登入帳戶, 便可同時使用由本校提供的網上系統及服務, 包括 Blackboard 網上學習平台, 港專電郵服務, 圖書館電子資料庫及其他教學行政系統.

2009 OB Workshop: Structural Equation Modeling. Changya Hu, Ph.D. NCCU 2009/07/ /07/03

購票流程說明 How To purchase The Ticket?

全面強化電路設計與模擬驗證. Addi Lin / Graser 2 / Sep / 2016

Figure 1 Microsoft Visio

UAK1-C01 USB Interface Data Encryption Lock USB 資料加密鎖. Specifications for Approval

Version Control with Subversion

Increase Productivity and Quality by New Layout Flow

BTC, EMPREX Wireless Keybaord +Mouse + USB dongle. 6309URF III Quick Installation Guide

購票流程說明 How To purchase The Ticket?

Quick Installation Guide for Connectivity Adapter Cable CA-42

第九章結構化查詢語言 SQL - 資料定義語言 (DDL) 資料庫系統設計理論李紹綸著

InTANK ir2771-s3 ir2772-s3. User Manual

4Affirma Analog Artist Design Flow

JAVA Programming Language Homework V: Overall Review

CLAD 考前準備 與 LabVIEW 小技巧

Chapter 7. Digital Arithmetic and Arithmetic Circuits. Signed/Unsigned Binary Numbers

The notice regarding Participation Ways of our global distributor video conference on Feb. 5.

VB 拼圖應用 圖形式按鈕屬性 資科系 林偉川

SOHORAID ST8-TB3 User Manual

外薦交換生線上申請系統操作說明 Instruction on Exchange Student Online Application System. [ 中文版 ] [English Version]

InTANK ir2622 User Manual

Frame Relay 訊框中繼 FRSW S0/0 S0/1

InTANK ir2623-s3 User Manual

SOHOTANK PD3500+ User Manual

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

Preamble Ethernet packet Data FCS

Digital imaging & free fall of immersed sphere with wall effects

UNIX Basics + shell commands. Michael Tsai 2017/03/06

Allegro SPB V16 Advance

Java 程式設計基礎班 (7) 劉根豪台大電機所網路資料庫研究室. Java I/O. Class 7 1. Class 7

Java 程式設計基礎班 (7) 莊坤達台大電信所網路資料庫研究室. Java I/O. Class 7 1. Class 7 2

使用 TensorFlow 設計矩陣乘法計算並轉移執行在 Android 上 建國科技大學資管系 饒瑞佶 2017/8

MH-3621-U3 Clone Dual SATA HDD Docking System

English G H. Package Contents. Hardware Requirements. Technical Specifications. Device Overview. MSI DS502 GAMING HEADSET User Guide

Chapter 7. Signed/Unsigned Binary Numbers. Digital Arithmetic and Arithmetic Circuits. Unsigned Binary Arithmetic. Basic Rules (Unsigned)

EZCast Wire User s Manual

EZCast Docking Station

微算機原理與實驗 Principle of Microcomputer(UEE 2301/1071 )

Protech RMA Request Form

游家德 Jade Freeman 群智信息 / 敦群數位資深架構顧問

EZCast Wire. User s Manual. Rev. 2.00

49 <script type="text/javascript"> 50 var gcid=0,sex=false,birthday=kendo.tostring(new Date(),"yyyy/MM/dd"); 51 $(function(){ 52

Multimedia Service Support and Session Management 鍾國麟

Android + TIBBO + Socket 建國科技大學資管系 饒瑞佶

C B A B B C C C C A B B A B C D A D D A A B D C C D D A B D A D C D B D A C A B

步驟 1: 首頁以 facebook 或 google 帳號登入, 並點選節目 Step 1:Log in with your facebook/google account, then click the show banner.

Operation Function Locations. Operations. Wireless Microphone Wireless Receiving Features. Wireless Transmission Audio Function Operations

AVG Anti-Virus User Manual. Document revision ( )

Software Architecture Case Study: Applying Layer in SyncFree

FCC Compliance Statement:

User s Manual / 使用手冊 Model : TIP-M200ST-BK

Additional Information

Invitation to Computer Science 5 th Edition. Chapter 8 Information Security

Lotusphere Comes to You 輕鬆打造 Web 2.0 入口網站 IBM Corporation

黃河凱. Kaiser Huang 巨匠電腦北區 / 新竹認證中心認證講師國立新竹教育大學數位學習科技研究所在職生微軟原廠認證講師 MCT

微軟商務用 Skype 雲端視訊會議及與所需頻寬介紹

EdConnect and EdDATA

Port GCC to a new architecture Case study: nds32

Gigabyte and Giga-byte are trademarks of Giga-byte Technology Co., Ltd. Microsoft and Windows XP are trademarks of Microsoft Corporation.

Twin API Guide. How to use Twin

多元化資料中心 的保護策略 技術顧問 陳力維

Quick Installation Guide

Password Protection 此篇文章說明如何在程式中加入密碼保護的機制, 當程式開啟, 使用者必須先輸入使用者帳號及密碼, 若是合法使用者才能進入應用程式

// 範例 4-1: 連結資料庫 (connectdb.php) <?php mysql_connect("localhost", "student", "Asia2013"); mysql_select_db("student");?>

Chapter 4 (Part IV) The Processor: Datapath and Control (Parallelism and ILP)

3.1 Animation. Rotating Square

Chapter 7 Pointers ( 指標 )

SPI 功能使用方法 Application Note

描述性資料採礦 Descriptive Data Mining

DVS-8501E/DVS-8501E-H 單路 H.264 數位影像編碼器


DVS-8504E-H 四路 H.264 數位影像編碼器

VZ-P18 和 VZ-P38 專業教材提示機 完美的展示效果

Use of SCTP for Handoff and Path Selection Strategy in Wireless Network

The transformation relationship between defense enterprise architecture and C4ISR system architecture

微處理機系統 吳俊興高雄大學資訊工程學系. February 21, What are microprocessors (µp)? What are the topics of this course? Why to take this course?

Quick Installation Guide

What is a Better Program?

Print Specs: HP Deskjet C5100 All-in-One series Setup Guide

PUB. DIM Wi-Fi Basic Setup Guide. Wi-Fi 基本设置指南. Wi-Fi 基本設定指南 在使用本产品之前, 请务必先仔细阅读本使用说明书 请务必妥善保管好本书, 以便日后能随时查阅 ( 保留备用 ) 请在充分理解内容的基础上, 正确使用

Operating Systems 作業系統

Dr. Whai-En Chen. Institute of Computer Science and Information Engineering National Ilan University TEL: #340

Ubiquitous Computing Using SIP B 朱文藝 B 周俊男 B 王雋伯

Citrix CloudGateway. aggregate control. all apps and data to any device, anywhere

Syntest Tool 使用說明. Speaker: Yu-Hsien Cheng Adviser: Kuen-Jong Lee. VLSI/CAD Training Course

打造新世代企業資料中心 Windows Server 2016 重裝登場. 馮立偉 Hybrid Cloud Lead Microsoft Taiwan

ICP Enablon User Manual Factory ICP Enablon 用户手册 工厂 Version th Jul 2012 版本 年 7 月 16 日. Content 内容

Common Commands in Low-Level File I/O

Install Manual. Advanced Printer Driver Ver.4. Overview. Installation and Setup. Silent Installation. M Rev. H

Important Safety Instructions

Multilingual Version. English. 中文 Français. Español 日本語. Deutsch. Italiano

RTL8710BN Build and Debug Environment Setup IAR

Briefing Session on 2013 HKDSE ICT Exam. 22/23 Nov 2013

Transcription:

RENESAS BLE 實作課程 2016-01-21 Jack Chen Jack.chen@victron.com.tw Victron Technology CO., LTD

AGENDA CS+ & Renesas Flash Programmer 安裝 3 Renesas Flash Programmer 燒錄介紹 6 CS+ 介面介紹 11 CS+ 開啟 Project & 使用教學 14 CS+ 實作 - 手機控制 LED 23 Page 2

CS+ & Renesas Flash Programmer 安裝

CS+[ Download ] 1 2 3 4 CS+ 的下載 1. 進入 CS+ 下載頁面 (CS+ Download) 2. 尋找右圖的載點位置, 並下載 CS+ 的安裝 5 6 1. 安裝前 : 電腦需安裝 Microsoft Visual C++ 2008 SP1 Redistributable Package, 或是安裝的時候電腦需連網路 2. 點開安裝檔, 將會彈出頁面, 請跟著紅箭頭一 步一步往下即可安裝成功 7 Page 4

Renesas Flash Programmer[ Download ] RFP 的下載 1 2 3 1. 進入 RFP 下載頁面 (RFP Download) 2. 尋找右圖的載點位置, 並下載 RFP 的安裝 1. 點開安裝檔, 將會彈出頁面, 請跟著紅箭頭一步一步往下即可安裝成功 4 5 Page 5

Renesas Flash Programmer 燒錄介紹

Renesas Flash Programmer - Menu 1. Blank Check 檢查MCU的Memory是否空白 2. Erase 清除MCU的Memory 3. Program 燒錄檔案 4. Verify 檢查所燒錄檔案是否和Program File相 同 6. Checksum 讀取MCU中Memory的Check sum 7. Autoprocedure (E.P) 先清除Memory在將檔案燒錄進去 8. Signature Read 讀取MCU的產品訊息 9. Get Flash options 讀取MCU中Flash的設定值 5. Set Security 設置Serurity Page 7

Renesas Flash Programmer Programmer(1) 1. 開啟 Renesas Flash Programmer 2 2. 選擇 Create New Workspace & Basic mode 1 3. 再 Microcontroller 選擇 MCU 系列 4. Filter 可直接輸入 MCU 型號去搜尋 5. 於 Using Target Microcontroller 選擇 MCU 型號 3 & 4 6. Workspace Name 輸入欲創建的 Projece name 5 6 Page 8

Renesas Flash Programmer Programmer(2) EZ-Cube 燒錄 Tool 選擇電腦所抓到的 COM Port 輸入 3.3V E1 燒錄 Tool 選擇 E1 選擇輸入電壓 3.3V Note : 欲燒錄的目標板, 耗電流不得大 200mA, 如果超過可能會導至燒錄失敗, 超過請選擇不要供電, 目標板請自行供電 Page 9

Renesas Flash Programmer Programmer(3) Project Settings 此頁面可查看所設定的值, 如設定錯誤可按下 Modify 重新設定, 設定完成時, 選則 Completem 選擇分頁 Other Settings, 再 Program File 的 Check Sum of Code Flash 可觀察欲燒錄的 Check Sum( 需先載入 Hex 檔 ) 燒錄頁面 於 User/Data area 按下 Browse 選擇欲燒錄的 Hex 檔案, 按下 Start 開始燒錄燒錄時會出現進度, 當燒錄完成時會出現 PASS Page 10

CS+ 介面介紹

CS+[ 介面介紹 ] - Start Page 12

CS+[ 介面介紹 ] - 開發介面 Debug Tool Bar Work area Project tree Output Area Page 13

CS+ 開啟 Project & 使用教學

CS+[ Open Project ] - Open Project 1.Open Existing Project GO 2. 選擇 Project 的專案檔 (*.mtpj) 3. 開啟路徑如下 : xxxx\sampleprofilev1.1\project_source\renesas\t ools\project\cubesuite\ble_embedded 1 2 Page 15

CS+[ Open Project ] - Project Tree 1. Compiler 設定選項 Macro definition 可修改 G1D 的相關設定 2. Debug Tool 選擇 按滑鼠右件開啟選單 選擇 Using Debug Tool 選擇 RL78 EZ Emulator 1 2 Page 16

CS+[ Open Project ] - Debug Tool Bar Page 17

CS+[ Open Project ] - Watch 1. 選取欲觀察的變數 2. 按下滑鼠右鍵選取 Register to Watch1 3. 即可再右邊室窗看到變數值 1 2 3 Page 18

CS+[ Open Project ] - Set Breakpoint 1. 設定斷點 : - 在需停下的 Address 前, 點選滑鼠左鍵 2. 取消斷點 : - 在需取消的斷點前, 點選滑鼠左鍵 Page 19

CS+[ Open Project ] - View Disassemble 1. 上面選單列選取 View 2. 選取 Disassemble1 2. 3. 即可再 workarea 看到 Disassemble 1. Page 20

CS+[ Open Project ] - View Memory 1. 上面選單列選取 View 2. 選取 Memory 2. 3. 即可再畫面右側看到 Memory 1. Page 21

CS+[ Open Project ] - View SFR 1. 上面選單列選取 View 2. 選取 SFR 2. 3. 即可再畫面右側看到全部 SFR 的設定值 1. Page 22

CS+ 實作 LED Control

CS+[ LED Control ] USB Stick 使用說明 (1) USB 連接電腦 Debug 線路 Debug or UART 選擇 藍芽模組 Page 24

CS+[ LED Control ] USB Stick 使用說明 (2) USB LED Power BLE Module 1 6 1 Use Programmer R1 R6 Need Short 1. Vcc 2. X 3. TOOL0 4. X 5. RESET 6. GND 1 2 3 UART / On Chip Debug 1-2 On-Chip Debug 2-3 UART Page 25

CS+[ LED Control ] - Change MAC address & Device name 1. 修改藍芽模組的 MAC address : 開啟 Config.h 並移至第 79 行 #define CFG_TEST_BDADDR {{0x00, 0x00, 0x00, 0xff, 0xff, 0xff}} 2. 修改 Broadcast 的 local name : 開啟 app.c 並移至 218 行 修改總資料長度 3+13 3+14 修改資料內容 13 資料長度 0x09 數據類型 數據內容 13, 0x09, 'V', 'i', 'c', 't', 'r', 'o', 'n', '-', 'J', 'a', 'c', 'k', /* Complete local name */ 3. Default device name 開啟 prf_config.h 的 90 行 #define GAP_DEV_NAME "Victron-Jack" Page 26

CS+[ LED Control ] GATT Protocol Service 每個 Profile 都會有多個 Service, 每個 Service 都會用 UUID 定義服務的起點 /* Sample Custom Service */ static const uint8_t samplecustom_svc[rble_gatt_128bit_uuid_octet] = RBLE_SVC_SAMPLE_CUSTOM; Characteristic 再每個 Server 裡面會再用 UUID 去區分每個特徵 每個特徵都會有 - Character - Value - Descriptor Page 27

CS+[ LED Control ] 建立藍芽屬性數據庫 開啟 prf_config.c 的第 2013 行, 依照藍芽 GATT 的規範去建立對應的屬性數據庫 //=================================================================== { RBLE_DECL_CHARACTERISTIC, sizeof(scps_led_ctrl_char),sizeof(scps_led_ctrl_char),task_attid(task_rble, SCS_IDX_LED_CTRL_CHAR),RBLE_GATT_PERM_RD,(void *)&scps_led_ctrl_char }, { DB_TYPE_128BIT_UUID, sizeof(scps_led_ctrl_char_val),sizeof(scps_led_ctrl_char_val),task_attid(task_rble, SCS_IDX_LED_CTRL_VAL),(RBLE_GATT_PERM_RD RBLE_GATT_PERM_WR),(void *)&scps_led_ctrl_char_val_elmt }, { RBLE_DESC_CHAR_USER_DESCRIPTION, sizeof(scps_led_ctrl_desc),sizeof(scps_led_ctrl_desc),task_attid(task_rble, SCS_IDX_LED_CTRL_DESC),(RBLE_GATT_PERM_RD),(void *)&scps_led_ctrl_desc[0] }, //=================================================================== Page 28

CS+[ LED Control ] - 加入 Sample Profile 宣告 開啟 prf_config.c 的第 1125 行, 加入宣告, 建立表格去對應藍芽 GATT 的屬性數據庫 //======================================================================= /*Sample Custom Service Indicate Demo */ static const struct atts_char128_desc scps_led_ctrl_char = { RBLE_GATT_CHAR_PROP_WR RBLE_GATT_CHAR_PROP_RD, {(uint8_t)(scs_hdl_led_ctrl_val & 0xff),(uint8_t)((SCS_HDL_LED_CTRL_VAL >> 8) & 0xff)}, RBLE_CHAR_SCP_LED_CTRL}; uint8_t scps_led_ctrl_char_val = 0x01u; struct atts_elmt_128 scps_led_ctrl_char_val_elmt = { RBLE_CHAR_SCP_LED_CTRL, RBLE_GATT_128BIT_UUID_OCTET, &scps_led_ctrl_char_val }; static const uint8_t scps_led_ctrl_desc[] = { 'L', 'e', 'd', '-', 'C', 't', 'r', 'l', 'D', 'e', 'm', 'o' }; //======================================================================== Page 29

CS+[ LED Control ] - 增加數據的 Handle 1. 先將 dbhandle.h 加入至 Project, 位置如下 xxxx\sampleprofilev1.1\project_source\renesas\src\arch\rl78 2. 開啟 dbhandle.h 的第 386 行, 加入對應的數據 //========================================== SCS_HDL_LED_CTRL_CHAR, SCS_HDL_LED_CTRL_VAL, SCS_HDL_LED_CTRL_DESC, //========================================== Page 30

CS+[ LED Control ] - 增加數據的索引 開啟 prf_config.h 的第 173 行, 加入對應數據的索引 //========================================== SCS_IDX_LED_CTRL_CHAR, SCS_IDX_LED_CTRL_VAL, SCS_IDX_LED_CTRL_DESC //========================================== Page 31

CS+[ LED Control ] Define UUID 1. 開啟 rble_api_custom.h 的第 35 行 //=========================================================== #define RBLE_CHAR_SCP_LED_CTRL{0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x 00,0x00,0x00,0x07} //=========================================================== 2. 開啟 rble_api_custom.h 的第 65 行 //=========================== RBLE_SCP_SCS_LED_CTRL //=========================== Page 32

CS+[ LED Control ] 增加寫入資料的程式 (1) 開啟 spcs.c 的第 234 行 //=============================================== case SCS_HDL_LED_CTRL_VAL: val_len = 1; break; //=============================================== Page 33

CS+[ LED Control ] 增加寫入資料的程式 (2) 開啟 spcs.c 的第 373 行 case SCS_HDL_LED_CTRL_VAL: if(result == RBLE_OK) { scps_send_chg_char(rble_scp_scs_led_ctrl, &scps_info.event_data.param.write_cmd_ind.value[0], 1); } /* send response */ if(scps_info.event_data.param.write_cmd_ind.resp == TRUE) { scps_send_response(scps_info.set_data_hdl[tmp_rp], result); } break; Page 34

CS+[ LED Control ] 設定控制 LED 的 IO(1) 1. 開啟 led.c 的第 69 行, 設定控制 LED 的 IO 腳位的初始化 //======================================== write1_sfr(pmc0, 2, 0); write1_sfr(pmc0, 3, 0); write1_sfr(p0, 2, 0); write1_sfr(p0, 3, 0); write1_sfr(pm0, 2, PORT_OUTPUT); write1_sfr(pm0, 3, PORT_INPUT ); //======================================== 2. 開啟 led.c 的第 169 行, 設定 LED 的初始化 //================================= write1_sfrbit(led03, OFF ); //================================= Page 35

CS+[ LED Control ] 設定控制 LED 的 IO(2) 3. 再 led.c 的地方, 增加 LED 控制的副程式 //=========================================================== extern uint8_t scps_led_ctrl_char_val; void led_ctrl(void) { unsigned char led_check=0; led_check = scps_led_ctrl_char_val; if(led_check == 0x00){ write1_sfrbit(led03, ON );} else{ write1_sfrbit(led03, OFF);} } //=========================================================== Page 36

CS+[ LED Control ] 設定控制 LED 的 IO(3) 4. 開啟 led.h 的增加宣告 //======================= ///LED3 is pin 2 on Port 0 #define LED03 P0.2 //======================= //======================= void led_ctrl(void); //======================= 5. 開啟 arch_main.c 並再第 348 行的主迴圈呼叫 LED 控制的副程式 //======================= led_ctrl(); //======================= Page 37

CS+[ LED Control ] 執行 2 4 1. 開啟 BLE Scanner 2. 選取 Victron-Jack (local name) 3. 開起 Service 4. 即可看到新增的特徵, 按下寫入 5. 輸入傳輸的數值 將 Text 修改成 Byte Arrar 輸入數值 00 (0x00) 6. 此時可以看到 Hex: 0x01 Hex : 0x00,LED 亮起 3 5 Page 38

Thank You! Page 39