├── InitModule ├── FileDialog.bas ├── Form_0xFD.frm ├── Form_0xFD.frx ├── MSSCCPRJ.SCC ├── Path0xfd.csi ├── Path0xfd.vbp ├── Path0xfd.vbw ├── debugcommand.exe ├── logo.ico └── 初始化命令.txt ├── PAN1026_TC35661APL_ROM ├── Core_v4.1.pdf ├── D1_PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf ├── D2_D3_PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf ├── D3_PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf ├── D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf ├── D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf ├── E1_PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf ├── E5_PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf ├── Opcode_disp.cmd ├── Opcode_hide.cmd ├── PAN1026_ATmega128_V1.0 │ ├── EasySPP_Logfiles │ │ └── PAN1026A_Documented.txt │ ├── PAN1026_ATmega128_V1.0.atsln │ ├── PAN1026_ATmega128_V1.0.atsuo │ ├── PAN1026_ATmega128_V1.0 │ │ ├── Eventhandler │ │ │ ├── eventHandler.c │ │ │ ├── eventHandler.h │ │ │ ├── hci_eventHandler.c │ │ │ ├── hci_eventHandler.h │ │ │ ├── mng_eventHandler.c │ │ │ ├── mng_eventHandler.h │ │ │ ├── spp_eventHandler.c │ │ │ └── spp_eventHandler.h │ │ ├── PAN1026_ATmega128_V1.0.c │ │ ├── PAN1026_ATmega128_V1.0.cproj │ │ ├── Statemachine │ │ │ ├── statemachine.c │ │ │ └── statemachine.h │ │ ├── USART │ │ │ ├── usart.c │ │ │ └── usart.h │ │ └── commands.h │ └── PAN1026_MicrocontrollerSoftwareDevelopmentGuide_V1.2.pdf ├── PAN1026_Documentation Guide.pdf ├── PAN1026_Release Notes 22_11_2013.pdf ├── PAN1026_TC35661APL_ROM501_Extension_HCI_E_7thAugust2013.pdf ├── PAN1026_TC35661APL_ROM501_MNG_MSC_E_24thJune2013.pdf ├── PAN1026_TC35661APL_ROM501_SMP_MSC_E_3rdOctober2013.pdf ├── PAN1026_TC35661APL_ROM501_SPP_LE_Application_Note_E_7thAugust2013.pdf ├── PAN1026_TC35661APL_ROM501_SPP_MSC_E_24thJune2013.pdf ├── PAN1026_TC35661_501_Documentation Guide_V2 0.pdf ├── TC35661SBG-501_E_rev100_Oct_2013_Overview_Specification.pdf ├── pan1026emk_hardware_guide-02.pdf ├── pan1026emk_rapid_startup_guide-02.pdf ├── panasonic_pan1026_datasheet.pdf ├── panasonic_pan1026_datasheet_v1.4-947381.pdf ├── panasonic_pan1026_datasheet_v1.4.pdf ├── panasonic_pan1026_design_guide_v1.0.pdf ├── panasonic_pan1026_easyble_software_and_quick_start_guide.zip ├── panasonic_pan1026_easyspp_software_and_quick_start_guide.zip ├── panasonic_pan1026_new_product_introduction.pdf └── panasonic_pan1026_reference_design_and_cad_files.zip ├── TC35661BSG-501引脚处理-1.png ├── TC35661BSG-501引脚处理-2.png ├── Toshiba_TC35661SBG ├── Simultaneous_Operation_of_SPP_and_BLE App Note_v1.1.pdf ├── TC35661APL_ROM501_SPP_LE_DeepSleepFunction_140725a.pdf ├── TC35661SBG-501_E_rev100_Oct_2013_Overview_Specification.pdf ├── TC35661SBG-Flyer_201307-274796.pdf ├── Toshiba BT SDK v2_0_4_X_Overview.pdf ├── Toshiba_Bluetooth_Brochure_web.pdf ├── application_note_deep_sleep_modes_7.25.14.pdf └── bt_dual_mode_software_driver.zip ├── bm77引脚描述.png ├── readme.md └── 无密码pos ├── 初始化.txt ├── 无密码通信.xls ├── 通信-android.txt └── 通信-ios.txt /InitModule/FileDialog.bas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/FileDialog.bas -------------------------------------------------------------------------------- /InitModule/Form_0xFD.frm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/Form_0xFD.frm -------------------------------------------------------------------------------- /InitModule/Form_0xFD.frx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/Form_0xFD.frx -------------------------------------------------------------------------------- /InitModule/MSSCCPRJ.SCC: -------------------------------------------------------------------------------- 1 | [SCC] 2 | SCC=This is a source code control file 3 | [Path0xfd.vbp] 4 | SCC_Project_Name=this project is not under source code control 5 | SCC_Aux_Path= 6 | -------------------------------------------------------------------------------- /InitModule/Path0xfd.csi: -------------------------------------------------------------------------------- 1 | [History] 2 | 1=#P0#=mb #P1#=Open_Click #P2#=TC356661/Form_0xFD/Open_Click #P3#= #P4#= #P5#=MembEventProcPrivate #P6#=20160526134527 #P7#=0 #P8#=5 . 3 | 2=#P0#=mb #P1#=ClearUnHex #P2#=TC356661/Form_0xFD/ClearUnHex #P3#= #P4#= #P5#=MembMethodPublic #P6#=20160526134413 #P7#=0 #P8#=-2 . 4 | -------------------------------------------------------------------------------- /InitModule/Path0xfd.vbp: -------------------------------------------------------------------------------- 1 | Type=Exe 2 | Module=FileDialog; FileDialog.bas 3 | Form=Form_0xFD.frm 4 | Object={648A5603-2C6E-101B-82B6-000000000014}#1.1#0; mscomm32.ocx 5 | IconForm="Form_0xFD" 6 | Startup="Form_0xFD" 7 | HelpFile="" 8 | Title="TC356661" 9 | ExeName32="debugcommand.exe" 10 | Command32="" 11 | Name="TC356661" 12 | HelpContextID="0" 13 | Description="TC356661" 14 | CompatibleMode="0" 15 | MajorVer=1 16 | MinorVer=0 17 | RevisionVer=33 18 | AutoIncrementVer=1 19 | ServerSupportFiles=0 20 | VersionCompanyName="Microsoft" 21 | VersionFileDescription="Yuht" 22 | VersionProductName="TC356661" 23 | CompilationType=0 24 | OptimizationType=0 25 | FavorPentiumPro(tm)=0 26 | CodeViewDebugInfo=0 27 | NoAliasing=0 28 | BoundsCheck=0 29 | OverflowCheck=0 30 | FlPointCheck=0 31 | FDIVCheck=0 32 | UnroundedFP=0 33 | StartMode=0 34 | Unattended=0 35 | Retained=0 36 | ThreadPerObject=0 37 | MaxNumberOfThreads=1 38 | DebugStartupOption=0 39 | 40 | [MS Transaction Server] 41 | AutoRefresh=1 42 | 43 | [CodeSMART] 44 | Task_UID=09_02_14_10_30_54 45 | -------------------------------------------------------------------------------- /InitModule/Path0xfd.vbw: -------------------------------------------------------------------------------- 1 | FileDialog = 234, 106, 932, 533, C 2 | Form_0xFD = 105, 34, 1052, 549, Z, 61, 26, 974, 542, C 3 | -------------------------------------------------------------------------------- /InitModule/debugcommand.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/debugcommand.exe -------------------------------------------------------------------------------- /InitModule/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/logo.ico -------------------------------------------------------------------------------- /InitModule/初始化命令.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/InitModule/初始化命令.txt -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/Core_v4.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/Core_v4.1.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/D1_PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/D1_PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/D2_D3_PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/D2_D3_PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/D3_PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/D3_PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/E1_PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/E1_PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/E5_PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/E5_PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/Opcode_disp.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | ren "PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf" "D1_PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf" 3 | ren "PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf" "D2_D3_PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf" 4 | ren "PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf" "D3_PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf" 5 | ren "PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf" "D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf" 6 | ren "PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf" "D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf" 7 | ren "PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf" "E1_PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf" 8 | ren "PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf" "E5_PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf" 9 | ren "PAN1026_TC35661APL_ROM501_Extension_HCI_E_7thAugust2013.pdf" "FC_PAN1026_TC35661APL_ROM501_Extension_HCI_E_7thAugust2013.pdf" 10 | -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/Opcode_hide.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | ren "D1_PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf" "PAN1026_TC35661APL_ROM501_LE_MNG_E_20thNovember2013.pdf" 3 | ren "D2_D3_PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf" "PAN1026_TC35661APL_ROM501_GATT_E_20thNovember2013.pdf" 4 | ren "D3_PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf" "PAN1026_TC35661APL_ROM501_SDB_E_26thJuly2013.pdf" 5 | ren "D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf" "PAN1026_TC35661APL_ROM501_SMP_SDS_E_21stAugust2013.pdf" 6 | ren "D5_PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf" "PAN1026_TC35661APL_ROM501_SMP_SDS_E_26thJuly2013.pdf" 7 | ren "E1_PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf" "PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013_1.pdf" 8 | ren "E5_PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf" "PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf" 9 | ren "FC_PAN1026_TC35661APL_ROM501_Extension_HCI_E_7thAugust2013.pdf" "PAN1026_TC35661APL_ROM501_Extension_HCI_E_7thAugust2013.pdf" -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/EasySPP_Logfiles/PAN1026A_Documented.txt: -------------------------------------------------------------------------------- 1 | // ******************************************************** Introduction ******************************************************** 2 | This document shall enhance the comprehension of the command/event structure for the PAN1026. 3 | Please be informed that the BD-Address and the remote BD-Address in the sourcecode and the ones in this document may differ. 4 | 5 | // ************************************************ Software reset of the module ************************************************ 6 | // The HCI commands which are not described in Toshiba's HCI specification can be found in the core specification. 7 | // All the page references in this document are stated for the total amount of pages and NOT the references on the pages. 8 | -------------------------------- 9 | 11:11:18: H-> TCU_HCI_RESET_REQ: 10 | 0 --------------- 11 | TCU_HCI_RESET_REQ 12 | Length: 4 (0x000004) 13 | Data: 0x01 0x03 0x0c 0x00 14 | ------------------------- 15 | |1x command|2x OpCode (contents OCF and OGF)|1x ParameterLength 16 | Document: Bluetooth Core Specification v4.1.pdf - page 935 17 | 18 | --------------------------------- 19 | 11:11:18: <-H TCU_HCI_RESET_RESP: 20 | 0 ---------------- 21 | TCU_HCI_RESET_RESP 22 | Length: 7 (0x000007) 23 | Data: 0x04 0x0e 0x04 0x04 0x03 0x0c 0x00 24 | ---------------------------------------- 25 | |1x Event|1x CommandComplete|1x ParameterLength|1x NHCP (Num HCI Command Packets)|2x OpCode|1x Status| 26 | Document: Bluetooth Core Specification v4.1.pdf - page 935 27 | 28 | 29 | 30 | // ************************************************** Get firmware version **************************************************** 31 | ----------------------------------------------- 32 | 11:11:18: H-> TCU_HCI_GET_FIRMWARE_VERSION_REQ: 33 | 0 ------------------------------ 34 | TCU_HCI_GET_FIRMWARE_VERSION_REQ 35 | Length: 13 (0x00000d) 36 | Data: 0x01 0x08 0xfc 0x09 0x00 0xa1 0x00 0x00 0x00 0x14 0x0d 0xff 0x00 37 | ---------------------------------------------------------------------- 38 | |1x command|1x OCF|1x OGF+OCF|1x CommandLength|1x Reserved|1x InformationGettingRequestCommand|3x Reserved|1x Accepter|1x InformationID (GetFirmware)|1x Reserved|1x DataType| 39 | | OpCode | 40 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 47-49 41 | 42 | ------------------------------------------------ 43 | 11:11:18: <-H TCU_HCI_GET_FIRMWARE_VERSION_RESP: 44 | 0 ------------------------------- 45 | TCU_HCI_GET_FIRMWARE_VERSION_RESP 46 | Length: 33 (0x000021) 47 | Data: 0x04 0xff 0x1e 0x08 0x00 0xa1 0x00 0x00 0x00 0x14 0x0d 0x00 0x0f 0x38 0x2e 0x30 0x30 0x2e 0x37 0x32 0x42 0x2d 0x30 0x36 0x20 0x52 0x4f 0x4d 0x3d 0x35 0x30 0x31 0x00 48 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 49 | |1x Event|1x EventCode (ExtEvent)|1x ParameterLength|1x OCF|1x Reserved|1x InformationGettingRequestCommand|3x Reserved|1x Accepter|1x InformationID(GetFirmware)|1x CommandResult|1x DataType|11x Data| 50 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 47-49 51 | 52 | 53 | 54 | // ************************************************ Get BD-Address, RF parameter, etc. from EEPROM ************************************************ 55 | 56 | // ****************Enable I2C interface**************** 57 | ------------------------------------------------ 58 | 11:11:19: H-> TCU_HCI_M2_BTL_SET_I2C_ENABLE_REQ: 59 | 0 ------------------------------- 60 | TCU_HCI_M2_BTL_SET_I2C_ENABLE_REQ 61 | Length: 15 (0x00000f) 62 | Data: 0x01 0x08 0xfc 0x0b 0x00 0xa0 0x00 0x00 0x00 0x14 0x5b 0xff 0x02 0x03 0x01 63 | -------------------------------------------------------------------------------- 64 | |1x command|1x OCF|1x OGF+OCF|1x ParameterLength|1x Reserved|1x InformationSettingRequestCommand|3x Reserved|1x Accepter|1x InformationID|1x Reserved|1x DataType|1x SCL Frequency Setting|1x Set Spike Removal Filter Number| 65 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 38 66 | 67 | ------------------------------------------------- 68 | 11:11:19: <-H TCU_HCI_M2_BTL_SET_I2C_ENABLE_RESP: 69 | 0 -------------------------------- 70 | TCU_HCI_M2_BTL_SET_I2C_ENABLE_RESP 71 | Length: 13 (0x00000d) 72 | Data: 0x04 0xff 0x0a 0x08 0x00 0xa0 0x00 0x00 0x00 0x14 0x5b 0x00 0x00 73 | ---------------------------------------------------------------------- 74 | |1x Event|1x EventCode (ExtEvent)|1x ParameterLength|1x OCF|1x Reserved|1x InformationSettingRequestCommand|3x Reserved|1x Accepter|1x InformationID(GetFirmware)|1x CommandResult|1x DataType| 75 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 38 76 | 77 | 78 | // ****************Enable EEPROM write enable**************** 79 | ----------------------------------------------------- 80 | 11:11:19: H-> TCU_HCI_M2_BTL_EEPROM_WRITE_ENABLE_REQ: 81 | 0 ------------------------------------ 82 | TCU_HCI_M2_BTL_EEPROM_WRITE_ENABLE_REQ 83 | Length: 13 (0x00000d) 84 | Data: 0x01 0x08 0xfc 0x09 0x00 0xa0 0x00 0x00 0x00 0x14 0x83 0xff 0x00 85 | ---------------------------------------------------------------------- 86 | |1x command|1x OCF|1x OGF+OCF|1x CommandLength|1x Reserved|1x InformationSettingRequestCommand|3x Reserved|1x Accepter|1x InformationID|1x Reserved|1x DataType| 87 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 41 88 | 89 | ------------------------------------------------------ 90 | 11:11:19: <-H TCU_HCI_M2_BTL_EEPROM_WRITE_ENABLE_RESP: 91 | 0 ------------------------------------- 92 | TCU_HCI_M2_BTL_EEPROM_WRITE_ENABLE_RESP 93 | Length: 13 (0x00000d) 94 | Data: 0x04 0xff 0x0a 0x08 0x00 0xa0 0x00 0x00 0x00 0x14 0x83 0x00 0x00 95 | ---------------------------------------------------------------------- 96 | |1x Event|1x EventCode|1x CommandLength|1x OCF|1x Reserved|1x InformationSettingRequestCommand|3x Reserved|1x Accepter|1x InformationID(GetFirmware)|1x CommandResult|1x DataType| 97 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 41 98 | 99 | 100 | // ****************Read data from EEPROM**************** 101 | ------------------------------------------------- 102 | 11:11:19: H-> TCU_HCI_M2_GENERAL_READ_EEPROM_REQ: 103 | 0 -------------------------------- 104 | TCU_HCI_M2_GENERAL_READ_EEPROM_REQ 105 | Length: 20 (0x000014) 106 | Data: 0x01 0x08 0xfc 0x10 0x00 0xa1 0x00 0x00 0x00 0x14 0x88 0xff 0x10 0x06 0xa0 0x01 0x01 0x06 0x02 0x00 107 | --------------------------------------------------------------------------------------------------------- 108 | |1x command|1x OCF|1x OGF+OCF|1x ParameterLength|1x Reserved|1x InformationSettingRequestCommand|3x Reserved|1x Accepter|1x InformationID|1x Reserved|1x DataType|1x SpecifyLengthByte13|1x SpecifyEEPROMDeviceAddress|1xSpecifyAddressBitLength|1x SpecifyReadDataSize|1x SpecifyAddressLSD|1x SpecifyLSD+1| 109 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 50 110 | 111 | -------------------------------------------------- 112 | 11:11:19: <-H TCU_HCI_M2_GENERAL_READ_EEPROM_RESP: 113 | 0 --------------------------------- 114 | TCU_HCI_M2_GENERAL_READ_EEPROM_RESP 115 | Length: 20 (0x000014) |----------BD-Address---------| 116 | Data: 0x04 0xff 0x11 0x08 0x00 0xa1 0x00 0x00 0x00 0x14 0x88 0x00 0x10 0x06 0x00 0x13 0x43 0x0b 0xee 0xc2 117 | --------------------------------------------------------------------------------------------------------- 118 | |----------BD-Address---------| 119 | |1x Event|1x EventCode|1x CommandLength|1x OCF|1x Reserved|1x InformationGettingRequestCommand|3x Reserved|1x AccepterInitiator|1x InformationID|1x CommandResult|1x DataByte|1x LengthOfBD-Address|1x BD-Address| 120 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 51 121 | 122 | 123 | 124 | // ************************************************ Write BD-Address on RAM read from EEPROM ************************************************ 125 | 126 | // ****************Write data to RAM**************** 127 | ---------------------------------------- 128 | 11:11:30: H-> TCU_HCI_WRITE_BD_ADDR_REQ: 129 | 0 ----------------------- 130 | TCU_HCI_WRITE_BD_ADDR_REQ 131 | Length: 10 (0x00000a) 132 | Data: 0x01 0x13 0x10 0x06 0xc2 0xee 0x0b 0x43 0x13 0x00 133 | ------------------------------------------------------- 134 | |Command|OCF|OGF+OCF|CommandLength|BD_ADDR(LSB)|BD_ADDR(LSB)|BD_ADDR(LSB+1)|BD_ADDR(LSB+2)|BD_ADDR(LSB+3)|BD_ADDR(LSB+4)|BD_ADDR(MSB)| 135 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 23 136 | 137 | ----------------------------------------- 138 | 11:11:30: <-H TCU_HCI_WRITE_BD_ADDR_RESP: 139 | 0 ------------------------ 140 | TCU_HCI_WRITE_BD_ADDR_RESP 141 | Length: 7 (0x000007) 142 | Data: 0x04 0x0e 0x04 0x04 0x13 0x10 0x00 143 | ---------------------------------------- 144 | |Event|EventCode(Command Complete Event)|CommandLength|Num HCI Command Packets|OCF|OGF+OCF|Status (00:successful, Except-0:failed)| 145 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 23 146 | 147 | 148 | 149 | // ********************************Here would be the place to write RF parameters read from EEPROM, set parameters for sleep mode etc.******************************** 150 | 151 | 152 | 153 | // ************************************************Change from HCI mode to Complete mode************************************************ 154 | ----------------------------------- 155 | 11:11:30: H-> TCU_HCI_SET_MODE_REQ: 156 | 0 ------------------ 157 | TCU_HCI_SET_MODE_REQ 158 | Length: 7 (0x000007) 159 | Data: 0x01 0x08 0xfc 0x03 0x00 0x99 0x01 160 | ---------------------------------------- 161 | |1x Command|1x OCF|1x OGF+OCF|1x CommandLength|1x Reserved|1x SET MODE command|1x Fixed value| 162 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 24 163 | 164 | ------------------------------------ 165 | 11:11:30: <-H TCU_HCI_SET_MODE_RESP: 166 | 0 ------------------- 167 | TCU_HCI_SET_MODE_RESP 168 | Length: 8 (0x000008) 169 | Data: 0x04 0xff 0x05 0x08 0x00 0x99 0x00 0x01 170 | --------------------------------------------- 171 | |Event|EventCode|CommandLength|OCF|Reserved|SET MODE command|Status (00:successful, Except-0:failed)|Fixed value| 172 | Document: TC35661_ROM501_HCI_E_18thSeptember2013.pdf - page 24 173 | 174 | 175 | 176 | // ************************************************Device Initialisation************************************************ 177 | 178 | // ****************Initialisation of TC35661 firmware, device name etc.**************** 179 | ------------------------------- 180 | 11:11:30: --> TCU_MNG_INIT_REQ: 181 | 0 -------------- 182 | TCU_MNG_INIT_REQ 183 | Supported profiles: SPP (0x04) 184 | Paired information stored: Disabled (0x00) 185 | Length of device name: 8 (0x08) 186 | Device Name: PAN1026A 187 | 1 ----- 188 | Generic 189 | Service ID: 0xe1 190 | Op code: 0x01 191 | Length: 11 (0x000b) 192 | 2 -- 193 | UART 194 | Length: 18 (0x000012) 195 | Data: 0x12 0x00 0x00 0xe1 0x01 0x0b 0x00 0x04 0x00 0x08 0x50 0x41 0x4e 0x31 0x30 0x32 0x36 0x41 196 | ----------------------------------------------------------------------------------------------- 197 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x SupportedProfiles|1x PairedInformationStored|1x LengthOfDeviceName|max.128x DeviceName| 198 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 6 199 | 200 | -------------------------------- 201 | 11:11:30: <-- TCU_MNG_INIT_RESP: 202 | 0 --------------- 203 | TCU_MNG_INIT_RESP 204 | Status: successful (0x00) 205 | BD addr: 00:13:43:0B:EE:C2 206 | 1 ----- 207 | Generic 208 | Service ID: 0xe1 209 | Op code: 0x81 210 | Length: 7 (0x0007) 211 | 2 -- 212 | UART 213 | Length: 14 (0x00000e) 214 | Data: 0x0e 0x00 0x00 0xe1 0x81 0x07 0x00 0x00 0xc2 0xee 0x0b 0x43 0x13 0x00 215 | --------------------------------------------------------------------------- 216 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x BD_ADDR| 217 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 8 218 | 219 | 220 | 221 | // ************************************************Set class of Device************************************************ 222 | ----------------------------------------------------------------- 223 | 11:11:30: --> TCU_MNG_STANDARD_HCI_SET_REQ_Write_Class_of_Device: 224 | 0 ------------------------------------------------ 225 | TCU_MNG_STANDARD_HCI_SET_REQ_Write_Class_of_Device 226 | Class_of_Device: 0xc01118 227 | 1 ----- 228 | Generic 229 | Service ID: 0xe1 230 | Op code: 0x3d 231 | Length: 6 (0x0006) 232 | 2 -- 233 | UART 234 | Length: 13 (0x00000d) 235 | Data: 0x0d 0x00 0x00 0xe1 0x3d 0x06 0x00 0x24 0x0c 0x03 0x18 0x11 0xc0 236 | ---------------------------------------------------------------------- 237 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|max.256x Parameters| 238 | |1x OpCodeLSB|1x OpCodeMSB|1x ParameterLength|3x Parameter| //Write ClassOfDevice 239 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 61-62 240 | 241 | ------------------------------------------------------------------ 242 | 11:11:30: <-- TCU_MNG_STANDARD_HCI_SET_RESP_Write_Class_of_Device: 243 | 0 ------------------------------------------------- 244 | TCU_MNG_STANDARD_HCI_SET_RESP_Write_Class_of_Device 245 | Status: successful (0x00) 246 | Hci_Status: 0x00 247 | 1 ----- 248 | Generic 249 | Service ID: 0xe1 250 | Op code: 0xbd 251 | Length: 8 (0x0008) 252 | 2 -- 253 | UART 254 | Length: 15 (0x00000f) 255 | Data: 0x0f 0x00 0x00 0xe1 0xbd 0x08 0x00 0x00 0x06 0x0e 0x04 0x01 0x24 0x0c 0x00 256 | -------------------------------------------------------------------------------- 257 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x ParameterLength|1x Parameter1=CompleteOpCode|1x Parameter2=LengthOfParameter3|1x Parameter3=OpCodeNHCP|1x Parameter4=OpCodeLSB|1x Parameter5=OpCodeMSB|1x Parameter6=Status| 258 | Document: PAN1026_TC35661_ROM501_MNG_E_26thJuly2013_1.pdf - page 65 259 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 64-65 260 | 261 | 262 | // ************************************************Set up SPP (Serial Port Profile)************************************************ 263 | -------------------------------- 264 | 11:11:30: --> TCU_SPP_SETUP_REQ: 265 | 0 ----- 266 | Generic 267 | Service ID: 0xe5 268 | Op code: 0x01 269 | Length: 0 (0x0000) 270 | 1 -- 271 | UART 272 | Length: 7 (0x000007) 273 | Data: 0x07 0x00 0x00 0xe5 0x01 0x00 0x00 274 | ---------------------------------------- 275 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength| 276 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf - page 5 277 | 278 | --------------------------------- 279 | 11:11:30: <-- TCU_SPP_SETUP_RESP: 280 | 0 ----- 281 | Generic 282 | Service ID: 0xe5 283 | Op code: 0x81 284 | Length: 1 (0x0001) 285 | 1 -- 286 | UART 287 | Length: 8 (0x000008) 288 | Data: 0x08 0x00 0x00 0xe5 0x81 0x01 0x00 0x00 289 | --------------------------------------------- 290 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status| 291 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf - page 5 292 | 293 | 294 | // **************************************************** Inquiry and page scan **************************************************** 295 | ----------------------------------- 296 | 11:11:30: --> TCU_MNG_SET_SCAN_REQ: 297 | 0 ------------------ 298 | TCU_MNG_SET_SCAN_REQ 299 | Scan_Mode: 0x03 300 | 1 ----- 301 | Generic 302 | Service ID: 0xe1 303 | Op code: 0x0c 304 | Length: 1 (0x0001) 305 | 2 -- 306 | UART 307 | Length: 8 (0x000008) 308 | Data: 0x08 0x00 0x00 0xe1 0x0c 0x01 0x00 0x03 309 | --------------------------------------------- 310 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x ScanMode| 311 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 33 312 | 313 | ------------------------------------ 314 | 11:11:30: <-- TCU_MNG_SET_SCAN_RESP: 315 | 0 ------------------- 316 | TCU_MNG_SET_SCAN_RESP 317 | Status: successful (0x00) 318 | 1 ----- 319 | Generic 320 | Service ID: 0xe1 321 | Op code: 0x8c 322 | Length: 1 (0x0001) 323 | 2 -- 324 | UART 325 | Length: 8 (0x000008) 326 | Data: 0x08 0x00 0x00 0xe1 0x8c 0x01 0x00 0x00 327 | --------------------------------------------- 328 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status| 329 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 33 330 | 331 | 332 | 333 | // ************************************************ Establish ACL and SPP connection ************************************************ 334 | ---------------------------------- 335 | 11:12:05: --> TCU_SPP_CONNECT_REQ: 336 | 0 ----------------- 337 | TCU_SPP_CONNECT_REQ 338 | Bd_Addr: 00:13:43:0B:F2:67 339 | Server_Channel: 5 340 | 1 ----- 341 | Generic 342 | Service ID: 0xe5 343 | Op code: 0x03 344 | Length: 16 (0x0010) 345 | 2 -- 346 | UART 347 | Length: 23 (0x000017) 348 | Data: 0x17 0x00 0x00 0xe5 0x03 0x10 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x07 0x16 0x00 0x00 0x00 0x00 0x00 0x01 0x05 0x00 349 | ------------------------------------------------------------------------------------------------------------------------ 350 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|6x BD_ADDR|1x Baudrate|1x DataFormat|1x FlowControl|1x XonChar|1x XoffChar|2x ParmMask|1x ServerChannelValidity|1x ServerChannel|1x UseOfLinkKey|16x LinkKey| 351 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013.pdf - page 8 352 | 353 | 354 | // Acknowledge the start of the previous command operation 355 | ------------------------- 356 | 11:12:05: <-- TCU_ACCEPT: 357 | 0 -------- 358 | TCU_ACCEPT 359 | Status: successful (0x00) 360 | Command ServiceID: 0xe5 361 | Command OpCode: 0x03 362 | 1 ----- 363 | Generic 364 | Service ID: 0xe1 365 | Op code: 0xf1 366 | Length: 3 (0x0003) 367 | 2 -- 368 | UART 369 | Length: 10 (0x00000a) 370 | Data: 0x0a 0x00 0x00 0xe1 0xf1 0x03 0x00 0x00 0xe5 0x03 371 | ------------------------------------------------------- 372 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x CommandServiceID|1x CommandOpCode| 373 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 67 374 | 375 | ---------------------------------------------- 376 | 11:12:06: <-- TCU_MNG_CONNECTION_STATUS_EVENT: 377 | 0 ----------------------------- 378 | TCU_MNG_CONNECTION_STATUS_EVENT 379 | Status: successful (0x00) 380 | Bd_addr: 00:13:43:0B:F2:67 381 | Connection_Status: connected (0x00) 382 | 1 ----- 383 | Generic 384 | Service ID: 0xe1 385 | Op code: 0x47 386 | Length: 8 (0x0008) 387 | 2 -- 388 | UART 389 | Length: 15 (0x00000f) 390 | Data: 0x0f 0x00 0x00 0xe1 0x47 0x08 0x00 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x00 391 | -------------------------------------------------------------------------------- 392 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x Bd_Addr|1x ConnectionStatus|16x LinkKey|1x LinkKeyType|2x SniffInterval| 393 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 27 394 | 395 | ----------------------------------------------------------- 396 | 11:12:06: <-- TCU_MNG_REMOTE_DEVICE_NAME_AUTO_NOTIFY_EVENT: 397 | 0 ------------------------------------------ 398 | TCU_MNG_REMOTE_DEVICE_NAME_AUTO_NOTIFY_EVENT 399 | Bd_addr: 00:13:43:0B:F2:67 400 | Length_of_Device_Name: 8 401 | Device_Name: 'PAN1026B' 402 | 1 ----- 403 | Generic 404 | Service ID: 0xe1 405 | Op code: 0x6e 406 | Length: 15 (0x000f) 407 | 2 -- 408 | UART 409 | Length: 22 (0x000016) 410 | Data: 0x16 0x00 0x00 0xe1 0x6e 0x0f 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x08 0x50 0x41 0x4e 0x31 0x30 0x32 0x36 0x42 411 | ------------------------------------------------------------------------------------------------------------------- 412 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|6x BD-Address|1x LengthOfDeviceName|max.128x DeviceName| 413 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 51 414 | 415 | 416 | ---------------------------------------------- 417 | 11:12:06: <-- HCI_IO_Capability_Request_Event: 418 | 0 ----------------------------- 419 | HCI_IO_Capability_Request_Event 420 | Op_Code: 0x31 421 | Parameter_Length: 6 422 | Bd_addr: 00:13:43:0B:F2:67 423 | 1 ----- 424 | Generic 425 | Service ID: 0xe1 426 | Op code: 0x7d 427 | Length: 8 (0x0008) 428 | 2 -- 429 | UART 430 | Length: 15 (0x00000f) 431 | Data: 0x0f 0x00 0x00 0xe1 0x7d 0x08 0x00 0x31 0x06 0x67 0xf2 0x0b 0x43 0x13 0x00 432 | -------------------------------------------------------------------------------- 433 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCode|1x ParameterLength|6x BD-Address| 434 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 47 435 | 436 | 437 | // ************************************************ Control SecureSimplePairing Part 1 ************************************************ 438 | ------------------------------------------------------------------ 439 | 11:12:06: --> TCU_MNG_SSP_SET_REQ_HCI_IO_Capability_Request_Reply: 440 | 0 ------------------------------------------------- 441 | TCU_MNG_SSP_SET_REQ_HCI_IO_Capability_Request_Reply 442 | Bd_Addr: 00:13:43:0B:F2:67 443 | IO_Capability: 0x01 444 | OOB_Data_Present: 0x00 445 | Authentication_Requirement: 0x03 446 | 1 ----- 447 | Generic 448 | Service ID: 0xe1 449 | Op code: 0x3d 450 | Length: 12 (0x000c) 451 | 2 -- 452 | UART 453 | Length: 19 (0x000013) 454 | Data: 0x13 0x00 0x00 0xe1 0x3d 0x0c 0x00 0x2b 0x04 0x09 0x67 0xf2 0x0b 0x43 0x13 0x00 0x01 0x00 0x03 455 | ---------------------------------------------------------------------------------------------------- 456 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCodeLSB|1x OpCodeMSB|1x ParameterLength|6x BD-Address| 457 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 37 458 | 459 | 460 | ------------------------------------------------------------------- 461 | 11:12:06: <-- TCU_MNG_SSP_SET_RESP_HCI_IO_Capability_Request_Reply: 462 | 0 -------------------------------------------------- 463 | TCU_MNG_SSP_SET_RESP_HCI_IO_Capability_Request_Reply 464 | Status: successful (0x00) 465 | Hci_Status: 0x00 466 | Bd_addr: 00:13:43:0B:F2:67 467 | 1 ----- 468 | Generic 469 | Service ID: 0xe1 470 | Op code: 0xbd 471 | Length: 14 (0x000e) 472 | 2 -- 473 | UART 474 | Length: 21 (0x000015) 475 | Data: 0x15 0x00 0x00 0xe1 0xbd 0x0e 0x00 0x00 0x0c 0x0e 0x0a 0x01 0x2b 0x04 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 476 | -------------------------------------------------------------------------------------------------------------- 477 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x ParameterLength|1x OpCodeCommandComplete|1x EventLength|1x NHCP|1x OpCodeCommandLSB|1x OpCodeCommandMSB|1x Status|6x BD-Address| 478 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 42 479 | 480 | //Indicate to host that IO capabilities from a remote device have been received during simple pairing process 481 | ----------------------------------------------- 482 | 11:12:06: <-- HCI_IO_Capability_Response_Event: 483 | 0 ------------------------------ 484 | HCI_IO_Capability_Response_Event 485 | Op_Code: 0x32 486 | Parameter_Length: 9 487 | Bd_addr: 00:13:43:0B:F2:67 488 | IO_Capability: 0x01 489 | OOB_Data_Present: 0x00 490 | Authentication_Requirement: 0x03 491 | 1 ----- 492 | Generic 493 | Service ID: 0xe1 494 | Op code: 0x7d 495 | Length: 11 (0x000b) 496 | 2 -- 497 | UART 498 | Length: 18 (0x000012) 499 | Data: 0x12 0x00 0x00 0xe1 0x7d 0x0b 0x00 0x32 0x09 0x67 0xf2 0x0b 0x43 0x13 0x00 0x01 0x00 0x03 500 | ----------------------------------------------------------------------------------------------- 501 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCode|1x ParameterLength|6x RemoteBD-Address|1x IO_Capability|1x OOBDataPresent| 502 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 48 503 | 504 | ----------------------------------------------------- 505 | 11:12:06: <-- HCI_IO_User_Confirmation_Request_Event: 506 | 0 ------------------------------------ 507 | HCI_IO_User_Confirmation_Request_Event 508 | Op_Code: 0x33 509 | Parameter_Length: 10 510 | Bd_addr: 00:13:43:0B:F2:67 511 | Numeric_Value: 0x00051cbf 512 | 1 ----- 513 | Generic 514 | Service ID: 0xe1 515 | Op code: 0x7d 516 | Length: 12 (0x000c) 517 | 2 -- 518 | UART 519 | Length: 19 (0x000013) 520 | Data: 0x13 0x00 0x00 0xe1 0x7d 0x0c 0x00 0x33 0x0a 0x67 0xf2 0x0b 0x43 0x13 0x00 0xbf 0x1c 0x05 0x00 521 | ---------------------------------------------------------------------------------------------------- 522 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCode|1x ParameterLength|10x Parameters| 523 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 49 524 | 525 | 526 | // *************************************************** Control SSP Part 2 ***************************************************** 527 | ---------------------------------------------------------------------- 528 | 11:12:09: --> TCU_MNG_SSP_SET_REQ_HCI_User_Confirmation_Request_Reply: 529 | 0 ----------------------------------------------------- 530 | TCU_MNG_SSP_SET_REQ_HCI_User_Confirmation_Request_Reply 531 | Bd_Addr: 00:13:43:0B:F2:67 532 | 1 ----- 533 | Generic 534 | Service ID: 0xe1 535 | Op code: 0x3d 536 | Length: 10 (0x000a) 537 | 2 -- 538 | UART 539 | Length: 17 (0x000011) 540 | Data: 0x11 0x00 0x00 0xe1 0x3d 0x0a 0x00 0x2c 0x04 0x06 0x67 0xf2 0x0b 0x43 0x13 0x00 0x00 541 | ------------------------------------------------------------------------------------------ 542 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCode|1x ParameterLength|10x Parameters| 543 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 39 544 | 545 | ----------------------------------------------------------------------- 546 | 11:12:09: <-- TCU_MNG_SSP_SET_RESP_HCI_User_Confirmation_Request_Reply: 547 | 0 ------------------------------------------------------ 548 | TCU_MNG_SSP_SET_RESP_HCI_User_Confirmation_Request_Reply 549 | Status: successful (0x00) 550 | Hci_Status: 0x00 551 | Bd_addr: 00:13:43:0B:F2:67 552 | 1 ----- 553 | Generic 554 | Service ID: 0xe1 555 | Op code: 0xbd 556 | Length: 14 (0x000e) 557 | 2 -- 558 | UART 559 | Length: 21 (0x000015) 560 | Data: 0x15 0x00 0x00 0xe1 0xbd 0x0e 0x00 0x00 0x0c 0x0e 0x0a 0x01 0x2c 0x04 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 561 | -------------------------------------------------------------------------------------------------------------- 562 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x ParameterLength|1x OpCodeCommandComplete|1x EventLength|1x NHCP|1x OpCodeLSB|1x OpCodeMSB|1x Status|6x BD-Address| 563 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 43 564 | 565 | 566 | // Indicates that simple pairing process has been completed 567 | ------------------------------------------------ 568 | 11:12:09: <-- HCI_Simple_Pairing_Complete_Event: 569 | 0 ------------------------------- 570 | HCI_Simple_Pairing_Complete_Event 571 | Op_Code: 0x36 572 | Parameter_Length: 7 573 | Status: 0x00 574 | Bd_addr: 00:13:43:0B:F2:67 575 | 1 ----- 576 | Generic 577 | Service ID: 0xe1 578 | Service ID: 0xe1 579 | Op code: 0x7d 580 | Length: 9 (0x0009) 581 | 2 -- 582 | UART 583 | Length: 16 (0x000010) 584 | Data: 0x10 0x00 0x00 0xe1 0x7d 0x09 0x00 0x36 0x07 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 585 | ------------------------------------------------------------------------------------- 586 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x OpCode|1x ParameterLength|7x Parameters| 587 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 50 588 | 589 | ---------------------------------------------- 590 | 11:12:09: <-- TCU_MNG_CONNECTION_STATUS_EVENT: 591 | 0 ----------------------------- 592 | TCU_MNG_CONNECTION_STATUS_EVENT 593 | Status: successful (0x00) 594 | Bd_addr: 00:13:43:0B:F2:67 595 | Connection_Status: link key (0x03) 596 | Link_Key: 89:BE:0B:FD:4E:4E:C8:A1:12:02:B0:AA:B1:73:90:0A 597 | Link_Key_Status: 0x05 598 | 1 ----- 599 | Generic 600 | Service ID: 0xe1 601 | Op code: 0x47 602 | Length: 25 (0x0019) 603 | 2 -- 604 | UART 605 | Length: 32 (0x000020) 606 | Data: 0x20 0x00 0x00 0xe1 0x47 0x19 0x00 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x03 0x0a 0x90 0x73 0xb1 0xaa 0xb0 0x02 0x12 0xa1 0xc8 0x4e 0x4e 0xfd 0x0b 0xbe 0x89 0x05 607 | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- 608 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x BD-Address|1x ConnectionStatus|16x LinkKey|1x LinkKeyType|2x SniffInterval| 609 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 27 610 | 611 | // Indicates an established SPP connection 612 | ------------------------------------ 613 | 11:12:10: <-- TCU_SPP_CONNECT_EVENT: 614 | 0 ------------------- 615 | TCU_SPP_CONNECT_EVENT 616 | Status: successful (0x00) 617 | Bd_addr: 00:13:43:0B:F2:67 618 | Negotiated_Frame_Size: 7938 619 | Length_of_Device_Name: 8 620 | Device_Name: 'PAN1026B' 621 | 1 ----- 622 | Generic 623 | Service ID: 0xe5 624 | Op code: 0x43 625 | Length: 18 (0x0012) 626 | 2 -- 627 | UART 628 | Length: 25 (0x000019) 629 | Data: 0x19 0x00 0x00 0xe5 0x43 0x12 0x00 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x1f 0x02 0x08 0x50 0x41 0x4e 0x31 0x30 0x32 0x36 0x42 630 | ---------------------------------------------------------------------------------------------------------------------------------- 631 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x BD_ADDR|2x NegotiatedFrameSize|1x LengthOfDeviceName|max.248x DeviceName| 632 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013 - page 11 633 | 634 | 635 | // *************************************************** SPP Data Transfer **************************************************** 636 | // Send SPP data to remote device 637 | ---------------------------------------- 638 | 11:12:25: --> TCU_SPP_DATA_TRANSFER_REQ: 639 | 0 ----------------------- 640 | TCU_SPP_DATA_TRANSFER_REQ 641 | Length_of_Data: 12 642 | 1 ----- 643 | Generic 644 | Service ID: 0xe5 645 | Op code: 0x08 646 | Length: 14 (0x000e) 647 | 2 -- 648 | UART 649 | Length: 21 (0x000015) 650 | Data: 0x15 0x00 0x00 0xe5 0x08 0x0e 0x00 0x0c 0x00 0x50 0x41 0x4e 0x31 0x30 0x32 0x36 0x20 0x54 0x45 0x53 0x54 651 | -------------------------------------------------------------------------------------------------------------- 652 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|2x LengthOfData|max.543x Data| 653 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013 - page 15 654 | 655 | 656 | // Acknowledge the start of the previous command operation 657 | ------------------------- 658 | 11:12:25: <-- TCU_ACCEPT: 659 | 0 -------- 660 | TCU_ACCEPT 661 | Status: successful (0x00) 662 | Command ServiceID: 0xe5 663 | Command OpCode: 0x08 664 | 1 ----- 665 | Generic 666 | Service ID: 0xe1 667 | Op code: 0xf1 668 | Length: 3 (0x0003) 669 | 2 -- 670 | UART 671 | Length: 10 (0x00000a) 672 | Data: 0x0a 0x00 0x00 0xe1 0xf1 0x03 0x00 0x00 0xe5 0x08 673 | ------------------------------------------------------- 674 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x CommandServiceID|1x CommandOpCode| 675 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 67 676 | 677 | // Data transfer is completed 678 | -------------------------------------- 679 | 11:12:25: <-- TCU_SPP_DATA_SEND_EVENT: 680 | 0 ----- 681 | Generic 682 | Service ID: 0xe5 683 | Op code: 0xf1 684 | Length: 0 (0x0000) 685 | 1 -- 686 | UART 687 | Length: 7 (0x000007) 688 | Data: 0x07 0x00 0x00 0xe5 0xf1 0x00 0x00 689 | ---------------------------------------- 690 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength| 691 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013 - page 17 692 | 693 | 694 | // ************************************************ Disconnect from paired/connected device ************************************************ 695 | // Disconnect the SPP connection 696 | ------------------------------------- 697 | 11:14:59: --> TCU_SPP_DISCONNECT_REQ: 698 | 0 ----- 699 | Generic 700 | Service ID: 0xe5 701 | Op code: 0x04 702 | Length: 0 (0x0000) 703 | 1 -- 704 | UART 705 | Length: 7 (0x000007) 706 | Data: 0x07 0x00 0x00 0xe5 0x04 0x00 0x00 707 | ---------------------------------------- 708 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength| 709 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013 - page 12 710 | 711 | // Acknowledge the start of the previous command operation 712 | ------------------------- 713 | 11:14:59: <-- TCU_ACCEPT: 714 | 0 -------- 715 | TCU_ACCEPT 716 | Status: successful (0x00) 717 | Command ServiceID: 0xe5 718 | Command OpCode: 0x04 719 | 1 ----- 720 | Generic 721 | Service ID: 0xe1 722 | Op code: 0xf1 723 | Length: 3 (0x0003) 724 | 2 -- 725 | UART 726 | Length: 10 (0x00000a) 727 | Data: 0x0a 0x00 0x00 0xe1 0xf1 0x03 0x00 0x00 0xe5 0x04 728 | ------------------------------------------------------- 729 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|1x CommandServiceID|1x CommandOpCode| 730 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013.pdf - page 67 731 | 732 | // Disconnect status event 733 | ---------------------------------------------- 734 | 11:14:59: <-- TCU_MNG_CONNECTION_STATUS_EVENT: 735 | 0 ----------------------------- 736 | TCU_MNG_CONNECTION_STATUS_EVENT 737 | Status: successful (0x00) 738 | Bd_addr: 00:13:43:0B:F2:67 739 | Connection_Status: disconnected (0x01) 740 | 1 ----- 741 | Generic 742 | Service ID: 0xe1 743 | Op code: 0x47 744 | Length: 8 (0x0008) 745 | 2 -- 746 | UART 747 | Length: 15 (0x00000f) 748 | Data: 0x0f 0x00 0x00 0xe1 0x47 0x08 0x00 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x01 749 | -------------------------------------------------------------------------------- 750 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x BD-Address|1x ConnectionStatus|16x LinkKey|1x LinkKeyType|2x SniffInterval| 751 | Document: PAN1026_TC35661APL_ROM501_MNG_E_26thJuly2013 - page 27 752 | 753 | // SPP disconnection is completed 754 | --------------------------------------- 755 | 11:14:59: <-- TCU_SPP_DISCONNECT_EVENT: 756 | 0 ---------------------- 757 | TCU_SPP_DISCONNECT_EVENT 758 | Status: successful (0x00) 759 | Bd_addr: 00:13:43:0B:F2:67 760 | Reason: 0x01 761 | 1 ----- 762 | Generic 763 | Service ID: 0xe5 764 | Op code: 0x44 765 | Length: 8 (0x0008) 766 | 2 -- 767 | UART 768 | Length: 15 (0x00000f) 769 | Data: 0x0f 0x00 0x00 0xe5 0x44 0x08 0x00 0x00 0x67 0xf2 0x0b 0x43 0x13 0x00 0x01 770 | -------------------------------------------------------------------------------- 771 | |3x Length|1x ServiceID|1x OpCode|2x ParameterLength|1x Status|6x BD_ADDR|1x Reason| 772 | Document: PAN1026_TC35661APL_ROM501_SPP_E_24thJune2013 - page 13 -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0.atsln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "PAN1026_ATmega128_V1.0", "PAN1026_ATmega128_V1.0\PAN1026_ATmega128_V1.0.cproj", "{CB288DF9-5E2B-4674-A892-BA6FCC5B8EED}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|AVR = Debug|AVR 9 | Release|AVR = Release|AVR 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CB288DF9-5E2B-4674-A892-BA6FCC5B8EED}.Debug|AVR.ActiveCfg = Debug|AVR 13 | {CB288DF9-5E2B-4674-A892-BA6FCC5B8EED}.Debug|AVR.Build.0 = Debug|AVR 14 | {CB288DF9-5E2B-4674-A892-BA6FCC5B8EED}.Release|AVR.ActiveCfg = Release|AVR 15 | {CB288DF9-5E2B-4674-A892-BA6FCC5B8EED}.Release|AVR.Build.0 = Release|AVR 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0.atsuo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0.atsuo -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0/Eventhandler/eventHandler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eventHandler.c 3 | * 4 | * Author: Panasonic 5 | */ 6 | 7 | // Include header files 8 | #include 9 | #include "../USART/usart.h" 10 | #include "eventHandler.h" 11 | #include "../Statemachine/statemachine.h" 12 | #include "hci_eventHandler.h" 13 | #include "mng_eventHandler.h" 14 | #include "spp_eventHandler.h" 15 | 16 | 17 | void eventHandler (void) { 18 | 19 | unsigned char length = 0; // Holds the length of the response 20 | unsigned char i,j = 0; // Generic counting variables 21 | 22 | // Wait for the response 23 | _delay_ms(300); 24 | length = receptionCounter; // Read length of the received data 25 | receptionCounter = 0; // Reset reception counter 26 | 27 | 28 | // send debugging information to the PC terminal 29 | USART0_SendData(receptionBuffer,length); 30 | 31 | 32 | // Check, whether HCI or Complete Mode 33 | if(receptionBuffer[0] == 0x04) { // HCI Mode 34 | 35 | hci_eventHandler(length); 36 | 37 | } else { // Complete Mode 38 | 39 | // For multiple responses (4 responses): 40 | // Get the amount of bytes from the reception buffer and the data for each single response 41 | responseOneByteQuantity = receptionBuffer[0]; 42 | 43 | for (i=0; i 9 | #include 10 | #include 11 | #include "USART/usart.h" 12 | #include "Statemachine/statemachine.h" 13 | #include "EventHandler/eventHandler.h" 14 | 15 | 16 | int main(void) 17 | { 18 | // Time to activate the debug terminal 19 | _delay_ms(5000); 20 | 21 | // Initialize USART channels 22 | USART0_Init(); 23 | USART1_Init(); 24 | 25 | // Set initial state 26 | setState(Reset); 27 | 28 | // Enable global interrupts 29 | sei(); 30 | 31 | while(1){ 32 | 33 | // Handle the states 34 | statemachine(); 35 | 36 | // Handle Incoming Events 37 | eventHandler(); 38 | 39 | } 40 | } 41 | 42 | 43 | // Reception interrupt routine 44 | ISR(USART1_RX_vect){ 45 | 46 | receptionBuffer[receptionCounter] = UDR1; 47 | receptionCounter++; 48 | 49 | } 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0.cproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2.0 5 | 6.2 6 | com.Atmel.AVRGCC8.C 7 | {cb288df9-5e2b-4674-a892-ba6fcc5b8eed} 8 | ATmega128 9 | none 10 | Executable 11 | C 12 | $(MSBuildProjectName) 13 | .elf 14 | $(MSBuildProjectDirectory)\$(Configuration) 15 | PAN1026_ATmega128_V1.0 16 | PAN1026_ATmega128_V1.0 17 | PAN1026_ATmega128_V1.0 18 | Native 19 | true 20 | false 21 | true 22 | true 23 | 24 | 25 | 26 | 2 27 | 1 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | True 45 | True 46 | True 47 | True 48 | True 49 | False 50 | True 51 | True 52 | 53 | 54 | NDEBUG 55 | 56 | 57 | Optimize for size (-Os) 58 | True 59 | True 60 | True 61 | 62 | 63 | libm 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | True 74 | True 75 | True 76 | True 77 | False 78 | True 79 | True 80 | 81 | 82 | DEBUG 83 | F_CPU=8000000 84 | 85 | 86 | Optimize (-O1) 87 | True 88 | True 89 | Default (-g2) 90 | True 91 | 92 | 93 | libm 94 | 95 | 96 | Default (-Wa,-g) 97 | 98 | 99 | 100 | 101 | 102 | compile 103 | 104 | 105 | compile 106 | 107 | 108 | compile 109 | 110 | 111 | compile 112 | 113 | 114 | compile 115 | 116 | 117 | compile 118 | 119 | 120 | compile 121 | 122 | 123 | compile 124 | 125 | 126 | compile 127 | 128 | 129 | compile 130 | 131 | 132 | compile 133 | 134 | 135 | compile 136 | 137 | 138 | compile 139 | 140 | 141 | compile 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0/Statemachine/statemachine.c: -------------------------------------------------------------------------------- 1 | /* 2 | * statemachine.c 3 | * 4 | * Author: Panasonic 5 | */ 6 | 7 | // Include header files 8 | #include 9 | #include "statemachine.h" 10 | #include "../USART/usart.h" 11 | #include "../commands.h" 12 | #include "../EventHandler/hci_eventHandler.h" 13 | 14 | 15 | // Variable declaration 16 | unsigned char i = 0; // Generic counting variable 17 | unsigned char receptionCounter = 0; // Counts the received bytes/characters 18 | unsigned char responseCounter = 0; // Counts the responses 19 | unsigned char transmissionCounter = 0; // Counts the transmitted commands 20 | unsigned char responseOneByteQuantity = 0; // Holds the amount of bytes of the first response 21 | unsigned char responseTwoByteQuantity = 0; // Holds the amount of bytes of the second response 22 | unsigned char responseThreeByteQuantity = 0; // Holds the amount of bytes of the third response 23 | unsigned char responseFourByteQuantity = 0; // Holds the amount of bytes of the fourth response 24 | unsigned char receptionBuffer[140] = {0}; // Holds the received data 25 | unsigned char responseOne[35] = {0}; // Holds the data of the first response 26 | unsigned char responseTwo[35] = {0}; // Holds the data of the second response 27 | unsigned char responseThree[35] = {0}; // Holds the data of the third response 28 | unsigned char responseFour[35] = {0}; // Holds the data of the fourth response 29 | 30 | 31 | 32 | void setState(State newState) { 33 | 34 | // Set new state 35 | globalState = newState; 36 | 37 | // Reset response counter 38 | receptionCounter = 0; 39 | 40 | // Reset transmission counter 41 | transmissionCounter = 0; 42 | } 43 | 44 | void statemachine(void) 45 | { 46 | // State control 47 | switch (globalState) { 48 | case Reset: 49 | // Send reset command 50 | USART0_SendData(TCU_HCI_RESET_REQ,4); 51 | USART1_SendData(TCU_HCI_RESET_REQ,4); 52 | break; 53 | 54 | case Firmware: 55 | // Send firmware request command 56 | USARTS_SendData(TCU_HCI_GET_FIRMWARE_VERSION_REQ,13); 57 | break; 58 | 59 | case I2C: 60 | // Send enable i2c request 61 | USARTS_SendData(TCU_HCI_M2_BTL_SET_I2C_ENABLE_REQ,15); 62 | break; 63 | 64 | case EnableEEPROM: 65 | // Send enable EEPROM request 66 | USARTS_SendData(TCU_HCI_M2_BTL_EEPROM_WRITE_ENABLE_REQ,13); 67 | break; 68 | 69 | case ReadEEPROM: 70 | // Send read EEPROM request 71 | USARTS_SendData(TCU_HCI_M2_GENERAL_READ_EEPROM_REQ,20); 72 | break; 73 | 74 | case WriteBDAddress: 75 | // Assemble BD Address to TCU_HCI_WRITE_BD_ADDR_REQ 76 | for (unsigned char i=0; i<6; i++) { 77 | TCU_HCI_WRITE_BD_ADDR_REQ[4+i] = bdAddress[5-i]; 78 | } 79 | // Send write BD Address request 80 | USARTS_SendData(TCU_HCI_WRITE_BD_ADDR_REQ,10); 81 | break; 82 | 83 | case SetMode: 84 | // Send set mode request 85 | USARTS_SendData(TCU_HCI_SET_MODE_REQ,7); 86 | break; 87 | 88 | case MNGInit: 89 | // Send MNG initialisation request (Device Name: PAN1026A, Length 0x08) 90 | USARTS_SendData(TCU_MNG_INIT_REQ,18); 91 | break; 92 | 93 | case CoD: 94 | // Send Class of Device 95 | USARTS_SendData(TCU_MNG_STANDARD_HCI_SET_REQ_Write_Class_of_Device,13); 96 | break; 97 | 98 | case SPPSetup: 99 | // Send SPP setup request 100 | USARTS_SendData(TCU_SPP_SETUP_REQ,7); 101 | break; 102 | 103 | case MNGScan: 104 | // Send inquiry and page scan request 105 | USARTS_SendData(TCU_MNG_SET_SCAN_REQ,8); 106 | break; 107 | 108 | case SPPConnect: 109 | for(i=0; i<6; i++) { 110 | TCU_SPP_CONNECT_REQ[7+i] = REMOTE_BDADDRESS[i]; 111 | } 112 | // Send ACL and SPP connection request 113 | USARTS_SendData(TCU_SPP_CONNECT_REQ,23); 114 | break; 115 | 116 | case ControlSSP: 117 | // Add BD address defined in commands.h to HCI IO capability reply 118 | for(i=0; i<6; i++) { 119 | TCU_MNG_SSP_SET_REQ_HCI_IO_Capability_Request_Reply[10+i] = REMOTE_BDADDRESS[i]; 120 | } 121 | // Send secure simple pairing reply 122 | USARTS_SendData(TCU_MNG_SSP_SET_REQ_HCI_IO_Capability_Request_Reply,19); 123 | break; 124 | 125 | 126 | case ControlSSP2: 127 | // Add BD address defined in commands.h to HCI user confirmation request reply 128 | for(i=0; i<6; i++) { 129 | TCU_MNG_SSP_SET_REQ_HCI_User_Confirmation_Request_Reply[10+i] = REMOTE_BDADDRESS[i]; 130 | } 131 | // Send user confirmation request reply 132 | USARTS_SendData(TCU_MNG_SSP_SET_REQ_HCI_User_Confirmation_Request_Reply,17); 133 | break; 134 | 135 | case SPPDataTransfer: 136 | // Send user confirmation request reply 137 | USARTS_SendData(TCU_SPP_DATA_TRANSFER_REQ,21); 138 | break; 139 | 140 | } 141 | } -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0/Statemachine/statemachine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * statemachine.h 3 | * 4 | * Author: Panasonic 5 | */ 6 | 7 | 8 | #ifndef STATEMACHINE_H_ 9 | #define STATEMACHINE_H_ 10 | 11 | extern unsigned char i; 12 | extern unsigned char receptionCounter; 13 | extern unsigned char responseCounter; 14 | extern unsigned char transmissionCounter; 15 | extern unsigned char responseOneByteQuantity; 16 | extern unsigned char responseTwoByteQuantity; 17 | extern unsigned char responseThreeByteQuantity; 18 | extern unsigned char responseFourByteQuantity; 19 | extern unsigned char receptionBuffer[140]; 20 | extern unsigned char responseOne[35]; 21 | extern unsigned char responseTwo[35]; 22 | extern unsigned char responseThree[35]; 23 | extern unsigned char responseFour[35]; 24 | 25 | typedef enum {Reset, Firmware, I2C, EnableEEPROM, ReadEEPROM, WriteBDAddress, SetMode, MNGInit, CoD, SPPSetup, MNGScan, SPPConnect, ControlSSP, ControlSSP2, SPPDataTransfer} State; 26 | 27 | State globalState; 28 | 29 | void setState(State newState); 30 | void statemachine(void); 31 | 32 | #endif /* STATEMACHINE_H_ */ -------------------------------------------------------------------------------- /PAN1026_TC35661APL_ROM/PAN1026_ATmega128_V1.0/PAN1026_ATmega128_V1.0/USART/usart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * usart.c 3 | * 4 | * Author: Panasonic 5 | */ 6 | 7 | // Include header files 8 | #include 9 | #include "usart.h" 10 | #include "../Statemachine/statemachine.h" 11 | 12 | // Function declaration 13 | void USART0_Init (void) { // Controller -> PC 14 | 15 | // Set baud rate 115200 at 8.0MHz 16 | UBRR0L = 8; 17 | 18 | // Double speed USART 19 | UCSR0A = (1 << U2X0); 20 | 21 | // Enable transmission 22 | UCSR0B = (1 << TXEN0); 23 | 24 | // Asynchronous, 8N1 Mode 25 | UCSR0C = (1 << UCSZ01) | (1 << UCSZ00); 26 | } 27 | 28 | void USART1_Init (void) { // Controller <-> PAN1026 29 | 30 | // Set baud rate 9600 resp. 115200 at 8.0MHz 31 | UBRR1L = 103; // 9600 baud 32 | 33 | // Double speed USART 34 | UCSR1A = (1 << U2X1); 35 | 36 | // Enable transmission, reception and reception interrupt 37 | UCSR1B = (1 << TXEN1) | (1 << RXEN1) | (1 << RXCIE1); 38 | 39 | // Asynchronous, 8N1 Mode 40 | UCSR1C = (1 << UCSZ11) | (1 << UCSZ10); 41 | } 42 | 43 | void USART0_SendByte (unsigned char data) { 44 | // Wait for empty SendByte buffer 45 | while ( !(UCSR0A & (1 << UDRE0)) ); 46 | 47 | // Put data into buffer, sends the data 48 | UDR0 = data; 49 | } 50 | 51 | void USART1_SendByte (unsigned char data) { 52 | // Wait for empty SendByte buffer 53 | while ( !(UCSR1A & (1 << UDRE1)) ); 54 | 55 | // Put data into buffer, sends the data 56 | UDR1 = data; 57 | } 58 | 59 | void USART0_SendData (unsigned char data[], unsigned char length) { 60 | 61 | unsigned char i; 62 | 63 | for(i=0; i996.icu 2 | 3 | 4 | [![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) 5 | 6 | 7 | source project at 8 | https://github.com/yuht/TC35661-Keil 9 | 10 | 11 | 12 | 13 | //--------------------------- 14 | 2016.6.11 15 | 1.BT不需要输入密码配对 16 | 2.BLE 、BT通信方式 17 | 18 | //--------------------------- 19 | 2016.5.20 20 | 1.android方式和ios方式不同。 android使用传统蓝牙方式, ios使用BLE方式。 21 | 2.对代码进行了android和ios区分。 22 | 3.android需要配对输入PIN,需要对方和自己的蓝牙地址。 23 | 4.ios使用BLE,使用SERVICE概念。对SERVICE进行读写。 24 | 4.1 该模块代码包含2个SERVICE,一个是device service,一个是功能service。 25 | 26 | 27 | //--------------------------- 28 | 2016.5.18增加 29 | 1.该代码在android蓝牙可以使用。 30 | 1.1注释掉的初始化代码为ios所使用的service。不影响android 31 | 2.ios通信状态下,没有检测到通信指令和通信内容。没法做ios通信。 32 | 33 | //--------------------------- 34 | 35 | 36 | 37 | 1.下载 38 | 1.1 InitModule\debugcommand.exe 39 | 1.2 InitModule\初始化命令.txt 40 | 1.3 模块说明.txt 41 | 1.4 请求配对指令.txt 42 | 43 | 2.运行 44 | 2.1 初始化模块 45 | 46 | 47 | 2.1.1 启动debugcommand.exe指定COM口 48 | 49 | 2.1.2 点打开串口和文件 50 | 2.1.2.1 如果串口打开成功,选择文件“InitModule\初始化命令.txt” 51 | 2.1.2.2 如果串口提示错误,请重新核对串口。 52 | 53 | 2.1.3 都打开后,会提示“文件已经打开,等待发送。 串口xx已打开” 54 | 55 | 56 | 2.1.4 对tc35661 模块的rst引脚先连接到gnd, 再接回vcc。 57 | 58 | 2.1.5 如果模块复位,会显示“04 0E 04 04 00 00 00” 如果没有显示, 重复2.1.4 59 | 60 | 2.1.6 然后点按钮"2.发送命令" 将初始化指令逐条发送。 61 | 62 | 2.2 蓝牙配对 63 | 2.2.1 当软件内容不再滚动, 这时候,用手机就可以搜索到蓝牙模块"BA80072323" 64 | 2.2.2 手机点蓝牙模块,电脑软件窗体会提示配对指令“10 00 00 E1 55 09 00 4D 8D B2 BF 27 28 0C 02 5A” 65 | 2.2.3 打开“请求配对指令.txt”。从最下开始向上看,因为最下面是最先受到的数据,上面是最后的数据。 里面有【注意点 x】,都是需要注意的地方 66 | 2.2.4 根据“请求配对指令.txt”说描述的内容在电脑“发送单条指令左边输入”相应修改后的指令。 67 | 2.2.5 完成配对,发送,接收数据真个过程。 68 | -------------------------------------------------------------------------------- /无密码pos/初始化.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/无密码pos/初始化.txt -------------------------------------------------------------------------------- /无密码pos/无密码通信.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/无密码pos/无密码通信.xls -------------------------------------------------------------------------------- /无密码pos/通信-android.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/无密码pos/通信-android.txt -------------------------------------------------------------------------------- /无密码pos/通信-ios.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuht/TC35661-Bluetooth/e514b6a53949413f630a1be2a09f395e056dbcbc/无密码pos/通信-ios.txt --------------------------------------------------------------------------------