(DA14580_bootloader)官方手册
DA14580如何添加配对密码
= user_app_on_tk_exch_nomitm,
.app_on_irk_exch
= NULL,
.app_on_csrk_exch
= NULL,
.app_on_ltk_exch
= default_app_on_ltk_exch,
.app_on_pairing_succeded
= user_app_on_pairing_succeeded,
2
中电港 钟志峰
#if (BLE_APP_SEC) void user_app_on_tk_exch_nomitm(uint8_t connection_idx, struct gapc_bond_req_ind const *param); void user_app_on_encrypt_req_ind(uint8_t connection_idx, struct gapc_encrypt_req_ind const *param); void user_app_on_pairing_succeeded(void); #endif // BLE_APP_SEC
// By default we send hardcoded oob data uint8_t oob_tk[KEY_LEN] = APP_SECURITY_OOB_TK_VAL;
app_easy_security_tk_exch(connection_idx, (uint8_t*) oob_tk, KEY_LEN); } #else default_app_on_tk_exch_nomitm(connection_idx, param); #endif }
DA14580蓝牙智能系统级芯片(SoC)
DA14580蓝牙智能系统级芯片(SoC)推出的号称全球功率最低、体积最小的SmartBond DA14580智能系统级芯片(),与竞争计划相比,该产品可将搭载应用的智能型手机配件,或计算机周边商品的电池巡航时光延伸一倍。
DA14580简介:Dialog推出的号称全球功率最低、体积最小的SmartBond DA14580蓝牙智能系统级芯片(SoC),与竞争计划相比,该产品可将搭载应用的智能型手机配件,或计算机周边商品的电池巡航时光延伸一倍。
该款芯片的设计目的是透过无线方式将键盘、鼠标或遥控器与平板计算机、笔记型计算机或智能电视户相衔接;让消费者能够透过智能型手机和平板计算机上的各种创新应用,与手表、护腕或智能卷标建立衔接,实现如“自我评测”健康和身体情况,和寻觅遗失的钥匙等各种功能。
SmartBond是首款突破4mA无线收发极限的蓝牙智能解决计划,能够让设计人员将产品的电池续航时光延伸一倍,或缩减所需电池的数量和大小。
其独特的低功率架构的无线收发电流仅消耗3.8mA,比市场上其它蓝牙智能解决计划低50%,而且其深度睡眠模式的电流低于600nA。
这表示在一个每秒发送20字节的产品中,一颗 225mAh纽扣电池可以让其持续运作4年5个月;与此相比,前几代蓝牙智能技术仅能维持2年时光。
DA14580拥有一个功率管理区块,内含一个DC-DC转换器以及全部须要的,从而降低对外部组件以及总物料清单的需求。
透过精准地打开和关闭每个芯片块的供电,Dialog能够将功耗降至最低。
SmartBond 的运作可降低至此前所未有的0.9V,从而实现用法一颗碱性电池或镍锰电池就能运作计算机或智能电视周边商品,而过去则需要两颗电池。
这为设计人员放开了通往很多新设计思路的大门,让他们能够开发出超紧密和新尺寸的产品,同时降低系统的总成本。
能源采集技术,如采集到的光能或动能,也可以用于对支持系统运作的可充电电池举行充电。
第1页共5页。
DA14580 SUOTA在IOS平台的使用方法
BD0006-DA14580 SUOTA在IOS平台的使用方法文档版本:v0.0.4本文只介绍在IOS下用SUOTA APP给DA14580升级新程序,关于DA14580的img 文件怎么制作,怎么烧录到DA14580,请查阅其他文章。
SUOTA需要DA14580外挂1Mbits以上的FLASH或者EEPROM,当然DA14583不需要,因为它已经内置了1M FLASH。
本文的演示需要用到事先制作好的img文件,关于img文件怎么制作,请查看我的其他文档。
这里再啰嗦一点,除了用IOS升级,也可以用Android,当然,官方的文档说Android 会不稳定。
这里我们以IOS版SUOTA为例:当然,先别急着打开APP,在此之前,我们要把要升级的img文件拷贝到手机。
工具可以选择iTunes或者iTools,其道理是一样的,这里以iTools为例,将手机连上iTools,然后选择:打开SUOTA的文件共享,并选择以下文件夹,将要升级的文件拷贝到该文件夹下,这里我拷贝了3个文件,可以根据自己的需求来拷,反正升级只需要一个:拷贝完毕后关闭iTools,断开手机。
然后打开手机APP,点击搜索,之前请让DA14580工作在广播状态。
不一会儿,就会出现SUOTA02这个设备,这是我们事先烧录好的程序(相关方法请查阅我的其他文档,下文不再重复说明),点击SUOTA02与设备建立连接。
点击Update,选择fw03.img(SUOTA02是fw02.img,所以我们选择新的)。
正常的话会出现以下界面:由于我们用的是FLASH,所以选择SPI,然后根据自己的硬件选择SPI口的配置,关于Image bank,可以选择Oldest-自动选择老的区块覆盖,Bank1-覆盖区块1,Bank2-覆盖区块2,Block size-一般选择默认好了,完毕后点击Send to device。
然后出现以下界面:等待它升级完成,会跳出以下界面:选择reboot,再刷新界面,可以看到更新后的设备—SUOTA03:说明更新成功。
DA14580 蓝牙模块
蓝牙4.1 低功耗BLE 模块YH-001_V1.01(主芯片Dialog_ DA14580)模块概述YH-001_V1.01 是一个蓝牙4.1 单模低功耗(BLE)数传模块,高度集成了蓝牙低功耗射频、协议栈、profile 以及应用程序于系统级芯片DA14580 (内置蓝牙+ARMcortex-M0),它不仅无需外接MCU,而且提供足够的I/O 用于硬件设计和程序开发,非常适合应用于需要超低功耗的系统上。
主要特性1.蓝牙4.1 单模低功耗模块2.完美支持主从模式(Master/Slave)3.集成蓝牙低功耗BLE 协议栈16MHz/32bit ARM Cortex M0,无需要外接MCU4.内置AES-128bit 加密程序5.内置专用链路层处理器6.射频特性TX 功率:-20dBm 至0dBm RX 灵敏度:-93dBm7.通信传输有效距离:30M(无外置功放)8.处理器16MHz 32 位ARM Cortex M0,带有SWD 接口9.内存32kB 的一次性可编程(OTP)闪存42K SRAM 84kB ROM 8kB 保留SRAM10. 工作电压典型值3.0V 建议范围 2.5V-3.3V (支持普通7 号、5 号和纽扣电池供电)11. RF 收发器3V 供电,理想状态TX:3.4mA RX:3.7mA12. 接口4 通道10 位ADC 2 个UART 接口SPI 接口I2C 接口PWM 输出20 通用I/O 接口13. 封装尺寸23.2mm * 17mm * 1.8mm应用领域:1.医疗保健设备2.运动及健康设备3.家庭智能设备4.手机和PC 配件5.工业自动化设备6. 物联网节点设备及网关7. 智能遥控器(含语音识别)8. 手机APP 控制互动玩具9. 手机APP 控制四轴飞行器10.HID 外设,键盘、鼠标……YH-001_V1.01 方框图YH001-V1.01电气特性:绝对最大额定值建议工作条件NOTE1:基于蓝牙芯片RAM 工作特性,要求蓝牙设备冷启动时VDD ≧2.5 V,所以建议模块供电稳定VDD=3V外形尺寸:YH-001_V1.01 的总体尺寸,长23.2 毫米,宽17 毫米,厚1.8 毫米。
DA14580学习总结
DA14580学习汇总简介芯片名称:DA14580内核:Cortex-M0 32-bit系统时钟:16MHZ 睡眠时钟:32K (所以要外挂两个晶振)协议栈:不开源,采用Riviera Waves授权协议栈IPRam:42 kB System SRAM(存放运行数据)8 kB RetentionSRAM(低漏电存储器,暂存休眠状态下的运行数据)存储方式:32k的OTP(一次性烧录),要实现反复烧录则需要外挂一个flash或者EEPROM 84 kBROM(存放协议栈)最小系统只需7个元件支持仿真烧录方式:串口烧录(JTAG也可以烧录,烧录到外挂的芯片中)封装:34 pins,40pins, 48 pins功耗:首款突破4mA无线收发电流极限的蓝牙智能解决方案(小米手环可满足30天续航)术语Profile:配置文件(在GATT的基础上进行数据的本地处理)GATT:Generic Attribute Profile 通用的配置文件(负责基础的数据通信)DISS:设备信息服务(显示设备的制造商信息)UUID:全球唯一识别码,如0x2A45位设备序列号的UUID(任意蓝牙都可以通过他获取到设备序列号)。
AES:Advanced Encryption Standard 是DA14580中内置的128 位加密处理器development_guide:开发手册GAP:Generic Access Profile 通用接口配置。
跟蓝牙的advertising相关GTL: Generic Transport Layer 通用传输层。
当工作于外部主控模式时,用来传输主控到DA14580的数据NVDS: Non-Volatile Data Storage 非易失性数据存储器OTP: One Time Programmable (memory) 单次可编程存储器PHY:physical layer物理层LL:Link Layer链路层外挂EEPROMDA14580的芯片是没有flash空间的(其实有个32kb的OTP,但只能烧写一次),也可以使用烧录到内存,但是掉电过后就没有程序了。
BLE-DA14580-Part-9-Da14580
BLE-DA14580-Part-9-Da14580 框架----------------------------------------------转载请注明出处------------------------------------BLE-DA14580-Part-8-串⼝透传略..........// DA14580 框架简要分析:以官⽅demo为例,解析经常出现的关键结构,DA14580 中可以创建多个“任务”任务ID如下图,详细查看源码,enum KE_TASK_TYPE{TASK_NONE = 0xFF,TASK_APP = 50 , // Do not Alter.TASK_SAMPLE128 , // Sample128 Task...TASK_MAX = 64, //MAX is 64. Do not exceed.};那么每个ID都会有相应的消息接收函数,查看app.c,app_task.c⽂件,这两个⽂件主要处理蓝⽛底层消息处理定义的Handler部分如下,此时只要知道,当有个消息(⽐如GAPM_CMP_EVT)传送过来,那么接下去就是调⽤gapm_cmp_evt_handler函数。
(那么消息是怎么传过来的?详见下⾯消息传送)EXTERN const struct ke_msg_handler app_default_state[] ={{GAPM_DEVICE_READY_IND, (ke_msg_func_t)gapm_device_ready_ind_handler},{GAPM_CMP_EVT, (ke_msg_func_t)gapm_cmp_evt_handler},{GAPM_DEV_NAME_IND, (ke_msg_func_t)gapm_dev_name_ind_handler},…-…-…-…-}//----------------- 消息发送 -------------------------------------个⼈归纳,可以分为两种类型,⼀种由DA14580内核发送:(我们在源码中查看不到发送的函数,但能找到相应⽂档,查找到相应的⼊⼝函数):参看⽂档RW-BLE-GAP-IS.PDF以及RW-BLE-GAPP-IS.PDF,举例:发送开始⼴播命令给RW-内核,GAPM_START_ADVERTISE_CMD (上述两个⽂档⾃⼰查找下该命令)根据⽂档,会产⽣两种应答:Response: GAPC_CONNECTION_REQ_IND 如果有连接建⽴GAPM_CMP_EVT 当操作完成⼜或者取消那么显⽽易见,当发送完开始⼴播命令时,有连接建⽴时,调⽤上述 app_default_state[] GAPC_CONNECTION_REQ_IND 对应的函数~当操作完成(即设备开始发出⼴播),或者中途⼜发送了停⽌⼴播的命令时,⼀种由我们⾃⼰发送:以bass.c bass_task.c为例在bass_task.c⽂件中定义了如下⼏个状态,每种状态对应⼀个或多个消息函数。
DA14580官方培训资料中文版5
…personal…portable…connectedDialog SDK 5.0.3 培训材料5–配对,绑定和安全2016.6BLE安全特性概览自定义服务源码讨论输出结果我们一起做一个demo…在我们开始前,我们建议你…看一下培训材料2关于自定义服务的应用 你将会从这个培训里面学到…基本理解BLE的安全特性和问题什么是配对?什么是绑定?‘Just-Works(立即工作)’配对方式单设备绑定基本理解多设备绑定如何在自定义服务数据库里加入配对接下来…看一下这份PPT的参考文档部分通用接入服务的低功耗安全特性和注意事项•在BLE通信中的相关安全特性考虑:•Man-in-the-Middle (MITM)MITM模式要求攻击者有能力去监听和改变传往通信链路中的信息。
一个例子是主动监听,攻击者会对被攻击设备发起独立主动的连接,并传递消息,使得设备相信自己是在一条私有连接上在进行通信。
攻击者可以理解所有往来交互的信息,并有能力加入额外的消息。
对应MITM的攻击,保护方式主要是使用万能钥匙的配对方式,或者使用带外配对的方式。
通用接入服务的低功耗安全特性•在BLE通信中的相关安全特性考虑:•被动监听被动监听是私下接收配对数据,或者没有配对下的普通交互数据;然后在没有得到同意的情况下(用sniffer工具)监听。
BLE v4.0针对这种情况没有保护机制(在BLE v4.2的安全连接特性里会采用ECDH的公共密钥来应对这种被动监听攻击—不在此次讨论范围之内)•隐私/身份追踪BLE支持隐私特性,会在一段时间内更新蓝牙地址,降低被跟踪的风险。
这种修改后的地址叫做私有地址,被信任的设备可以解析地址。
通入接入服务低功耗绑定•为了消除MITM和被动监听攻击带来的风险,两个BLE设备间需要进行配对.•配对是这样一个过程,两个设备间交互安全和身份信息,创建一种信任关系.•这些安全和身份信息就是所谓的绑定信息。
当设备开始存储这些绑定信息,意味着绑定已经建立,或者设备间已经被绑定在一起•一旦秘钥交互后,每一次的连接结束之后都会存储这些绑定信息。
DA14580中基于SDK5.03的SUOTA使用方法
BD0005-基于SDK5.03的SUOTA使用方法文档版本:v0.0.1DA14580开发的蓝牙产品,很多情况下要用到空中升级,本文介绍了如何使用SUOTA,并如何利用Dongle更新新版本程序,本文只针对SDK5.0.3版本,后续有版本更新请参考新的文档。
DA1458x的空中升级需要对编译好的hex文件做适当处理,本文以SDK5.0.3为例,为您演示DA14580芯片如何制作和烧录SUOTA程序,要成功使用SUOTA,芯片外部必须外挂1M以上FLASH,我这里使用的是2Mbits SPI FLASH。
首先,我们有以下两个工具,第一个hex2bin是将hex文件转换为bin文件,第二个是制作SUOTA 的img文件,hex2bin是网上找的,如果你有类似的工具也可以使用,mkimage(关于这两个工具,的源码可以在SDK5.0.3中找到,用VC编译后可生成exe文件。
需要的话可以在附录中的地址下载到)这里我们以SDK5.0.3中的prox_reporter工程为例,首先打开工程:这里我们要生成两个版本的hex文件,fw01.hex和fw02.hex,作为两个不同版本的程序。
首先找到以下位置:修改设备名称为SUOTA01,作为第一个hex,编译并生成hex,找到刚生成的hex 复制到跟工具一起的文件夹,改名为fw01.hex(这里的名字可以随便改,但是相应命令也需要修改,下同,不再重复说明):用同样的方法,修改名称为SUOTA02,并生成fw02.hex找到以下文件,复制两份到前面的工具文件夹,分别更名为fw01_version.h和fw02_version.h:分别修改fw01_version.h和fw02_version.h的内容,切记前一个版本号要比后一个小,时间要早,否则升级会失败:找到以下工程,编译生成bootloader的hex文件:最后得到我们要的所有文件如下:打开命令提示符窗口,修改目录为你存放工具和hex的文件夹:用以下命令生成fw01.bin文件:再用以下命令生成对应的img文件:再用同样的方法生成fw02.img和secondary_bootloader.bin文件,然后生成最终的img文件multi_part.bin:完成后,打开SmartSnippets工具:确保SPI口与你的硬件对应一致,如果你都是参考默认设计,则不需要修改:然后打开FLASH Programmer窗口并选择我们最终生成的img文件:按照提示步骤选择连接DA14580芯片,擦除并烧录,中途可能需要你reset芯片,按照提示操作即可:最后烧录的时候会提示你选择,请选择NO:烧录完毕后,重启芯片,然后用手机的Lightblue可以搜到SUOTA01:好了,程序烧录完毕,一般出厂这样就可以了。
DA14580如何添加配对密码
中电港 钟志峰
struct gapc_bond_req_ind const * param) { #if defined (USER_CFG_PAIR_METHOD_JUST_WORKS) || defined (USER_CFG_PAIR_METHOD_PASSKEY) || defined (USER_CFG_PAIR_METHOD_OOB)
当然这个密码可以是固定的值如123456也可以是随机产生的然后显示在设备的显示屏上如果有的话这里如何产生密码码农们可以天马行空地想象
中电港 钟志峰
BDF007-DA14580 如何添加配对密码 文档版本:v0.0.1
本试验是在 SDK5.0.4 的 prox_reproter 例子基础上,添加配对时需要输入密码 的功能,也就是为了增加安全机制,防止被恶意连接。
// OOB data
#define APP_SECURITY_OOB_TK_VAL
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,\
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}
其中 APP_SECURITY_MITM_PASSKEY_VAL 为需要输入的密码值,这个密码可 以是固定值,也可以修改成变量,然后用一个随机值。
最终目的是实现在配对时弹出输入密码对话框:
此时输入我们的默认密码”123456”即可与建立手机与设备之间的配对。当然, 这个密码可以是固定的值(如“123456”),也可以是随机产生的,然后显示在设 备的显示屏上(如果有的话),这里如何产生密码,码农们可以天马行空地想象。
我们以 SDK5.0.4 中的 prox_reporter 为例,之前版本 SDK(如 SDK5.0.3)与此 不同,此方法不完全适用,感兴趣的同学可以试试。
开发板说明书DA14580DK_User_Guide v1.0
2.2.2
DA14580
• BLE_PROFILE BLE iOS • DA14580DK • DA14580DK • BLE • 1. Smart Snippets RMDK
2. SDK
“
”
“
SDK” DA14580DK DIALOG
3.DA14580DK
4.“DA14580DK
”
DA14580DK
DA14580DK User Guide v1.0
4.1.5
DA14580DK
:
• USB ( • • CR2032
Figure 7) J1(1.8 V to 3.3 V) ( Figure 8)
USB
Figure 7 USB
Figure 8
DA14580DK User Guide v1.0
4.1.6
+
6.8V
DA14580DK User Guide v1.0
3.3
DA14580 DK
3.3.1.
MICRO USB
DA14580DK
3.3.2.
DA14580DK
SmartSnippets
SmartSnippets
DA14580DK User Guide v1.0
DA14580DK OK MICRO USB OK.
4. DIALOG 6. PC
SDK Smart Snippets
“
SDK” “D DA14580DK ”
DA14580
OTP
BLE SOC ,
OPT ROM RAM DA14580 RAM
OTP ROM
1 2 BLE
HEX Keil MDK
Smart Snippets RAM
DA14580最小蓝牙模块
DA14580 最小蓝牙模块MN581A 模块是针对无线智能产品设计的一款超低功耗的,超小体积的蓝牙模块。
基于德国DAILOG 超级蓝牙芯片DA14580 设计,包含天线部分仅有5.50mm*8.0mm, 高度仅有1.7mm 片上集成32 位ARM Cortex M0 ? 处理器国际标准的Blue-tooth? Smart 协议栈。
特别适合对体积和高度有特殊需求的智能穿戴式设备。
例如智能手环,蓝牙手表、无线键盘、无线鼠标、平板电脑、手机、笔记本电脑等产品。
可帮助客户快速开发蓝牙4.0 产品。
1.1 主要的特点超低功耗最小尺寸内嵌16MHZ32 位ARMCortexM0? 处理器专用链路层处理器内置aes-128 位加密处理器32kBOne-Time-Programmable(OTP) 内存42kB 系统SRAM 84kB ROM 8kB 记忆存储器支持多个数字接口:通用I/o、2个UARTs 与硬件流控制1MBd 、SPI+? 接口I2C 总线在100kHz,400 千赫硬件正交解码能力支持模拟接口设备内置4 通道10-bitADC 完全集成2.4GHzCMOS 收发器单线天线:内置50 欧姆天线匹配直接连接2.4G 的天线VBA T3V 电源电流:0dBm 传输输出功率-93dBm 接收机灵敏度1.2 应用市场智能穿戴式设备蓝牙手表无线键盘无线鼠标平板电脑手机笔记本电脑1.3 管脚定义及尺寸图名称功能输入输出说明GND 接地—VCC模块电源正极2.7V to3.3V支持聚合物(需降压)、钮扣电池P0_6/TX 模块串口发送端OP0_5/RX 模块串口接收端IP0_3 模块状态切换脚I 模块状态切换脚(下降沿唤醒、上升沿睡眠)P0_0 蓝牙数据引脚O 蓝牙数据引脚(蓝牙连接\ 断开接收数据时都会使此IO 电平变换)VPP,SW_CLK,SWDIO-- 调试软件用VPP,SW_CLK,SWDIO1.5 外围参考设计1.6 模块功耗睡眠模式:2uA 唤醒后功耗:500uA 连接状态功耗(以1k 的发送速率):625uA 1.7 模块工作说明本模块为透传模块,在配置完模块的对应I/O 后,应切换下P0_3 的高低电平以保证,模块处于用户所希望的状态(睡眠或者唤醒)。
DA14580超低功耗BLE 在智能门锁中的应用
可见 DA14580 的低功耗比 cc254x 下降了 65%,一颗 CR2302 纽扣电池至少延长 2 倍的 续航时间。如果在蓝牙门锁应用中,优秀的蓝牙功耗特性会让门锁的使用寿命大大增加。 兼容性方面,目前市面上的绝大多数智能手机均能与 DA14580 建立的连接,这得益于其稳 定的 BLE4.1 协议栈,其厂家实验证实市面 500 多种不同品牌手机均能稳定蓝牙连接。
DA14580 超低功耗 BLE 在智能门锁中的应用
前言 在如今这个遍地都是智能化的时代,从牙刷到飞机,都尽其智能之事。以智能门锁为例,与 传统门锁或是密码锁相比,智能门锁的一个创新之处就是通过蓝牙技术,借助智能手机以及 配套的应用,直接通过手机开门。智能门锁的主要优势是可以实现门锁管理及远程授权开门。 使用蓝牙手机靠近门锁就可以开门,是将蓝牙模块安装在门锁里面,与手机蓝牙进行自动感 应,蓝牙模块接收到手机的开锁指令完成开锁操作。蓝牙门锁是否稳定可靠的关键在于器核 心部件,蓝牙通讯模块,因蓝牙模块需要长时间的持续发射蓝牙信号,而模块安装于门锁内 仅能依靠电池供电维持其工作,所以蓝牙模块的低功耗特性至关重要,另外蓝牙门锁需要依 靠移动蓝牙终端设备(如:手机),建立连接完成通讯,所以蓝牙兼容性也非常重要。
蓝牙射频功率最大支持 0dbm,实际测试在门锁环境中即使存在较多金属物遮挡情况下,其 有效蓝牙连接距离任然可以保持在数米范围内,这对于大多金属门框的门锁应用也是完全适 合的。
智能门锁工作示意图 通常智能门锁由低功耗蓝牙模块、电子/机械锁体、电池和按键组成,工作示意图如下:
DA14580官方培训资料中文版1
…personal…portable…connectedDialog SDK 5.0.3 培训材料12016.3 数据广播数据广播什么是广播? barebone工程barebone工程实例源代码分析输出显示你将会学会…开始前…•安装/解压SDK5.0.3 到路径C:\drive•快速浏览SDK目录下的Keil barebone工程 将要学到的内容…•理解BLE数据广播内容的基本概念•总体了解Dialog BLE SDK 5.0.3•如何修改数据广播内容什么是广播?低功耗蓝牙主要有两种操作模式:•由服务定义的连接模式(查看下一个培训材料)•无连接广播模式广播者定义了在广播模式下的数据格式.对于广播模式来说,有两种常见的应用:•传输信标•发布你的身份识别和服务信息服务定义了在和设备建立连接之后所用到通信接口.什么是广播…广播包长度较短,格式限定,只能携带少量用户数据。
广播模式同时支持在扫描响应的包内存储额外的数据。
这些数据在无需建立连接的条件下,可以被使用扫描请求包的设备获得。
广播包是由一系列的AD字段组成,典型的如•设备名字•设备所支持的部分或者全部的服务类型广播包也会包含厂商的特定字段和设备属性的标识.信标模式信标通常只工作在广播模式,采用BLE的广播包来传输静态或者动态的数据,这些数据可以用来推送地址相关或上下文相关的内容用于使能手机端应用。
关于信标,有很多种规范,包含来自Apple的iBeacon,和Google的Eddystone Beacon等.Dialog SDK可以在同一设备里支持其中一种或者多种的组合尽管会有一些例外,但通常来说,信标模式是无法被连接的,所以不会广播服务信息。
Barebone实例第一个实例说明如何在Barebone工程的基础上构建自定义工程,用于广播带有特定的字段的位置信息.工程路径(实际路径会有稍许差异):C:\DA1458x_SDK\5.0.3\projects\target_apps\ble_examples\ble_app_barebone每一个信标类型数据包里,都包含特定的厂商字段,用于广播自定义信息接下去将介绍需要在源码上所做的修改.应用代码流程图Barebone工程概览(工程文件的位置)源文件讨论: user_config/user_config.h修改USER_DEVICE_NAME练习: 修改名字“DIALOG-TRAINING”./// Advertising name#define USER_DEVICE_NAME ("DIALOG-TRAINING")修改广播间隔.练习: 修改广播间隔到1sstatic const struct advertise_configuration user_undirected_advertise_conf={ /// Advertise operation type..advertise_operation=ADV_NON_CONN,/// Own BD address source of the device:.address_src=GAPM_PUBLIC_ADDR,/// Advertise interval.intv=1600,//(1600 * 0.625ms) = 1 sec源文件讨论: user_app/user_barebone.c/user_barebone.h广播包的填充数据部分里包含厂商的特定字段,这些字段可以被修改。
蓝牙BLE--DA14580进阶之路
芯片对比DA14580NRF51822内核CORTEX-M0CORTEX-M0 RAM42KB System SRAM8KB Retention SRAM16K集成度高16MHZ32.768KHZ晶振内置匹配电容BALUN内置最小系统只需7个元件低16MHZ32.768KHZ晶振需要外挂匹配电容BALUN外置最小系统元件个数工作电流TX:3.4mA RX:3.7mA(业界功耗最低)TX:13mA RX:10.5mA 最低工作电流0.9V 1.8V程序存储类型OTP可分区烧录flash程序存储器大小32kB OTP(存放Profiles和用户程序)84kB ROM(存放协议栈)两个版本:128kB256kB封装QFN48package,6x6mmWLCSP package,3.50x3.83mmWLCSP34pins,2.5mm x2.5mm QFN40pins,5mm x5mm QFN48pins,6mm x6mm烧录方式串口烧录SWD_DAPWT科技DA14580开发板:基本的计步、睡眠监测、卡路里计算、心率及体温测量,各种智能提醒,体感游戏,远程遥控拍照,碰碰交友,读写卡片DA14580开发板详情介绍:1.IO管脚全部引出2.PCB印制天线(高效率天线,通讯可达10M)3.三种供电方式,Jlink,3.7V锂电池,USB(后两者需配充电稳压模块)4.健康监测功能(需配心率体温模块)(独家!)5.读卡、与手机通信、信息交换功能(需配NFC模块)(独家!)6.板载振动马达,模拟可穿戴设备的振动提醒(独家!)7.板载蜂鸣器,适用于用户报警需求(独家!)8.预留4线JLINK SWD调试接口(含VCC)。
9.板载6轴陀螺仪MPU6050(全新!)10.板载2Mbit SPI Flash存储芯片11.板载实时时钟(独家!)12.两个独立按键与3个LED灯13.可调电阻,方便模数转换实验。
短路帽可选电池电量检测功能(独家!)14.业界最低功耗TX:3.4mA,RX:3.7mA资料:蓝牙开发工具整板演示链接获取DA14580主板原理图DA14580英文资料链接获取获取更多完整,进阶资料,开源传播:点击获取交友演示:点击观看心率测试演示:点此观看整板演示:点此观看毫无保留的展示:1.芯片选型原理图设计2.裸机编程RivieraWaves系统讲解3.BLE、NFC、心率、体温、计步、体感全面剖析4.开发工具jlink下载调试器、UsbDongle抓包器、USB转串口等的制作方法。
DA14580 UART BOOT应用说明V1.0.2
DA14580 U ART B OOT应用实战利用CSR1010的串口BOOT D A14580代码文档版本:v1.0.2本文主要介绍如何利用CSR1010来给DA14580注入应用程序,总所周知,DA14580没有内部FLASH,其代码只能放在OTP或者外部FLASH(EEPROM)中,如果外部有MCU,则可以考虑将代码放在外部MCU中,这样可以省下FLASH,节约成本,同时也会简化产线操作。
有朋友可能会问,用一块蓝牙SOC(CSR1010)去BOOT另一块蓝牙SOC (DA14580)不显得蛋疼么,其实也是无奈之举,只因手头没有其他MCU,CSR1010只作为普通MCU做测试用,换做其他MCU也是ok的。
首先,需要将你的DA14580程序编译成hex文件,用keil直接编译生成hex即可,然后利用工具将hex转换成bin文件,再利用另一个工具把bin转换成txt文件。
关于这边的工具,网上有很多,直接百度即可。
最后得到的txt文件如下:这边为了方便大家测试,我将一个例子的hex,以及通过工具转换后得到的bin,txt放在附件里,供大家测试用,这里我们只用到blinky.txt将blinky.txt中的数据拷贝出来,在你的主CPU中(这里是CSR1010)创建一个数组用于存放boot代码:到此为止,我们的准备工作已完成。
现在讲解一下DA14580的boot流程:1.DA14580在上电后会通过UART发送0x02,这个比较奇怪,有时候是一直发送0x02,有时候只发送一次;如以下几种情况都有可能:2.上位机(这里是CSR1010,接下去不再重复说明)收到0x02后发送“0x01”+”code 长度+3”:上图左边是Bin c ode,右边是上位机发给DA14580的数据。
这里的“code长度+3”需要特别说明一下,这个也是比较容易出错的地方:首先,code长度的获取,它的方法有很多种,可以通过看SmartSnippets载入hex 文件后查看,可以看bin文件等等,这里只介绍最简单的一种方法,就是利用上面建立的da_code[]数组,直接:da_code_size=sizeof(da_code),这样就得到代码长度了,获取到code的长度后,只要将code长度+3然后发送出去就可以了,如da_code_size=0x6918,则需要反馈的长度为0x891B(0x8918+3),即第二步的反馈数据为0x01,0x1B,0x69。
DA14580烧录器使用
DA1458X生产烧录工具使用说明书2016-04-20 V1.3.1--此文档公开免费发行一.功能特点描述1.16个独立烧写口(1拖16)2.可支持烧录的芯片型号:DA14580, DA14581, DA14582,DA145833.可烧录存储器类型:OTP/Flash/EEPROM4.支持OTP/FLASH/EEPROM同时烧写或其任意组合烧写5.MAC地址可自动增加,也可客户自己定制MAC地址6.支持OTP Header烧写7.过压保护,防电源极性反接保护8.严格的VPP,VBAT上电顺序,保障烧录可靠性9.CPLD提供可靠控制信号,防止Power On Reset的情况发生10.PC端软件代码完全开源,方便客户二次开发.11.提供生产流程解决方案及技术支持12.可提供生产工具软件的个性化定制13.电源参数如下表所示二.烧录口接线定义用户只需在自己的生产板上预留出VBAT,UART TX, UART RX, VPP, GND五个触点,用于生产烧录用.三.清单列表1.烧录器1台B线2条3.提供烧写操作说明书(用户购买后,提供电子档文件)四.环境准备1..一台装有XP或是WINDOW7/8/10系统的PC机,同时确保有两个USB接口可供使用2..+5V, +3.3V(+1.8V可选) 电源3.用户自己设计的工厂烧录夹具B驱动5.请根据PC机的系统自行选择如下两个目录中的烧写执行软件DA14580_GUI_prod_line_tool.exe.Executables ->WINDOW7或WINDOW8系统使用Executables_xp ->XP系统使用五.操作步骤A.安装驱动1.连接好PLT的电源,同时连接好两条USB线.2.安装USB驱动,在驱动目录下有以下两个文件,请根据自己电脑是使用32位系统还是64系统选择相对应的文件进行安装3.详细的安装驱动步骤,请参考安装说明目录下的B.PLT板资料分布C.电源电压范围及接线方法D.DUT接口一般只要接VBAT, DUT-TX,DUT-RX,VPP(有烧写OTP或是OTP HEADER时要连接),GND共五条线.E.生产操作1.按电源接法.连接好+5V, GND, VDDIO, VBAT,这几种电源2.连接USB到电脑(有两个USB线要连接,一条用于控制Golden Unit,一条用于16个UART扩展)3.按板上的RESET GU按钮(此步骤不可省略)4.在PC上,打开烧写软件,按您的需求设置相关参数5.烧写六.技术支持可直接联系提供者.七.保修条例本烧录器属于生产工具类:购买后1.7天内有质量问题可以包退换2.7天后到1个月负责免费维修3.1个月后收取元器件费用维修。
DA14580官方培训资料中文版3
5
BLE Custom profile
BLE 协议概览
一个BLE 协议可以包含1个或多个服务.
服务通常会把数据分包成逻辑实体,并且包含特定的字段,这些字段被称为属性.
一个服务可以有一个或多个属性。服务之间通过UUID来进行区分,UUID可以有16-bit(BLE 服务官方采用)或者128-bit(自定义服务)两种形式
user_periph_setup.c
Dialog Semiconductor © 2016
13
自定义服务内容
按步骤添加属性
TODO 1 – 修改默认蓝牙地址 BD_ADDRESS, 地址在BLE网络上需要做到唯一.
/* @file da1458x_config_advanced.h */
/* copy and paste in code step 1 change the BLE device address */
4
自定义服务内容
通用属性协议(GATT)
• 客户端/服务器 架构 •服务器端存储数据,通常在GAP协议里作为外部设备端 •客户端从服务器端申请数据,在GAP协议里作为中央控制端
• 服务器端采用属性的形态开放数据访问接口
服务器端
数据
数据
数据
请求 回应
客户端
Dialog Semiconductor © 2016
Dialog SDK 5.0.3 培训材料3– 自定义协议的GATT命令
2016.5
…personal …portable …connected
BLE 自定义协议
BLE 规范概览 自定义服务规范源码讨论 界面输出显示
Dialog Semiconductor © 2016
DA14580 超小蓝牙透传模块
3
深圳迈诺电子有限公司
1.2 应用市场
智能穿戴式设备 蓝牙手表 无线键盘 无线鼠标 平板电脑 手机 笔记本电脑
1.3 管脚定义及尺寸图
DA14580 数据手册
版权所有:深圳市迈诺电子有限公司
4
深圳迈诺电子有限公司
名称 GND VCC P0_6/TX
功能 接地 模块电源正极 2.7V to 3.3V 模块串口发送端
深圳迈诺电子有限公司
DA14580 模块简介
DA14580 数据手册
MN581N 模块是针对无线智能产品设计的一款超低功耗的,超小体积的蓝牙模块。基于德国
DAILOG 超级蓝牙芯片 DA14580 设计,包含天线部分仅有 5.50mm*8.0mm, 高度仅有 1.7mm
片上集成 32 位 ARM Cortex M0™ 处理器国际标准的 Blue-tooth® Smart 协议栈。特别适合对体
硬件正交解码能力
支持模拟接口设备内置 4 通道 10-bit ADC
完全集成 2.4 GHz CMOS 收发器
单线天线:内置 50 欧姆天线匹配直接连接 2.4G 的天线
VBAT 3 V 电源电流:
0 dBm 传输输出功率
-93 dBm 接收机灵敏度
版权所有:深圳市迈诺电子有限公司
深圳市迈诺电子有限公司名称功能输入输出说明gnd接地vcc模块电源正极27v支持聚合物需降压钮扣电池p06tx模块串口发送端p05rx模块串口接收端p03模块状态切换脚模块状态切换脚下降沿唤醒上升沿睡眠p00蓝牙数据引脚蓝牙数据引脚蓝牙连接断开接收数据时都会使此io电平变换swclkp14jlink调试口串口状态切换脚调试软件用切换透传指令模式
DA14580 数据手册
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Company confidentialUser manualDA14580 Creation of a secondaryboot loaderUM-B-012AbstractThis document provides an overview of the booting sequence of the DA14580 and it describes the implementation steps for the development of a secondary boot loader application An extension of the secondary boot loader to support a dual boot images scheme is also presented.ContentsContents (2)Figures (2)Tables (2)1 Terms and definitions (3)2 References (3)3 Introduction (4)4 How DA14580 Boots (4)5 Secondary Boot loader application (4)5.1Booting from SPI master (4)5.2Booting from UART (4)5.3Booting from SPI (5)5.4Booting from an I2C/EEPROM (6)6 Dual Image Bootloader (6)6.1Non-volatile memory map (6)6.2Booting Sequence (8)6.3How to prepare the non-volatile memory (8)7 Application Description (9)7.1System Initialization (9)8 Getting Started (12)8.1Writing application HEX file to SPI Flash (12)Writing boot loader HEX file to OTP memory (13)8.28.3Measuring the booting time (13)9 Revision history (15)FiguresFigure 1: Non-volatile memory map (7)Figure 2: File Structure (10)Figure 3: SPI Flash Programmer (12)Figure 4: OPT Prograrmmer (13)Figure 5: Booting sequence using the secondary loader (14)Figure 6: Normal booting sequence (14)TablesTable 1: Transmission sequence (5)Table 2: SPI Header (5)Table 3: EEPROM Header (6)Table 4: Product header format (7)Table 5: Image header format (8)1 Terms and definitionsEEPROM Electrically Erasable Programmable MemoryGPIO General Purpose Input OutputOTP One Time Programmable (memory)SDK Software Development KitSPI Serial Peripheral InterfaceSUOTA Software Update Over The AirUART Universal Asynchronous Receiver/TransmitterURX UART Receive portUTX UART Transmit port2 References1. DA14580 Datasheet, Dialog Semiconductor.2. AN-B-001, Booting from Serial Interfaces, Dialog Semiconductor3. UM-B-014, DA14580 Development Kit, Dialog Semiconductor.4. UM-B-003, DA14580 Peripherals Drivers, Dialog Semiconductor.5. UM-B-009, DA14580 Proximity Application, Dialog Semiconductor.6. AN-B-023, DA14580 interfacing with external memory, Dialog Semiconductor3 IntroductionThis document provides an overview of the booting sequence of DA14580 and describes the steps for creating a secondary bootloader application. The application structure, the steps for testing it and a methodology for measuring the booting time are presented.The secondary boot loader allows DA14580 to boot from a SPI or EEPROM flash memory or UART interface. It can be used to replace the ROM boot loader in case a faster booting sequence is needed.An extension of the secondary bootloader based on dual images is also represented in this document. The dual image bootloader can be used together with the Software Upgrade Over The Air (SUOTA) application for the product firmware upgrade.4 How DA14580 BootsDA14580 operates in two modes [1, 2], namely the “Normal Mode” and the “Development/Calibration Mode” hereafter address as “DevMode”.At power up or reset of the DA14580, the primary boot code (ROM code) will check if the OTP memory is programmed. When this is the case the DA14580 enters “Normal Mode”. It proceeds with mirroring the OTP contents to System RAM and it will program execution.Otherwise, it enters “DevMode”. It scans a predefined number of pins to communicate with external devices, using the three interfaces available on chip:∙UART,∙SPI,∙I2C.Due to the time it requires to scan the interfaces (SPI as slave, UART, SPI as master and I2C) in DevMode the start-up time is longer than in Normal Mode. The difference in start-up time is around a few milliseconds in Normal Mode to several decades of milliseconds in DevMode [2].For applications requiring to run from an empty OTP and at the same time have a short boot time a dedicated secondary loader can be developed, that will skip the long sequence of scanning interfaces. Such a dedicated secondary loader will start communicating directly on a selected interface to download instead of DevMode.The flow chart of the booting is shown in Error! Reference source not found.5 Secondary Boot loader applicationIn this section three use cases of the secondary bootloader are described: booting form UART interface, booting from EEPROM and booting from SPI flash.5.1Booting from SPI masterIt is possible for a host controller to act as a SPI master. In this case the DA14580 is the SPI slave. Via the host controller the booting can take place.No further details are mentioned now, about this way of booting.5.2Booting from UARTThe secondary loader application reads the UART RX Pin status with GPIO_GetPinStatus() command and if it is high (1), it starts the booting procedure from the UART interface.The protocol for booting from UART is the same [2], as that of ROM boot code and it is implemented in function FwDownload() (uart_booter.c).It starts with the DA14580 UART TX pin transmitting 0x02 (Start TX, STX). The external device is expected to answer a 0x01 (Start of Header, SOH) byte followed by 2 more bytes (LEN_LSB,LEN_MSB) which defines the length of the code to be downloaded (first byte is the least significant, second byte is the most significant). The DA14580 answers with 0x06 (ACK) if 3 bytes have been received and SOH identified or with 0x15 (NACK) if anything went wrong or the size if greater that the expected one.Table 1: Transmission sequenceAt this point connection has been successfully established and the SW code will start being downloaded. The next N bytes are received and placed into the System RAM.Following the completion of the required code bytes, the boot code will calculate the CRC and send it over the UART. The booting sequence ends with by reading the value 0x06 (ACK) at the URX line. CRC is calculated by XORing every successive byte with the previous value. Initial CRC value is0x00.During the final step of the boot code, the UART GPIO pins are initialized to the default state.SYS_CTRL_REG is programmed to Remap to System RAM and apply a SW reset or perform a branch to System RAM. It is depended of the base address of the application code, so the system starts executing the code.Booting from UART method can be used by the user to download the flash programmer application in order to upgrade the application firmware stored in SPI flash. This option is provided by the SPI programmer tool of Smart Snippets.5.3Booting from SPIThe secondary boot loader application initializes the SPI interface and the SPI flash memory if no UART is detected the options SPI_FLASH_SUPPORTED and SUPPORT_AN_B_001 are defined in the file bootloader.h. Then, it checks if the header described in AN-B-001 [2] (Table 2) is present by checking the first two bytes of the header for the signature (0x70, 0x50) and if a valid header is detected it copies a number of bytes equal to Code Size to System Ram and starts the user application.Table 2: SPI Header5.4Booting from an I2C/EEPROMThe secondary boot loader application initials the I2C/EEPROM flash memory if no UART is detected and the option EEPROM_FLASH_SUPPORTED and SUPPORT_AN_B_001 are defined in the file bootloader.h. Then, it checks if the header described in AN-B-001 (Table 2) is present by checking the first two bytes of the header for the signature (0x70, 0x50) and if a valid header is detected it copies a number of bytes equal to Code Size to System Ram. Finally, it verifies the checksum of the code data and if it matches the CRC field of the header and starts the user application.Table 3: EEPROM Header6 Dual Image BootloaderThis section describes an extension of the secondary boot loader to support a dual image bootloader scheme which is used in SUOTA application for the product firmware upgrade in the field.6.1Non-volatile memory mapThe non-volatile memory map to meet the needs of the dual image bootloader scheme is represented in Figure 1.The first part is the boot loader , in case it’s stored in the nonThe images with the corresponding headers are stored at offset #1 and offset #2 which are defined in the product header. The product header is suggested to be programmed at the last sector of the non-volatile memory.Figure 1: Non-volatile memory mapNote 1 The bootloader is stored either in the first sector of the non-volatile memory according to AN-B-001 or in OTP flash memory.The product header (Table 3) defines the addresses of the two firmware images stored in the non-volatile memory. It is programmed in the production line and the corresponding flash sector may be protected if it’s supported by the flash characteristics.■signature (0x70, 0x52): It is a magic number identifying the product header .■version:Two bytes reserved for the versioning of the product header■offset #1: It defines the address of the first image stored in non-volatile memory. Four bytes in Little Endian format.■offset #2: It defines the address of the second image stored in non-volatile memory. Four bytes in Little Endian format.Note 2 The product header may contain more information or configuartion settings i.e. NVDS data , DB address, XTAL16 trim settings. The use of these parameter is explained in the [6].Table 4: Product header formatThe image header includes the following fields as shown in Figure XX:■signature (0x70, 0x51): It is a magic number identifying the image header■validflag: The validation field. It identify if the image has been downloaded correctly and the checksum has been verified. The value 0xFF defines a new image, the 0xAA defines a valid image and any other value defines an invalid image.■imageid: An increment counter which defines the active image.■code_size: It defines the size of the firmware image.■CRC: It defines the checksum calculated over the image data.■version: A 16 bytes string is used for the image version.■timestamp: It defines the image creation time based on seconds since standard epoch of 1/1/1970.Table 5: Image header format6.2Booting SequenceDuring the booting phase, the bootloader checks the product header and reads the addresses of the two images stored in the non-volatile memory and reads the contents of the two image header to find out the valid image with the greater imageid and load it to system ram if the checksum of the code data matches the value of the CRC header field.6.3How to prepare the non-volatile memorySmart Snippets tool can be used for burning the bootloader in non-volatile memory or OTP and the product header and the dual images in the non-volatile memory.For example, the SPI memory preparation is done in 3 steps. The steps are described below:1. Program the product header (0x1F000):Create a text file to describe the product header as shown below , load it using the Memory header option of the SmartSnippets toolkit, enter the following values in the product header fields Signature: 0x70, 0x52Version: 1234Offset1: 00800000 (it corresponds to offset 0x8000)Offset2: 00300100 (it corresponds to offset 0x13000)and burn it to SPI flash at address 0x1F000. For more information how to create the product header refer to HELP menu of the SmartSnippets toolkit.2 Signature MagicNumber2 Version VersionNumber4 Offset1 Offset_image_14 Offset2 Offset_image_22. Program the image binaries:Build the integrated processor proximity reporter application and convert the HEX to BIN file. Use the mkimage tool (located in tools\mkimage of the SDK distribution) to convert the BIN to IMG file. For more information how to use this tool, run mkimage without arguments.Load the image.img file using the SPI Flash Programmer option of the SmartSnippets toolkit and burn it to SPI flash at address 0x8000 (image #1) and 0x13000 ((image #2).3. Program the bootloader:Build the secondary_bootloader as described below and burn the HEX file at address 0x0 using the SPI Flash Programmer option of the SmartSnippets toolkit. (Select ‘Yes’, in the question to make the SPI memory bootable.)7 Application Description7.1System InitializationThe secondary loader application executes in the retention memory in order the System Ram memory to be available for storing the application data when the system boots either form UART or SPI interface. It sets the system clock and memory configuration as below:SetWord16(CLK_AMBA_REG, 0x00); //fastestSetBits32(GP_CONTROL_REG, EM_MAP, 7);SetBits16(PMU_CTRL_REG, RETENTION_MODE, 0xF);In the main function, secondary loader disables the Watch dog timer, sets all the peripherals in active mode and waits until the system is ready:SetWord16(SET_FREEZE_REG,FRZ_WDOG); // disable Watch DogSetBits16(PMU_CTRL_REG, PERIPH_SLEEP,0); // exit peripheral power downwhile (!(GetWord16(SYS_STAT_REG) & PER_IS_UP)); // Power up peripherals' power domain For special designs when the system must work at 1.8Voltage, the following command must be enabled.#ifdef SUPPORT_1_8_VSetBits16(DCDC_CTRL2_REG, DCDC_VBAT3V_LEV, 0x0); ///--Support 1.8V boot#endifNext, the application detects the UART RX pin level and decides whether the UART or SPI booting function will be performed.The file structure of the secondary_bootloader project is shown in Figure 2.System initialization files: startup_CMSDK_CM0.s, system_CMSDK.c, bootloader.sct and sysram.ini are included in folder secondary_bootloader/boot.Figure 2: File Structure∙startup_CMSDK_CM0.s: The startup file for ARM Cortex-M0. It contains stack and heap configuration and the vector table.∙system_CMSDK.c : It contains the functions which initializes the system and update the SystemFrequency variable.∙bootloader.sct : It is the scatter-Loading description file∙sysram.ini: Keil debugger init script.∙Source files (.c): main.c,bootloader.c, uart_booter.c, timer.c and uart.c spi_commands.c crc32.c are included in the folder secondary_bootloader/src. Drivers files spi.c, spi_flash.c and gpio.c are located in folder dk_apps\src\plf\refip\src\driver\∙main.c: It contains the main function, system initialization function and the main loop of the application.∙bootloader.c: It contains the functions for booting from SPI and EEPROM and the implementation of the dual image bootloader.∙Uart_booter.c: It contains the functions for booting from UART.∙timer.c. In this file the timer functions are implemented. A software timer is used for the timeouts required by the UART boot protocol.∙spi_commands.c; It contains the additional commands for accessing the SPI flash.∙spi.c, spi_flash.c, gpio.c: Peripherals Drivers for SPI , SPI flash and GPIO interfaces.Detailed information for the drivers can be found in [3].∙Include files (.h): periph_setup.h, timer.h and uart.h are included in the folder secondary_bootloader/includes.∙periph_setup.h: This file contains the configuration settings for the peripherals (UART, SPI, SPI flash) used by the secondary boot loader application.The main configuration settings are listed below:// Select EEPROM characteristics#define I2C_EEPROM_SIZE 0x20000 // EEPROM size in bytes#define I2C_EEPROM_PAGE 256 // EEPROM's page size in bytes#define I2C_SLAVE_ADDRESS 0x50 // Set slave device address#define I2C_SPEED_MODE I2C_FAST // 1: standard mode (100 kbits/s), 2: fast mode (400 kbits/s)#define I2C_ADDRESS_MODE I2C_7BIT_ADDR // 0: 7-bit addressing, 1: 10-bit addressing #define I2C_ADDRESS_SIZE I2C_2BYTES_ADDR // 0: 8-bit memory address, 1: 16-bit memory address, 3: 24-bit memory address// SPI Flash settings// SPI Flash Manufacturer and ID#define W25X10CL_MANF_DEV_ID (0xEF10) // W25X10CL Manufacturer and ID#define W25X20CL_MANF_DEV_ID (0xEF11) // W25X10CL Manufacturer and ID// SPI Flash options#define W25X10CL_SIZE 131072 // SPI Flash memory size in bytes#define W25X20CL_SIZE 262144 // SPI Flash memory size in bytes#define W25X10CL_PAGE 256 // SPI Flash memory page size in bytes#define W25X20CL_PAGE 256 // SPI Flash memory page size in bytes#define SPI_FLASH_DEFAULT_SIZE 131072 // SPI Flash memory size in bytes#define SPI_FLASH_DEFAULT_PAGE 256 // SPI Flash memory page size in bytes//SPI initialization parameters#define SPI_WORD_MODE SPI_8BIT_MODE#define SPI_SMN_MODE SPI_MASTER_MODE#define SPI_POL_MODE SPI_CLK_INIT_HIGH#define SPI_PHA_MODE SPI_PHASE_1#define SPI_MINT_EN SPI_NO_MINT#define SPI_CLK_DIV SPI_XTAL_DIV_2// UART GPIOs assignment#define UART_GPIO_PORT GPIO_PORT_0#define UART_TX_PIN GPIO_PIN_4#define UART_RX_PIN GPIO_PIN_5#define UART_BAUDRATE baudrate_57K6// SPI GPIO assignment#define SPI_GPIO_PORT GPIO_PORT_0#define SPI_CS_PIN GPIO_PIN_3#define SPI_CLK_PIN GPIO_PIN_0#define SPI_DO_PIN GPIO_PIN_6#define SPI_DI_PIN GPIO_PIN_5// EEPROM GPIO assignment#define I2C_GPIO_PORT GPIO_PORT_0#define I2C_SCL_PIN GPIO_PIN_2#define I2C_SDA_PIN GPIO_PIN_3W25X10CL SPI flash is supported. The W25X10CL arrays are organized into 512 programmable pages of 256-bytes each. Up to 256 bytes can be programmed at a time. The W25X10CLhave 32 erasable sectors, 4 erasable 32KB blocks and 2 erasable 64KB blocks respectively. The W25X20CL SPI flash is also supported.Other SPI Flash types can be supported by changing above configuration settings (i.e.SPI_FLASH_SIZE, SPI_FLASH_PAGE etc.)GPIO Port 0 is used by default as it’s supported by all DA14580 types (WLCSP, QFN40 andQFN48).GPIO Pin 4 and 5 are assigned to UART TX and RX respectively.GPIO Pin 0, 3, 5 and 6 are assigned to SPI CS, CLK, DI and DO respectively.The conflict in GPIO Pin 5 is solved by sequential access to it from UART and SPI interface.8 Getting StartedThis section describes how to program the secondary bootloader and an application (i.e. integrated proximity reporter) in the SPI flash or the OTP memory and measure the system booting time. A comparison with normal booter (ROMbooter) is also provided.Smart Snippets toolkit supports tools for SPI Flash and OTP memory programming. The SPI Flash must be programmed with proximity application and the OTP memory with boot loader application.8.1Writing application HEX file to SPI FlashSmart Snippets SPI Flash Programmer is used for downloading an image file to the DA14580 SPI Flash Memory. Figure 2 shows the main screen of the SPI Flash programmer tool.The following three steps are required for preparing the Proximity Reporter application:Open Proximity Reporter project, dk_apps\keil_projects\proximity\reporter_fh.Figure 3: SPI Flash ProgrammerCompile Proximity Reporter Application to generate the executable file full_emb_sysram.hex.Open Smart Snippets and burn full_emb_sysram.hex to SPI Flash memory at offset 0x20. Header is automatically added by the Flash programmer firmware. SPI flash bootable for optimizing the boot time as the boot loader will copy only the actual application data written in SPI header. Make SPI flash non bootable to measure the max booting time as boot loader will copy 32KB from SPI flash.8.2Writing boot loader HEX file to OTP memoryOTP programmer tool enables downloading the default firmware into the System RAM and burning the OTP memory with a user-defined HEX and BIN file. Figure 3 shows the main screen of the OPT programmer.Figure 4: OPT PrograrmmerCompile the project to generate the executable file secondary_bootloader.hexThe following steps are required for programming the executable secondary_bootloader.hex in OTP memory:Open Smart Snippets applicationburn secondary bootloader.hex in OTP imageEnable Application Flag 1 and Application Flag 2, set DMA Length and burn OTP headerNote 3 J12 and J25 must be connected for OTP burning and UART interface, respectively. Make sure 6.8V is connected to the VPP pin. When doing this on the Dialog hardware development kit [3].8.3Measuring the booting timeThis section describes the procedure for measuring the booting time of an application stored in SPI flash with the secondary boot loader described in this document and it’s compared with the time required with the normal loader stored n ROM.The Power Profiler tool of the Smart Snippets toolset is used to measure the time takes between power up and first advertising point.In Figure 4, the booting time of the Proximity application with the secondary loader is shown. The point A corresponds to DA14580 power up time, point B corresponds to the first advertising point, points C and D illustrate the start and end point of the application data transfer from SPI to the system RAM and point C corresponds to the first application entry point (main()). The time required until the first advertisement is 158.8msec. The data transfer from the SPI flash takes 36msec (Note 2) and the time required until the first application entry point is 145msec.Note 4 32KB data transferred instead of the actual application data size.In Figure 5, the booting time of the Proximity application with the normal booting sequence is shown. The point A corresponds to DA14580 power up time, point B corresponds to the first advertising point, points C and D illustrate the start and end point of the application data transfer from SPI to the system RAM and point C corresponds to the first application entry point (main()). The time required until the first advertisement is 309.47msec. The data transfer from the SPI flash takes 100msec and the time required until the first application entry point is 295msec.The secondary loader achieves faster boot time as it skips the scanning sequence of the normal mode while the SPI operation is optimized for the specific used SPI flash.Figure 5: Booting sequence using the secondary loaderFigure 6: Normal booting sequence9 Revision historyStatus definitionsDisclaimerInformation in this document is believed to be accurate and reliable. However, Dialog Semiconductor does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information. Dialog Semiconductor furthermore takes no responsibility whatsoever for the content in this document if provided by any information source outside of Dialog Semiconductor.Dialog Semiconductor reserves the right to change without notice the information published in this document, including without limitation the specification and the design of the related semiconductor products, software and applications.Applications, software, and semiconductor products described in this document are for illustrative purposes only. Dialog Semiconductor makes no representation or warranty that such applications, software and semiconductor products will be suitable for the specified use without further testing or modification. Unless otherwise agreed in writing, such testing or modification is the sole responsibility of the customer and Dialog Semiconductor excludes all liability in this respect. Customer notes that nothing in this document may be construed as a license for customer to use the Dialog Semiconductor products, software and applications referred to in this document. Such license must be separately sought by customer with Dialog Semiconductor.All use of Dialog Semiconductor products, software and applications referred to in this document are subject to Dialog Semiconductor’s Standard Terms and Conditions of Sale, unless otherwise stated.© Dialog Semiconductor GmbH. All rights reserved.RoHS ComplianceDialog Semiconductor complies to European Directive 2001/95/EC and from 2 January 2013 onwards to European Directive 2011/65/EU concerning Restriction of Hazardous Substances (RoHS/RoHS2).Dialog Semiconductor’s statement on RoHS can be found on the customer portal https:///. RoHS certificates from our suppliers are available on request.Contacting Dialog SemiconductorGermany Headquarters Dialog Semiconductor GmbH Phone: +49 7021 805-0United KingdomDialog Semiconductor (UK) Ltd Phone: +44 1793 757700The NetherlandsDialog Semiconductor B.V. Phone: +31 73 640 8822 North AmericaDialog Semiconductor Inc.Phone: +1 408 845 8500JapanDialog Semiconductor K. K.Phone: +81 3 5425 4567TaiwanDialog Semiconductor TaiwanPhone: +886 281 786 222SingaporeDialog Semiconductor SingaporePhone: +65 64 849929ChinaDialog Semiconductor ChinaPhone: +86 21 5178 2561KoreaDialog Semiconductor KoreaPhone: +82 2 3469 8291Email: Web site:。