下面是WinCE中蓝牙协议栈的架构图:
可以看到,HCI传输层以上的协议层全部由WinCE实现了,所以蓝牙模块只需要实现了基带层和链路管理层,并提供HCI传输接口给WinCE就可以了。WinCE支持使用USB、UART、SDIO等接口的蓝牙模块。
开发板上使用的是CSR-BC4-EXT-C2-PA蓝牙模块,模块接在串口0上。使用CSR的BCSP传输协议。以下是配置方法:
1 添加Bluetooth Stack with Universal Loadable Driver
2 注册表配置
[HKEY_LOCAL_MACHINE/Software/Microsoft/Bluetooth/Transports/BuiltIn/1]
"driver"="bthcsr.dll"
"flags"=dword:4
"name"="COM0:"
"baud"=dword:1c200
"resetdelay"=dword:1388
使用COM0,波特率115200。
3 配置PSKEY
先用BlueFlash烧写固件,然后用PSTool配置PSKEY,只要配置HOST_INTERFACE和UART_BAUDRATE就可以了,其他按默认配置。
PSKEY_HOST_INTERFACE: UART link running BCSP
PSKEY_UART_BAUDRATE: 115.2kbaud
4 添加文件传输服务
1) 在PB里增加OBEX inbox和OBEX File Browser组件
2) 修改注册表:
; @CESYSGEN IF SERVERS_MODULES_OBEXFILE
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Obex/Services/{f9ec7bc4-953c-11d2-984e-525400dc9e09}]
"BaseDir"="//Temp//Ftp" ;默认根目录.对方可见目录
"Server"="obexfile.dll"
"canWrite" = dword:1 ;可访问,可读写
"authenticate"= dword:0
"transport authentiate" = dword:0
; @CESYSGEN IF CE_MODULES_BTD
"BluetoothSdpRecord"=hex:35,41,09,00,01,35,03,19,11,06,09,00,04,35,11,35,/
03,19,01,00,35,05,19,00,03,08,0a,35,03,19,00,08,/
09,00,06,35,09,09,65,6e,09,00,6a,09,01,00,09,00,/
09,35,08,35,06,19,11,06,09,01,00,09,01,00,25,03,/
46,54,50
; @CESYSGEN ENDIF CE_MODULES_BTD
; @CESYSGEN ENDIF SERVERS_MODULES_OBEXFILE
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xy1001/archive/2008/12/06/3452861.aspx
wince串口蓝牙
今天终于搞好串口蓝牙了,对于有经验的人来说三五分钟的事情就OK了,我搞了多少天我都不记得了
唉,现在搞驱动啊,主要还是得靠技术支持,所以后来的XDJM要记住了,一个人打拼非常难的!
不多说了,直入正题:
第一步,如果你是一个刚开始搞蓝牙的人,那么,就先用wince自带的 bthcsr 驱动来测试是否正常与主机通信(也测试BT是否是好的)
在注册表加入(这些内容在一份bchs-srn-004_wpp_bcsp_release_notes.pdf的文档有说明)
[HKEY_LOCAL_MACHINE/Software/Microsoft/Bluetooth/Transports/BuiltIn/1]
"driver"="bthcsr.dll"
"Name"="COM2:"
"baud"=dword:E100 ;57600bps
"FlashChip"=dword:0
"flags"=dword:4
"resetdelay"=dword:1388
然后飞线过去和蓝牙模组启动试下,当然串口要对啊,如果是正常启动的话那么恭喜你,第一步已通过,否则检测下串口是否有效,BT是否好的!
第二步,PSKEY 一早就听说过这个了,但没一点印像,到底这东西有多大,是什么样的,其实只是一些数据而已,官方的配置里有N项,但其实我们只用到几个就行了
//PSKEY start
// PSKEY_BDADDR
&0001 = 0000 a5a5 005b 0002 //蓝牙地址,这个不用管
// PSKEY_HOSTIO_MAP_SCO_PCM //PCM这个也不用
&01ab = 0000// False
// PSKEY_HOSTIO_MAP_SCO_CODEC //这个也不用
&01b0 = 0000// False
// PSKEY_PCM_CONFIG32 //默认值这个也不用
&01b3 = 0080 0000
// PSKEY_PCM_FORMAT //这个也不用
&01b6 = 006c
// PSKEY_UART_BAUDRATE
&01be = 00EC// 请查表,可以找到对应的波特率,00Ec是 57600
// PSKEY_ANA_FTRIM
&01f6 = 0022 //这个也不用
// PSKEY_HOST_INTERFACE
&01f9 = 0001// USB link //0001 代表串口蓝牙
// PSKEY_ANA_FREQ //这个也不用
&01fe = 3e80
//pskey end
总结,就两个地方,一个是波特率,一个是接口方式
注,我调试的是 BC04-ROM 的芯片,如果是 -flash 相应改下注册表还有驱动
第三,用官方的驱动,这个网上难找,如PSKEY,最好问支持能力强的供应商要
bchs-srn-004_wpp_bcsp_release_notes.pdf 说这个驱动叫 WPP-BCSP,那么就叫 WPP-BCSP吧,把它扔到BSP驱动程序的目录,编译它,如果通不过提示有错(error C2220: warning treated as error - no object file generated
),那就降低编译警告级别(在驱动里的属性修改)
最后一步
[HKEY_LOCAL_MACHINE/Software/Microsoft/Bluetooth/Transports/BuiltIn/1]
"driver"="Bthbcsp.dll"
"Name"="COM2:"
"baud"=dword:E100
"FlashChip"=dword:0
"flags"=dword:4
"resetdelay"=dword:1388
(当然要把 PSconfig.Psr打进windows目录,因为驱动会根据这个文件来配置)
OK最后就扫描下附近的蓝牙吧
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/liqiong154/archive/2008/12/15/3516832.aspx
//
//
WINCE5.O对USB蓝牙适配器服务的支持
<1>添加蓝牙协议栈
蓝牙组件位置:Communication Services and Networking/Networking - Personal Area Network (PAN)/Bluetooth/
Bluetooth Protocol Stack with Transport Driver Support/Bluetooth Stack with Integrated USB Driver
Bluetooth Protocol Stack with Transport Driver Support/Bluetooth Stack with Universal Loadable Driver
Bluetooth Profiles Support/Bluetooth DUN Gateway
Bluetooth Profiles Support/Bluetooth HS/HF and Audio Gateway Service
Bluetooth Profiles Support/Bluetooth LAP and Configuration Utility
Bluetooth Profiles Support/Bluetooth PAN
<2>添加对象交换协议
Applications and Services Development/OBEX Client
Applications and Services Development/OBEX Server/OBEX File Browser
Applications and Services Development/OBEX Server/OBEX Inbox
<3>修改注册表
修改注册表文件内容:C:/WINCE500/PUBLIC/SERVERS/OAK/FILES/servers.reg
查找下面内容,并添加
"CanWrite" = dword:1
"Authenticate" = dword:0
"Password" = "0000 "
"Transport Authenticate"=dword:0
修改前:
; @CESYSGEN IF SERVERS_MODULES_OBEXFILE
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Obex/Services/{f9ec7bc4-953c-11d2-984e-525400dc9e09}]
"BaseDir"="//Temp//Ftp"
"Server"="obexfile.dll"
; @CESYSGEN IF CE_MODULES_BTD
"BluetoothSdpRecord"=hex:35,41,09,00,01,35,03,19,11,06,09,00,04,35,11,35,/
03,19,01,00,35,05,19,00,03,08,0a,35,03,19,00,08,/
09,00,06,35,09,09,65,6e,09,00,6a,09,01,00,09,00,/
09,35,08,35,06,19,11,06,09,01,00,09,01,00,25,03,/
46,54,50
; @CESYSGEN ENDIF CE_MODULES_BTD
; @CESYSGEN ENDIF SERVERS_MODULES_OBEXFILE
; @CESYSGEN IF SERVERS_MODULES_OBEXEXEC
;[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Obex/Services/{f9ec7bc4-953c-11d2-984e-525400dc9e09}]
; "Server"="obexexec.dll"
; @CESYSGEN ENDIF SERVERS_MODULES_OBEXEXEC
修改后:
; @CESYSGEN IF SERVERS_MODULES_OBEXFILE
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Obex/Services/{f9ec7bc4-953c-11d2-984e-525400dc9e09}]
"BaseDir"="//Temp//Ftp"
"Server"="obexfile.dll"
; @CESYSGEN IF CE_MODULES_BTD
"BluetoothSdpRecord"=hex:35,41,09,00,01,35,03,19,11,06,09,00,04,35,11,35,/
03,19,01,00,35,05,19,00,03,08,0a,35,03,19,00,08,/
09,00,06,35,09,09,65,6e,09,00,6a,09,01,00,09,00,/
09,35,08,35,06,19,11,06,09,01,00,09,01,00,25,03,/
46,54,50
;下面要添加的
"CanWrite" = dword:1
"Authenticate" = dword:0
"Password" = "0000 "
"Transport Authenticate"=dword:0
; @CESYSGEN ENDIF CE_MODULES_BTD
; @CESYSGEN ENDIF SERVERS_MODULES_OBEXFILE
<4>重新编译工程
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/flowlight/archive/2008/05/31/2500031.aspx