Compare commits

..

30 Commits

Author SHA1 Message Date
yichin ad1a5d25ac test data rate 10k 2020-05-06 20:53:31 +08:00
yichin 2424f31806 test data rate 10k 2020-05-06 20:41:06 +08:00
yichin d70b64a1f9 test data rate 2020-05-06 19:41:05 +08:00
yichin ed59a6502c test data rate 2020-05-06 19:12:08 +08:00
yichin 9b2ab7809f test data rate 2020-05-06 18:55:54 +08:00
yichin 5557f73416 test data rate 2020-05-06 18:35:31 +08:00
yichin 6ba1b1c347 test data rate 2020-05-06 18:18:19 +08:00
yichin e972859c1a pdu: 207 -> 251 2020-04-24 18:06:12 +08:00
yichin 597514a1cc attempt to config all register 2020-04-24 18:05:42 +08:00
yichin 9e278ac83a attempt to config all register 2020-04-24 17:49:30 +08:00
yichin 8df9c5d3dc attempt to config all register 2020-04-24 17:01:28 +08:00
weiting2 66e09591b4 attempt to use full function 2020-04-24 11:53:42 +08:00
weiting2 404d8d8d9d attempt to use full function neu with high DR 2020-04-23 18:13:44 +08:00
yichin 884b38b4a9 [semi stable] check sti_ch register 2020-04-23 15:35:35 +08:00
yichin 5a7604cad0 7.14k sample rate 2020-04-22 12:30:08 +08:00
yichin 06be551603 4K sample / sec 2020-04-22 11:39:09 +08:00
yichin 5d1aab1a17 2K sample / sec 2020-04-22 11:04:01 +08:00
yichin 7a88c4ea94 2K sample / sec 2020-04-22 10:38:47 +08:00
weiting2 071ee6d057 throughput test in neu2.1 2020-04-22 10:31:15 +08:00
yichin 7a3c746547 4K sample / sec 2020-04-21 18:30:47 +08:00
yichin 8e21db3440 what's wrong with the fucking connection interval 2020-04-21 17:19:19 +08:00
yichin 21be0d0286 counting data rate 2020-04-21 15:53:39 +08:00
yichin 8fdf51afea counting data rate 2020-04-21 12:41:44 +08:00
weiting2 ab98ad66a9 throughput test in neu2.1 2020-04-21 12:17:57 +08:00
yichin 14319151b3 attempt to call GATT_Notification 2020-04-21 11:55:10 +08:00
yichin 898478b485 attempt to construct clock 2020-04-21 11:12:54 +08:00
yichin 5923833fa1 check MTU update 2020-04-20 18:57:24 +08:00
yichin fd1d10b8e1 check MTU update 2020-04-20 18:07:10 +08:00
yichin b718cbfca3 throughput example 2020-04-20 12:18:38 +08:00
weiting2 a891741e98 throughput test in neu2.1 2020-04-20 11:46:47 +08:00
24 changed files with 861 additions and 3148 deletions
-29
View File
@@ -1,29 +0,0 @@
no device y=ax+b MAC a+ b+ a- b- avg
1 c6be c6be 1804ED37C6BE 2270 -7040 2259 -14129 4.15063496100114
2 8cd0 8cd0 0081F9E48CD0 2199 -4616 2162 -16396 4.67288597901671
3 c694 c694 1804ED37C694 2354 -12824 2354 -11216 4.34663132771076
4 c6c7 c6c7 1804ED37C6C7 2199 -7238 2221 -15702 4.63164432837751
5 9b97 9b97 0081F9E49B97 2227 -9846 2151 -26609 4.75015860006776
6 c6df c6df 1804ED37C6DF 2132 -3844 2054 -21545 4.89066238118665
7 c652 c652 18:04:ED:37:C6:52 2024 -7687 2086 -11283 4.88850143182858
8 c5ed c5ed 18:04:ED:37:C5:ED 2231 -1711 2353 -70845 4.45265043545859
9 9bef 9bef 0081F9E49BEF 2383 -8585 2415 -20347 4.2758539244186
10 8b50 8b50 00:81:F9:E4:8B:50 2369 -11005 2360 -11797 4.30475635707671
11 c641 c641 18:04:ED:37:C6:41 2090 4616 1997 -40665 5.07591391714942
12 E8E6 E8E6 A4:DA:32:D4:E8:E6 2306 -88454 2418 -15140 4.2686494968089
13 E73B E73B A4:DA:32:D4:E7:3B 2262 -564 2298 44746 4.35551198222141
14 EEE2 EEE2 A4:DA:32:D4:EE:E2 2057 5980 2096 -21411 4.82094019052184
15 E871 E871 A4:DA:32:D4:E8:71 2175 -4549 2220 31468 4.60684608395208
16 EFC4 EFC4 A4:DA:32:D4:EF:C4 2348 -4371 2374 -26606 4.45106768611704
17 EF85 EF85 A4:DA:32:D4:EF:85 2136 -3339 2189 -30040 4.61909624778354
18 E7DA E7DA A4:DA:32:D4:E7:DA 2081 -3015 2122 -21543 4.79766509652981
19 E6EA E6EA A4:DA:32:D4:E6:EA 2039 -262 2127 -47259 4.79384458739747
20 EEDB EEDB A4:DA:32:D4:EE:DB 2214 -1170 2351 -24636 4.44485358085645
21 E73A E73A A4:DA:32:D4:E7:3A 2210 -4855 2339 -16434 4.47776494604746
22 E6CF E6CF A4:DA:32:D4:E6:CF 2135 -5206 2193 -30885 4.73462680884304
23 E76A E76A A4:DA:32:D4:E7:6A 2076 1154 2096 -1073 4.840805202
24 F0AC F0AC A4:DA:32:D4:F0:AC 2125 -6660 2170 -439 4.667508288
25 E87C E87C A4:DA:32:D4:E8:7C 2265 6685 2230 2124 4.529796387
26 EF39 EF39 A4:DA:32:D4:EF:39 1976 6641 2035 2834 5.071840495
27 E91D E91D A4:DA:32:D4:E9:1D 2075 6344 2002 -5562 5.036438558
28 E87A E87A A4:DA:32:D4:E8:7A 2180 6651 2254 136 4.60339152
@@ -16,11 +16,11 @@
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684" name="FlashROM" parent="com.ti.ccstudio.buildDefinitions.TMS470.Default" postannouncebuildStep="" postbuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TOOLS_BLE}/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${ORG_PROJ_DIR}/../../ccs/config/ccs_compiler_defines.bcfg ${ORG_PROJ_DIR}/../../ccs/config/ccs_linker_defines.cmd" preannouncebuildStep="" prebuildStep="&quot;${TOOLS_BLE}/lib_search/lib_search.exe&quot; ${ORG_PROJ_DIR}/build_config.opt &quot;${TOOLS_BLE}/lib_search/params_split_cc2640.xml&quot; ${SRC_BLE_CORE}/../blelib &quot;${ORG_PROJ_DIR}/../../ccs/config/lib_linker.cmd&quot;">
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Default.1209999684." name="/"
resourcePath="">
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.1245523372"
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain.832046861"
name="TI Build Tools"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.DebugToolchain"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1451981696">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.905558853"
targetTool="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1662665503">
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.361513614"
superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.CC2650F128"/>
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
@@ -32,44 +32,44 @@
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE="/>
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.690267428"
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1409784186"
superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION"
value="18.1.4.LTS" valueType="string"/>
<targetPlatform
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.703901656"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug.1097216259"
name="Platform"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.targetPlatformDebug"/>
<builder buildPath="${BuildDirectory}"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.578715889"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug.988453068"
name="GNU Make.FlashROM" parallelBuildOn="true" parallelizationNumber="optimal"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.builderDebug"/>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.124004045"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug.772298983"
name="ARM Compiler"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.compilerDebug">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.1471387206"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.1310942383"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.SILICON_VERSION.7M3"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.1989883015"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.746618886"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CODE_STATE.16"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.26908680"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.1515548706"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.ABI.eabi"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.161170469"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN.607163911"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.LITTLE_ENDIAN"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.202178130"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.318297824"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_LEVEL.4"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.477462079"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.631719280"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.OPT_FOR_SPEED.0"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.2135144875"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH.1577402438"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.INCLUDE_PATH"
valueType="includePath">
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
@@ -97,7 +97,7 @@
<listOptionValue builtIn="false" value="${SRC_EX}/profiles/roles"/>
<listOptionValue builtIn="false" value="${CC26XXWARE}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.1493730349"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE.257493390"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DEFINE"
valueType="definedSymbols">
<listOptionValue builtIn="false" value="CC26XX"/>
@@ -121,67 +121,67 @@
<listOptionValue builtIn="false" value="xTESTMODES"/>
<listOptionValue builtIn="false" value="xTEST_BLEBOARD"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.1032660795"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.174341808"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.C_DIALECT.C99"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.1680463954"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS.368319864"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_SUPPRESS"
valueType="stringList">
<listOptionValue builtIn="false" value="48"/>
<listOptionValue builtIn="false" value="16004"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1766518960"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING.1796876384"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WARNING"
valueType="stringList">
<listOptionValue builtIn="false" value="225"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1804087261"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.1202072403"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DIAG_WRAP.off"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.733166450"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER.746142779"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.DISPLAY_ERROR_NUMBER"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.1033506009"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE.2057721302"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compilerID.CMD_FILE"
valueType="stringList">
<listOptionValue builtIn="false" value="${SRC_EX}/config/build_components.opt"/>
<listOptionValue builtIn="false" value="${ORG_PROJ_DIR}/build_config.opt"/>
</option>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.1352027396"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS.193620484"
name="C Sources"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__C_SRCS"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.1465774058"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS.1071304751"
name="C++ Sources"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__CPP_SRCS"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.1739768713"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS.1900538416"
name="Assembly Sources"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM_SRCS"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.79045750"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS.1395617758"
name="Assembly Sources"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.compiler.inputType__ASM2_SRCS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1451981696"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug.1662665503"
name="ARM Linker"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exe.linkerDebug">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.816733227"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE.1043297041"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.STACK_SIZE"
value="256" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.1515084002"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE.30321841"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.HEAP_SIZE"
value="0" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1765940845"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE.1098985537"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.MAP_FILE"
value="&quot;${ProjName}.map&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.272429594"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE.207849780"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.OUTPUT_FILE"
value="${ProjName}.out" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.2076163355"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY.1730405570"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.LIBRARY"
valueType="libs">
<listOptionValue builtIn="false" value="libc.a"/>
@@ -192,13 +192,13 @@
<listOptionValue builtIn="false"
value="${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.1967226591"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH.1642862213"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.SEARCH_PATH"
valueType="libPaths">
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/lib"/>
<listOptionValue builtIn="false" value="${CG_TOOL_ROOT}/include"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.17239932"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS.931842322"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_SUPPRESS"
valueType="stringList">
<listOptionValue builtIn="false" value="16002-D"/>
@@ -206,49 +206,49 @@
<listOptionValue builtIn="false" value="10325-D"/>
<listOptionValue builtIn="false" value="10229-D"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.773340389"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.628793954"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DIAG_WRAP.off"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.2126747201"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER.1795637117"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.DISPLAY_ERROR_NUMBER"
value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1785926765"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO.1568690558"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.XML_LINK_INFO"
value="&quot;${ProjName}_linkInfo.xml&quot;" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.683577056"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT.790669318"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.ENTRY_POINT"
value="startup_entry" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.1312810581"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.636942967"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.COMPRESS_DWARF.on"
valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1324674660"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.1245052655"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.linkerID.UNUSED_SECTION_ELIMINATION.on"
valueType="enumerated"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1903606010"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS.1776037702"
name="Linker Command Files"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD_SRCS"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.872286488"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS.2125995458"
name="Linker Command Files"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__CMD2_SRCS"/>
<inputType
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.1603687860"
id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS.1674943097"
name="Generated Linker Command Files"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.exeLinker.inputType__GEN_CMDS"/>
</tool>
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.1441542763"
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.1597342378"
name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.210948887"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH.1896669298"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.ROMWIDTH" value="8"
valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.514543379"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH.2112595558"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.MEMWIDTH" value="8"
valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.2135898037"
<option id="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.1916629122"
superClass="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT"
value="com.ti.ccstudio.buildDefinitions.TMS470_18.1.hex.OUTPUT_FORMAT.INTEL"
valueType="enumerated"/>
@@ -12,6 +12,7 @@
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/simple_peripheral_cc2650em_stack"/>
</listAttribute>
@@ -17,6 +17,11 @@
<property Type="choicelist" Value="1" id="XDS110 Aux Port"/>
</choice>
</property>
<property Type="choicelist" Value="1" id="Debug Probe Selection">
<choice Name="Select by serial number" value="0">
<property Type="stringfield" Value="L1000537" id="-- Enter the serial number"/>
</choice>
</property>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="CC2650F128_0" href="devices/cc2650f128.xml" id="CC2650F128_0" xml="cc2650f128.xml" xmlpath="devices"/>
</platform>
@@ -23,7 +23,7 @@ Instruction Specification
file defined:
Bio_Pro_Sci / 嚙踝蕭赤 / Pi3/DataServer / CC2650 / CC2650嚙踐垓蕭嚙踝隤嚙
Bio_Pro_Sci /  / Pi3/DataServer / CC2650 / CC2650誘銵
```
struct instruction {
@@ -56,10 +56,10 @@ instruction operator
| VIS_INT | 0x60 | interrupt device |
| | 0x70 | not used |
| | 0x80 | not used |
| VIS_STI | 0x90 | en/disable stimulation |
| VIS_FUH | 0x90 | not used |
| VIS_CAL | 0xA0 | not used |
| | 0xB0 | not used |
| VIS_START| 0xC0 | device start working |
| VIS_STI | 0xC0 | device start working |
| | 0xD0 | not used |
| | 0xE0 | not used |
| VIS_RST | 0xF0 | device reset |
@@ -93,61 +93,6 @@ instruction operator
#include <ti/sysbios/knl/Semaphore.h>
#include "simple_gatt_profile.h"
/** State for SPI (SPI callback to do task) **/
typedef enum {
CLOSE_SPI, // close SPI after MISO transmit
CONTINUOUS_TRANS, // transmit DBS data
FLUSH_BUFFER, // clean SPI buffer, used after a "write" SPI instruction (MISO)
FLUSH_BUFFER2, // clean SPI buffer twice
READ_REG, // read DBS register value, used after a "read" SPI instruction (MISO)
READ_REG2, // read DBS register value, used after a "read" SPI instruction (MISO)
END_TRANSMIT, // read DBS register value, used after a "read" SPI instruction (MISO)
ONE_SHOT_SPI, // end spi instruction
READ_MOSI
} SPI_CB_MODE;
/*========================
==== Global Variable ====
=========================*/
static bool STI = false;
static bool IsFirstData = true;
static uint8_t spi_state_counter = 0;
static bool ConnectState = false;
static bool ErrorRestart = false;
static SPI_CB_MODE SPICallBack;
/*
* Let C = command, S = status;
* StiCommand = 0b00CC_00SS
* The first C is record command, the second is sti
* The first S is record status, the second is sti
*
* rec_sti_command | meaning |
* 0x00 | command = interrupt; status = idle |
* 0x01 | command = interrupt; status = sti without rec |
* 0x02 | command = interrupt; status = rec without sti |
* 0x03 | command = interrupt; status = sti & rec |
* 0x10 | command = start rec; status = idle |
* 0x11 | command = start rec; status = sti without rec |
* 0x12 | command = start rec; status = rec without sti |
* 0x13 | command = start rec; status = sti & rec |
* 0x20 | command = start sti; status = idle |
* 0x21 | command = start sti; status = sti without rec |
* 0x22 | command = start sti; status = rec without sti |
* 0x23 | command = start sti; status = sti & rec |
* 0x30 | command = rec & sti; status = idle |
* 0x31 | command = rec & sti; status = sti without rec |
* 0x32 | command = rec & sti; status = rec without sti |
* 0x33 | command = rec & sti; status = sti & rec |
*/
#define ENABLE_REC 0x20
#define ENABLE_STI 0x10
#define STATUS_REC 0x02
#define STATUS_STI 0x01
static uint8_t rec_sti_command = 0x00; // 0=NOP; 0x01=stop; 2=start;
/*======================
==== event control ====
=====================*/
@@ -212,7 +157,6 @@ extern ICall_Semaphore semaphore;
// command return characteristic
#define BLE_CDR_BUFF_CHAR SIMPLEPROFILE_CHAR2
#define BLE_CDR_BUFF_SIZE SIMPLEPROFILE_CHAR2_LEN
#define BLE_CDR_SAMLL_SIZE 10
// instruction input characteristic
#define BLE_INS_BUFF_CHAR SIMPLEPROFILE_CHAR3
@@ -238,17 +182,12 @@ extern ICall_Semaphore semaphore;
#define INS_TYPE_CIS 0x70
// VIS operator
#define VIS_REC 0x10
#define VIS_STI 0x20
#define VIS_STOP_REC 0x30
#define VIS_STOP_STI 0x40
#define VIS_ASK 0x50
#define VIS_INT 0x60
#define VIS_FAST_SET 0x70
#define VIS_CAL 0xA0
#define VIS_START 0xC0
#define VIS_RST 0xF0
#define VIS_ASK 0x30
#define VIS_INT 0x60
#define VIS_FUH 0x90
#define VIS_CAL 0xA0
#define VIS_STI 0xC0
#define VIS_RST 0xF0
// CIS operator
#define CIS_NOP 0x00
@@ -353,7 +292,7 @@ static uint16_t CONNECT_HANDLE = 0;
/**
* command instruction buffer
*/
static uint8_t cdr_buf[BLE_CDR_SAMLL_SIZE] = {0};
static uint8_t cdr_buf[BLE_CDR_BUFF_SIZE] = {0};
/*====================
==== event table ====
@@ -431,8 +370,6 @@ static void headstage_update_instruction(uint8_t *instruction) {
uint8_t ins_oper = instruction[1] & 0xF0;
uint8_t ins_len = instruction[1] & 0x0F;
switch (ins_type) {
case INS_TYPE_RIS: {
headstage_update_ris_instruction(ins_len, instruction + 2);
@@ -18,7 +18,7 @@ static uint8_t headstage_battery_percent() {
}
static uint8_t battery_volt;
static uint8_t battery_volt = 256;
static uint8_t headstage_battery_volt1() {
uint8_t internal_battery_percent;
uint32_t internal_batt_sense = AONBatMonBatteryVoltageGet();
@@ -0,0 +1,106 @@
#ifndef HEAD_BLAST_DATA
#define HEAD_BLAST_DATA
// L2CAP Header(2) + L2CAP CID(2) + ATT Opcode(1) + ATT handle(2)
#define TOTAL_PACKET_OVERHEAD 7
static void SimpleBLEPeripheral_performPeriodicTask();
/*********************************************************************
* @fn SimpleBLEPeripheral_blastData
*
* @brief Sends ATT notifications in a tight while loop to demo
* throughput
*
* @param none
*
* @return none
*/
static void SimpleBLEPeripheral_blastData() {
// Subtract the total packet overhead of ATT and L2CAP layer from notification payload
uint16_t len = MAX_PDU_SIZE - TOTAL_PACKET_OVERHEAD;
attHandleValueNoti_t noti;
bStatus_t status;
noti.handle = 0x27;
noti.len = len;
uint32_t not_time_stamp;
// Store hte connection handle for future reference
uint16_t connectionHandle;
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connectionHandle);
// If RTOS queue is not empty, process app message.
// We need to process the app message here in the case of a keypress
while (!Queue_empty(appMsgQueue)) {
sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
if (pMsg) {
// Process message.
SimpleBLEPeripheral_processAppMsg(pMsg);
// Free the space from the message.
ICall_free(pMsg);
}
}
not_time_stamp = Timestamp_get32() / 2;
noti.pValue = (uint8 *)GATT_bm_alloc(connectionHandle, ATT_HANDLE_VALUE_NOTI, GATT_MAX_MTU, &len);
if (noti.pValue != NULL) // if allocated
{
// Place index
noti.pValue[2] = not_time_stamp & 0xFF;
noti.pValue[3] = (not_time_stamp >> 8) & 0xFF;
noti.pValue[4] = (not_time_stamp >> 16) & 0xFF;
noti.pValue[5] = (not_time_stamp >> 24) & 0xFF;
noti.pValue[6] = 100;
noti.pValue[7] = 0;
// Attempt to send the notification
status = GATT_Notification(connectionHandle, &noti, GATT_NO_AUTHENTICATION);
if (status != SUCCESS) // if noti not sent
{
// PIN_setOutputValue(hSbpPins, Board_LED1, Board_LED_ON);
GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);
} else {
// Notification is successfully sent, increment counters
// Display_print0(dispHandle, 4, 0, "success");
// PIN_setOutputValue(hSbpPins, Board_LED2, Board_LED_ON);
msg_counter++;
}
} else {
// bleNoResources was returned
asm(" NOP ");
}
// Reset debug pins
// PIN_setOutputValue(hSbpPins, Board_LED1, Board_LED_OFF);
// PIN_setOutputValue(hSbpPins, Board_LED2, Board_LED_OFF);
}
static void SimpleBLEPeripheral_performPeriodicTask(){
SimpleBLEPeripheral_blastData();
}
/*********************************************************************
* @fn SimpleBLEPeripheral_clockHandler
*
* @brief Handler function for clock timeouts.
*
* @param arg - event type
*
* @return None.
*/
static void SimpleBLEPeripheral_clockHandler(UArg arg) {
// Store the event.
events |= arg;
// Wake up the application.
Semaphore_post(sem);
}
#endif
@@ -23,29 +23,26 @@ static void CaliTable2u8(uint8_t* cali){
* - .......
*/
static void SendCaliValue(uint8_t CaliNumber){
uint8_t ch, cali_buf[BLE_CDR_BUFF_SIZE];
uint8_t ch, gain_offset;
uint8_t cdr_buf[10];
// ch = 2 * (CaliNumber % 4);
// uint8_t gain_level = CaliNumber / 4; // 0:gain, 1:offset
uint8_t channel_number = 8, index = 1;
uint8_t gain_level = 0;
ch = 2 * (CaliNumber % 4);
uint8_t gain_level = CaliNumber / 4; // 0:gain, 1:offset
if(CaliNumber < 4){
gain_level = CaliNumber;
}
cdr_buf[0] = CHIP_ID;
cali_buf[0] = CHIP_ID;
for(int i=0 ; i<channel_number ; i++){
cali_buf[index++] = (uint8_t) (CaliTable.Ch[i].Gain[gain_level] >> 8) & 0xFF;
cali_buf[index++] = (uint8_t) CaliTable.Ch[i].Gain[gain_level] & 0x00FF;
cali_buf[index++] = (uint8_t) (CaliTable.Ch[i].Offset[gain_level] >> 8) & 0xFF;
cali_buf[index++] = (uint8_t) CaliTable.Ch[i].Offset[gain_level] & 0x00FF;
}
cdr_buf[1] = (uint8_t) (CaliTable.Ch[ch].Gain[gain_level] >> 8) & 0xFF;
cdr_buf[2] = (uint8_t) CaliTable.Ch[ch].Gain[gain_level] & 0x00FF;
cdr_buf[3] = (uint8_t) (CaliTable.Ch[ch].Offset[gain_level] >> 8) & 0xFF;
cdr_buf[4] = (uint8_t) CaliTable.Ch[ch].Offset[gain_level] & 0x00FF;
cdr_buf[5] = (uint8_t) (CaliTable.Ch[ch+1].Gain[gain_level] >> 8) & 0xFF;
cdr_buf[6] = (uint8_t) CaliTable.Ch[ch+1].Gain[gain_level] & 0x00FF;
cdr_buf[7] = (uint8_t) (CaliTable.Ch[ch+1].Offset[gain_level] >> 8) & 0xFF;
cdr_buf[8] = (uint8_t) CaliTable.Ch[ch+1].Offset[gain_level] & 0x00FF;
// for(int i=1 ; i<BLE_CDR_BUFF_SIZE ; i++){
// cali_buf[i] = i;
// }
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, index, cali_buf);
cdr_buf[9] = 0; // don't care
SimpleProfile_SetParameter(BLE_CDR_BUFF_CHAR, BLE_CDR_BUFF_SIZE, cdr_buf);
}
#endif
@@ -1,243 +0,0 @@
#ifndef NEU_CALI_STI_H
#define NEU_CALI_STI_H
#include "headstage_cali_table.h"
typedef struct _StiCali{
uint16_t coefficient;
int16_t offset;
}StiCali;
struct _StiCaliStiTable{
StiCali p_ch;
StiCali n_ch;
}StiCaliTable =
#ifdef BOARD_TEST
{
.p_ch.coefficient = 10000,
.p_ch.offset = 0,
.n_ch.coefficient = 10000,
.n_ch.offset = 0
};
#elif defined(BOARD_00_81_F9_E4_8C_D0)
{
.p_ch.coefficient = 2199,
.p_ch.offset = -4615,
.n_ch.coefficient = 2162,
.n_ch.offset = -16395
};
#elif defined(BOARD_18_04_ED_37_C6_BE)
{
.p_ch.coefficient = 2270,
.p_ch.offset = -7039,
.n_ch.coefficient = 2259,
.n_ch.offset = -14128
};
#elif defined(BOARD_18_04_ED_37_C6_41)
{
.p_ch.coefficient = 2090,
.p_ch.offset = 4616,
.n_ch.coefficient = 1997,
.n_ch.offset = -40664
};
#elif defined(BOARD_18_04_ED_37_C6_DF)
{
.p_ch.coefficient = 2132,
.p_ch.offset = -3843,
.n_ch.coefficient = 2054,
.n_ch.offset = -21544
};
#elif defined(BOARD_18_04_ED_37_C6_C7)
{
.p_ch.coefficient = 2199,
.p_ch.offset = -7237,
.n_ch.coefficient = 2221,
.n_ch.offset = -15701
};
#elif defined(BOARD_00_81_F9_E4_8B_50)
{
.p_ch.coefficient = 2369,
.p_ch.offset = -11004,
.n_ch.coefficient = 2360,
.n_ch.offset = -11796
};
#elif defined(BOARD_00_81_F9_E4_9B_97)
{
.p_ch.coefficient = 2227,
.p_ch.offset = -9845,
.n_ch.coefficient = 2151,
.n_ch.offset = -26608
};
#elif defined(BOARD_18_04_ED_37_C6_52)
{
.p_ch.coefficient = 2024,
.p_ch.offset = -7686,
.n_ch.coefficient = 2086,
.n_ch.offset = -11282
};
#elif defined(BOARD_00_81_F9_E4_9B_EF)
{
.p_ch.coefficient = 2383,
.p_ch.offset = -8584,
.n_ch.coefficient = 2415,
.n_ch.offset = -20346
};
#elif defined(BOARD_A4_DA_32_D4_E9_1D)
{
.p_ch.coefficient = 2075,
.p_ch.offset = 6344,
.n_ch.coefficient = 2002,
.n_ch.offset = -5562
};
#elif defined(BOARD_A4_DA_32_D4_E8_7A)
{
.p_ch.coefficient = 2180,
.p_ch.offset = 6651,
.n_ch.coefficient = 2254,
.n_ch.offset = 136
};
#elif defined(BOARD_A4_DA_32_D4_F0_AC)
{
.p_ch.coefficient = 2125,
.p_ch.offset = -6660,
.n_ch.coefficient = 2170,
.n_ch.offset = -439
};
#elif defined(BOARD_A4_DA_32_D4_E8_7C)
{
.p_ch.coefficient = 2265,
.p_ch.offset = 6685,
.n_ch.coefficient = 2230,
.n_ch.offset = 2124
};
#elif defined(BOARD_A4_DA_32_D4_EF_39)
{
.p_ch.coefficient = 1976,
.p_ch.offset = 6641,
.n_ch.coefficient = 2035,
.n_ch.offset = 2834
};
#elif defined(BOARD_A4_DA_32_D4_E7_6A)
{
.p_ch.coefficient = 2076,
.p_ch.offset = 1154,
.n_ch.coefficient = 2096,
.n_ch.offset = -1073
};
#elif defined(BOARD_A4_DA_32_D4_E8_E6)
{
.p_ch.coefficient = 2306,
.p_ch.offset = -88454,
.n_ch.coefficient = 2418,
.n_ch.offset = -15140
};
#elif defined(BOARD_A4_DA_32_D4_E7_3B)
{
.p_ch.coefficient = 2262,
.p_ch.offset = -564,
.n_ch.coefficient = 2298,
.n_ch.offset = 44746
};
#elif defined(BOARD_A4_DA_32_D4_EE_E2)
{
.p_ch.coefficient = 2057,
.p_ch.offset = 5980,
.n_ch.coefficient = 2096,
.n_ch.offset = -21411
};
#elif defined(BOARD_A4_DA_32_D4_E8_71)
{
.p_ch.coefficient = 2175,
.p_ch.offset = -4549,
.n_ch.coefficient = 2220,
.n_ch.offset = 31468
};
#elif defined(BOARD_A4_DA_32_D4_EF_C4)
{
.p_ch.coefficient = 2348,
.p_ch.offset = -5830,
.n_ch.coefficient = 2374,
.n_ch.offset = -26403
};
#elif defined(BOARD_A4_DA_32_D4_EF_85)
{
.p_ch.coefficient = 2136,
.p_ch.offset = -3339,
.n_ch.coefficient = 2189,
.n_ch.offset = -30040
};
#elif defined(BOARD_A4_DA_32_D4_E7_DA)
{
.p_ch.coefficient = 2081,
.p_ch.offset = -3015,
.n_ch.coefficient = 2122,
.n_ch.offset = -21543
};
#elif defined(BOARD_A4_DA_32_D4_E6_EA)
{
.p_ch.coefficient = 2039,
.p_ch.offset = -262,
.n_ch.coefficient = 2127,
.n_ch.offset = -47259
};
#elif defined(BOARD_A4_DA_32_D4_EE_DB)
{
.p_ch.coefficient = 2214,
.p_ch.offset = -1170,
.n_ch.coefficient = 2351,
.n_ch.offset = -24636
};
#elif defined(BOARD_A4_DA_32_D4_E7_3A)
{
.p_ch.coefficient = 2210,
.p_ch.offset = -4855,
.n_ch.coefficient = 2339,
.n_ch.offset = -16434
};
#elif defined(BOARD_A4_DA_32_D4_E6_CF)
{
.p_ch.coefficient = 2135,
.p_ch.offset = -5206,
.n_ch.coefficient = 2193,
.n_ch.offset = -30885
};
#else
{
.p_ch.coefficient = 10000,
.p_ch.offset = 0,
.n_ch.coefficient = 10000,
.n_ch.offset = 0
};
#endif
#endif
@@ -1,7 +1,6 @@
#ifndef NEU_CHECK_INSTRUCTION
#define NEU_CHECK_INSTRUCTION
#include "headstage_instruction.h"
#include "neu/headstage_spi.h"
#include "neu/headstage_reset.h"
@@ -13,10 +12,10 @@ static uint8_t check_ins(uint16_t trans_ins){
return (trans_ins == recv_ins);
}
static void check_register(uint8_t register_to_check, uint16_t instruction_to_fit, NEU_WORK_STATE next_state){
static void check_register(uint8_t register_to_check, uint16_t instruction_to_fit, uint8_t next_state){
if(spi_state_counter < 6){
SPICallBack = CONTINUOUS_TRANS;
spi_txbuf[0] = register_to_check & 0x7F;
spi_txbuf[0] = register_to_check;
spi_txbuf[1] = register_to_check;
spi_txbuf[2] = register_to_check;
@@ -32,35 +31,17 @@ static void check_register(uint8_t register_to_check, uint16_t instruction_to_fi
else{
// resend instruction
SPI_close(headstage_spi_handle);
// DBSReset();
// start recording failed
if( (rec_sti_command & ENABLE_REC) && !(rec_sti_command & STATUS_REC) ){
NEULIVE_STATE.state = NEU_WRITE_REC_INS;
NEULIVE_STATE.config_type = NEU_WARM_UP;
INSTRUCTION.ins_opcode = BIAS_ONE;
}
// start sti failed
else if( (rec_sti_command & ENABLE_STI) && !(rec_sti_command & STATUS_STI) ){
NEULIVE_STATE.state = NEU_WRITE_STI_INS;
NEULIVE_STATE.config_type = NEU_WARM_UP;
INSTRUCTION.ins_opcode = T_ZE;
// make sure rec can restart
not_buf_offset = NOT_BUF_OFFSET_INIT;
IsFirstData = true;
}
// stop sti failed
else if( !(rec_sti_command & ENABLE_STI) && (rec_sti_command & STATUS_STI) ){
NEULIVE_STATE.state = NEU_STI_INT;
// make sure rec can restart
not_buf_offset = NOT_BUF_OFFSET_INIT;
IsFirstData = true;
}
DBSReset();
// NEULIVE_STATE.state = NEU_WRITE_INSTRUCTION;
// NEULIVE_STATE.config_type = NEU_SET_STI_CUR;
// if(STI){
// INSTRUCTION.ins_opcode = T_ZE;
// }
// else{
// INSTRUCTION.ins_opcode = BIAS_ONE;
// }
NEULIVE_STATE.state = NEU_DATA_RATE_TEST;
SPICallBack = ONE_SHOT_SPI;
ReopenSPI();
}
@@ -68,115 +49,4 @@ static void check_register(uint8_t register_to_check, uint16_t instruction_to_fi
}
}
static uint8_t check_sti_register(uint8_t address, uint16_t instruction_to_fit);
static void check_sti_t1_t5(NEU_WORK_STATE next_state){
// get sti channel
uint8_t index, sti_channel[9];
for(index=0 ; index<9 ; index++){
sti_channel[index] = 0xFF;
}
// sti_channel will be [active_ch1, active_ch2, ..., 0xFF, 0xFF]
// where active_ch is the sti channel; 0xFF is used as an EOF
index = 0;
for(int i=0 ; i<8 ; i++){
if( (1 << i) & INSTRUCTION.sti_channel ){
sti_channel[index++] = i;
}
}
uint8_t register_address[5], register_index, success; // this is t1~t5 and sti_cycle number register address
uint16_t value_to_fit;
// check every active channel alternatively
for(index = 0 ; sti_channel[index]!=0xFF ; index++){
// check t1~t5 and sti-cycle register
for(register_index = 0 ; register_index < 5 ; register_index++){
// get register address
if(register_index < 4){
register_address[register_index] = sti_channel[index] * 4 + register_index + 1;
}
else{
register_address[register_index] = (sti_channel[index] / 2) + 42; // sti_cycle address
}
// get value to fit
if(register_index == 0){
uint16_t t1 = INSTRUCTION.sti_t1[sti_channel[index]];
uint16_t t21 = (INSTRUCTION.sti_t2[sti_channel[index]] & 0x003F) << 10;
value_to_fit = (t21) | (t1);
}
else if(register_index == 1){
uint16_t t22 = (INSTRUCTION.sti_t2[sti_channel[index]] >> 6) & 0x000F;
uint16_t t3 = INSTRUCTION.sti_t3[sti_channel[index]] << 4;
uint16_t t41 = (INSTRUCTION.sti_t4[sti_channel[index]] & 0x03) << 14;
value_to_fit = t41 | t3 | t22;
}
else if(register_index == 2){
uint16_t t42 = (INSTRUCTION.sti_t4[sti_channel[index]] >> 2) & 0xFFFF;
value_to_fit = t42;
}
else if(register_index == 3){
uint16_t t5 = (INSTRUCTION.sti_t5[sti_channel[index]]) & 0x03FF;
value_to_fit = t5;
}
else{
uint8_t odd_even = sti_channel[index] % 2;
if (!odd_even){
value_to_fit = (INSTRUCTION.current_sti_cycle[sti_channel[index] + 1] << 8) | (INSTRUCTION.current_sti_cycle[sti_channel[index]]);
}
else{
value_to_fit = (INSTRUCTION.current_sti_cycle[sti_channel[index]] << 8) | (INSTRUCTION.current_sti_cycle[sti_channel[index] - 1]);
}
}
success = check_sti_register(register_address[register_index], value_to_fit);
if(!success){
break;
}
}
if(!success){
break;
}
}
if(!success){
SPI_close(headstage_spi_handle);
NEULIVE_STATE.state = NEU_WRITE_STI_INS;
NEULIVE_STATE.config_type = NEU_WARM_UP;
INSTRUCTION.ins_opcode = T_ZE;
// make sure rec can restart
not_buf_offset = NOT_BUF_OFFSET_INIT;
IsFirstData = true;
ReopenSPI();
}
else{
NEULIVE_STATE.state = next_state;
}
SPICallBack = ONE_SHOT_SPI;
headstage_spi_transaction(3);
}
static uint8_t check_sti_register(uint8_t address, uint16_t instruction_to_fit){
spi_state_counter = 0;
while(spi_state_counter < 6){
SPICallBack = READ_REG;
spi_txbuf[0] = address & 0x7F;
spi_txbuf[1] = address;
spi_txbuf[2] = address;
headstage_spi_transaction(3); // spi_state_counter++ would be executed in SPI callback
}
spi_state_counter = 0;
// success = 1; failed = 0
return check_ins(instruction_to_fit);
}
#endif
@@ -44,11 +44,11 @@ struct HEADSTAGE_PARAMETER_TABLE {
* -----------
*/
/**< these parameter define the bias voltage of amplifier. */
uint16_t vgrp;
uint16_t vgrn;
uint16_t vgr_int_old;
uint16_t vgr_intp;
uint16_t vgr_intn;
uint8_t vgrp;
uint8_t vgrn;
uint8_t vgr_int_old;
uint8_t vgr_intp;
uint8_t vgr_intn;
uint8_t ins_opcode; /**< check instruction opcode which is transmitted to DBS. */
@@ -62,9 +62,6 @@ struct HEADSTAGE_PARAMETER_TABLE {
uint16_t sti_amplitude_h; /**< positive side amplitude. */
uint16_t sti_amplitude_l; /**< negative side amplitude. */
uint16_t sti_amplitude_h_cali;
uint16_t sti_amplitude_l_cali;
uint16_t sys_clk_ratio; /**< frequency divider ratio for digital core clock. */
uint16_t adc_clock_ratio; /**< frequency divider ratio for adc clock. */
uint16_t sti_clock_ratio; /**< frequency divider ratio for stimulation clock. */
@@ -84,11 +81,16 @@ struct HEADSTAGE_PARAMETER_TABLE {
* manage which operation to be conducted
*/
struct HEADSTAGE_STATE {
NEU_WORK_STATE state;
uint8_t state;
NEU_CONFIG_TYPE config_type;
uint8_t config_type;
uint8_t index;
} NEULIVE_STATE={NEU_IDLE, NEU_WARM_UP, 0};
} NEULIVE_STATE = {0};
static bool STI = false;
static uint8_t spi_state_counter = 0;
static bool ConnectState = false;
static bool IsFirstData = true;
#endif
@@ -115,7 +115,7 @@ static uint8_t headstage_led_set_color(uint16_t *ins_buf, uint8_t repeat, uint8_
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x0F, .green = 0x7F, .blue = 0x1F};
break;
case COLOR_PURPLE:
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x7F, .green = 0x0F, .blue = 0x7F};
parameter = (LEDParameter){.luminance = 0xE1, .red = 0x98, .green = 0x33, .blue = 0xFA};
break;
default:
case COLOR_BLACK:
@@ -228,29 +228,4 @@ static void headstage_led_spi_color(uint8_t color) {
#endif // HEADSTAGE_LED_USE_GPIO
static void headstage_led_control(){
if( (rec_sti_command & STATUS_REC) && (rec_sti_command & STATUS_STI) ){
headstage_led_color(COLOR_MAGENTA);
}
else if((rec_sti_command & STATUS_REC)){
headstage_led_color(COLOR_BLUE);
}
else if((rec_sti_command & STATUS_STI)){
headstage_led_color(COLOR_ORANGE);
}
else{
if(ErrorRestart){
headstage_led_color(COLOR_RED);
}
else if(ConnectState){
headstage_led_color(COLOR_CYAN);
}
else{
headstage_led_color(COLOR_GREEN); // color green
}
}
}
#endif // HEADSTAGE_LED_H
@@ -1,103 +0,0 @@
#ifndef NEU_REC_INS_H
#define NEU_REC_INS_H
#include "headstage_instruction.h"
/**
* @fn build amplifier bias
*/
static bool build_amp_bias(uint32_t* value) {
uint8_t ins_opcode = INSTRUCTION.ins_opcode;
switch (ins_opcode) {
case BIAS_ONE: {
*value = (0x01 << 23) | (0x39 << 16) | NEU_LNA_BIAS_ONE;
INSTRUCTION.ins_opcode = BIAS_TWO;
return false;
}
case BIAS_TWO: {
*value = (0x01 << 23) | (0x3A << 16) | NEU_LNA_BIAS_TWO;
INSTRUCTION.ins_opcode = BIAS_TWO;
return true;
}
default: {
return false;
}
}
}
static NEU_CONFIG_TYPE build_rec_ins(NEU_CONFIG_TYPE config_type, uint32_t* value) {
bool done;
switch (config_type) {
/* These are recording parameter */
case NEU_WARM_UP:{
*value = (0x00 << 23) | (0x01 << 16) | 1;
return NEU_WARM_UP2;
}
case NEU_WARM_UP2:{
*value = (0x00 << 23) | (0x01 << 16) | 2;
return NEU_WARM_UP3;
}
case NEU_WARM_UP3:{
*value = (0x00 << 23) | (0x01 << 16) | 3;
return NEU_SET_GENERAL_EN;
}
case NEU_SET_GENERAL_EN: {
*value = (0x01 << 23) | (0x2F << 16) | NEU_GENERAL_EN;
return NEU_SET_REC_CHANNEL;
}
case NEU_SET_REC_CHANNEL: {
*value = (0x01 << 23) | (0x30 << 16) | INSTRUCTION.recording_channel;
return NEU_SET_AMP_GAIN;
}
case NEU_SET_AMP_GAIN: {
*value = (0x01 << 23) | (0x31 << 16) | INSTRUCTION.amplifier_gain;
return NEU_SET_VGRP;
}
case NEU_SET_VGRP:{
*value = (0x01 << 23) | (0x39 << 16) | (INSTRUCTION.vgrp << 5) | INSTRUCTION.vgrn;
return NEU_SET_VGRP_OLD;
}
case NEU_SET_VGRP_OLD:{
*value = (0x01 << 23) | (0x3A << 16) | (INSTRUCTION.vgr_int_old << 10) | (INSTRUCTION.vgr_intp << 5) | INSTRUCTION.vgr_intn;
return NEU_SETUP_DONE;
}
// case NEU_SET_SYS_CLK: {
// *value = (0x01 << 23) | (0x32 << 16) | INSTRUCTION.sys_clk_ratio;
// return NEU_SET_ADC_CLK;
// }
case NEU_SET_ADC_CLK: {
if(INSTRUCTION.adc_clock_ratio < 28){
INSTRUCTION.adc_clock_ratio = 28;
}
*value = (0x01 << 23) | (0x33 << 16) | INSTRUCTION.adc_clock_ratio;
// *value = (0x01 << 23) | (0x33 << 16) | 0x00C8;
return NEU_SET_AMP_BIAS;
}
case NEU_SET_AMP_BIAS: {
done = build_amp_bias(value);
if (done){
return NEU_SETUP_DONE;
}
else{
return NEU_SET_AMP_BIAS;
}
}
// case NEU_SET_CHOPPER: {
// *value = (0x01 << 23) | (0x3B << 16) | INSTRUCTION.chopper_ratio;
// return NEU_SETUP_DONE;
// }
default: {
return NEU_WARM_UP;
}
}
}
#endif
@@ -1,30 +0,0 @@
#ifndef STI_CALI_H
#define STI_CALI_H
#include "headstage_cali_sti.h"
static uint16_t UserCode2StiCode(uint16_t amp, uint8_t positive_ch){
// get real current value (uA)
uint32_t sti_code, real_amp = amp * 5;
if(StiCaliTable.p_ch.coefficient == 10000 && StiCaliTable.p_ch.offset == 0){
return amp;
}
if(StiCaliTable.n_ch.coefficient == 10000 && StiCaliTable.n_ch.offset == 0){
return amp;
}
// trans into sti code
if(positive_ch){
sti_code = StiCaliTable.p_ch.coefficient * real_amp + StiCaliTable.p_ch.offset;
}
else{
sti_code = StiCaliTable.n_ch.coefficient * real_amp + StiCaliTable.n_ch.offset;
}
sti_code = sti_code / 10000;
return (uint16_t) (sti_code);
}
#endif
@@ -1,213 +0,0 @@
#ifndef NEU_STI_INS_H
#define NEU_STI_INS_H
#include "headstage_sti_cali.h"
#include "headstage_instruction.h"
/**
* @fn get_sti_channel
*/
#define ALL_STI_CH_CONFIG_DONE 0xFF
static uint8_t get_sti_channel(uint8_t sti_channel, uint8_t ch_number_config_done) {
uint8_t sti_ch;
uint8_t total_sti_ch_number = BitCount(sti_channel);
if(ch_number_config_done == total_sti_ch_number){ return ALL_STI_CH_CONFIG_DONE; }
for (uint8_t i = 0; i < NEU_STI_CHANNEL_COUNTS-1 ; i++) {
if ( (1 << i) & sti_channel) {
if(ch_number_config_done > 0){
ch_number_config_done --;
}
else{
sti_ch = i;
return sti_ch;
}
}
}
return 9;
}
/**
* @fn build sti instruction with channel information
*/
static bool build_sti_cur_instruction(uint8_t sti_channel, uint32_t* value) {
uint8_t ins_opcode = INSTRUCTION.ins_opcode;
uint8_t op_neu; /** this is the final opcode to write register table in DBS */
switch (ins_opcode) {
case T_ZE:{
// sending garbage SPI (want to warm up SPI)
op_neu = 1;
*value = (0x00 << 23) | (op_neu << 16) | 1;
INSTRUCTION.ins_opcode = T_ST;
return false;
}
case T_ST: {
op_neu = sti_channel * 4 + 1;
uint16_t t1 = INSTRUCTION.sti_t1[sti_channel];
uint16_t t21 = (INSTRUCTION.sti_t2[sti_channel] & 0x003F) << 10;
*value = (0x01 << 23) | (op_neu << 16) | (t21) | (t1);
INSTRUCTION.ins_opcode = T_ND;
return false;
}
case T_ND: {
op_neu = sti_channel * 4 + 2;
uint16_t t22 = (INSTRUCTION.sti_t2[sti_channel] >> 6) & 0x000F;
uint16_t t3 = INSTRUCTION.sti_t3[sti_channel] << 4;
uint16_t t41 = (INSTRUCTION.sti_t4[sti_channel] & 0x03) << 14;
*value = (0x01 << 23) | (op_neu << 16) | t41 | t3 | t22;
INSTRUCTION.ins_opcode = T_RD;
return false;
}
case T_RD: {
op_neu = sti_channel * 4 + 3;
uint16_t t42 = (INSTRUCTION.sti_t4[sti_channel] >> 2) & 0xFFFF;
*value = (0x01 << 23) | (op_neu << 16) | t42;
INSTRUCTION.ins_opcode = T_FT;
return false;
}
case T_FT: {
op_neu = sti_channel * 4 + 4;
uint16_t t5 = (INSTRUCTION.sti_t5[sti_channel]) & 0x03FF;
*value = (0x01 << 23) | (op_neu << 16) | t5;
INSTRUCTION.ins_opcode = STI_CYCLE;
return false;
}
case STI_CYCLE: {
op_neu = (sti_channel / 2) + 42;
uint8_t odd_even = sti_channel % 2;
INSTRUCTION.ins_opcode = T_ZE;
// if (NEULIVE_STATE.config_type == NEU_SET_STI_VOLT) INSTRUCTION.ins_opcode = HIGH_SIDE;
if(sti_channel == 8){
// voltage stimulate
op_neu = 41;
*value = (0x01 << 23) | (op_neu << 16) | (0x00 << 8) | (INSTRUCTION.current_sti_cycle[sti_channel]);
return true;
}
if (!odd_even){
*value = (0x01 << 23) | (op_neu << 16) | (INSTRUCTION.current_sti_cycle[sti_channel + 1] << 8) | (INSTRUCTION.current_sti_cycle[sti_channel]);
}
else{
*value = (0x01 << 23) | (op_neu << 16) | (INSTRUCTION.current_sti_cycle[sti_channel] << 8) | (INSTRUCTION.current_sti_cycle[sti_channel - 1]);
}
return true;
}
default: {
INSTRUCTION.ins_opcode = T_ZE;
return false;
}
}
}
/**
* @fn build stimulation voltage
*/
static bool build_sti_amplitude(uint32_t* value) {
uint8_t ins_opcode = INSTRUCTION.ins_opcode;
switch (ins_opcode) {
case HIGH_SIDE: {
*value = (0x01 << 23) | (0x25 << 16) | INSTRUCTION.sti_amplitude_h_cali;
INSTRUCTION.ins_opcode = LOW_SIDE;
return false;
}
case LOW_SIDE: {
*value = (0x01 << 23) | (0x26 << 16) | INSTRUCTION.sti_amplitude_l_cali;
// INSTRUCTION.ins_opcode = VOLT_MODE_AMP;
INSTRUCTION.ins_opcode = BIAS_ONE;
// return false;
return true;
}
case VOLT_MODE_AMP: {
*value = (0x01 << 23) | (0x27 << 16) | INSTRUCTION.voltage_sti_amplitude;
INSTRUCTION.ins_opcode = BIAS_ONE;
return true;
}
default: {
return false;
}
}
}
static NEU_CONFIG_TYPE build_sti_ins(NEU_CONFIG_TYPE config_type, uint32_t* value){
bool single_ch_config_done;
bool done;
switch (config_type) {
/* These are recording parameter */
case NEU_WARM_UP:{
*value = (0x00 << 23) | (0x01 << 16) | 1;
return NEU_WARM_UP2;
}
case NEU_WARM_UP2:{
*value = (0x00 << 23) | (0x01 << 16) | 2;
return NEU_WARM_UP3;
}
case NEU_WARM_UP3:{
*value = (0x00 << 23) | (0x01 << 16) | 3;
return NEU_SET_STI_CUR;
}
// set stimulate t1~t5
case NEU_SET_STI_CUR: {
uint8_t sti_channel = get_sti_channel(INSTRUCTION.sti_channel, INSTRUCTION.sti_ch_config_done);
// go to config sti amplitude
if (sti_channel == ALL_STI_CH_CONFIG_DONE) {
INSTRUCTION.sti_ch_config_done = 0;
INSTRUCTION.ins_opcode = HIGH_SIDE;
// get correct amplitude sti code
INSTRUCTION.sti_amplitude_h_cali = UserCode2StiCode(INSTRUCTION.sti_amplitude_h, POSITIVE_CHANNEL);
INSTRUCTION.sti_amplitude_l_cali = UserCode2StiCode(INSTRUCTION.sti_amplitude_l, NEGATIVE_CHANNEL);
return NEU_SET_STI_VOLT;
}
// config next sti channel
else {
single_ch_config_done = build_sti_cur_instruction(sti_channel, value);
if(single_ch_config_done){ INSTRUCTION.sti_ch_config_done++; }
return NEU_SET_STI_CUR;
}
}
// config sti amplitude
case NEU_SET_STI_VOLT: {
done = build_sti_amplitude(value);
if (done) {
return NEU_SET_POLARITY;
} else {
return NEU_SET_STI_VOLT;
}
}
case NEU_SET_POLARITY: {
*value = (0x01 << 23) | (0x28 << 16) | INSTRUCTION.current_sti_polarity;
return NEU_SET_STI_CLK;
}
case NEU_SET_STI_CLK: {
*value = (0x01 << 23) | (0x34 << 16) | INSTRUCTION.sti_clock_ratio;
*value = (0x01 << 23) | (0x34 << 16) | 2;
return NEU_SET_STI_MODE;
}
// case NEU_SET_ARBITRARY: {
// *value = (0x01 << 23) | (0x36 << 16) | INSTRUCTION.arbitrary_en;
// return NEU_SET_ARB_INDEX;
// }
// case NEU_SET_ARB_INDEX: {
// *value = (0x01 << 23) | (0x37 << 16) | INSTRUCTION.arbitrary_index;
// return NEU_SET_STI_MODE;
// }
case NEU_SET_STI_MODE: {
*value = (0x01 << 23) | (0x38 << 16) | (INSTRUCTION.sti_mode << 2) | (INSTRUCTION.sti_h_bridge << 1) | (INSTRUCTION.sti_ref);
return NEU_SETUP_DONE;
}
default: {
return NEU_WARM_UP;
}
}
}
#endif
@@ -3,42 +3,14 @@
#define VERSION_DATE
#define VERSION_DATE_YEAR 20
#define VERSION_DATE_MONTH 7
#define VERSION_DATE_DAY 3
#define VERSION_DATE_HOUR 16
#define VERSION_DATE_MINUTE 3
#define VERSION_DATE_MONTH 4
#define VERSION_DATE_DAY 24
#define VERSION_DATE_HOUR 11
#define VERSION_DATE_MINUTE 53
// this is NOT the version hash !!
// it's the last version hash
#define VERSION_HASH b10ee4de657a39fc4d8179822d4bf0f2231b3b73
#define VERSION_GIT_BRANCH Neulive2.0_developement
static void get_board_name(char *board_name_ch, uint8 *board_name_int, uint8 name_size){
uint8 name_offset = 18;
for(int i=0, k=0; i<name_size+1 ; i++){
if('0' <= board_name_ch[name_offset + i] && board_name_ch[name_offset + i] <= '9'){
board_name_int[k++] = board_name_ch[name_offset + i] - '0';
}
else if('A' <= board_name_ch[name_offset + i] && board_name_ch[name_offset + i] <= 'F'){
board_name_int[k++] = board_name_ch[name_offset + i] - 'A' + 10;
}
else if(board_name_ch[name_offset + i] == '_'){
continue;
}
else{
// error occur
for(int j=0 ; j<name_size/2 ; j++){
board_name_int[j] = 0xFF;
}
return;
}
}
for(int i=0 ; i<name_size/2 ; i++){
board_name_int[i] = (board_name_int[2*i] << 4) | (board_name_int[2*i + 1]);
}
}
#define VERSION_HASH 404d8d8d9d0b04eb9ed6fcc656ba52180d13d8c8
#define VERSION_GIT_BRANCH neulive20_blastData
#endif
@@ -12,14 +12,21 @@
static uint8_t not_buf_offset = NOT_BUF_OFFSET_INIT;
static uint32_t not_time_stamp = 0;
static uint32_t data_counter = 0;
static void headstage_notify_set_timestamp() {
not_time_stamp = headstage_time_stamp_us();
headstage_notify_buffer[2] = not_time_stamp & 0xFF;
headstage_notify_buffer[3] = (not_time_stamp >> 8) & 0xFF;
headstage_notify_buffer[4] = (not_time_stamp >> 16) & 0xFF;
headstage_notify_buffer[5] = (not_time_stamp >> 24) & 0xFF;
// headstage_notify_buffer[2] = not_time_stamp & 0xFF;
// headstage_notify_buffer[3] = (not_time_stamp >> 8) & 0xFF;
// headstage_notify_buffer[4] = (not_time_stamp >> 16) & 0xFF;
// headstage_notify_buffer[5] = (not_time_stamp >> 24) & 0xFF;
headstage_notify_buffer[5] = data_counter & 0xFF;
headstage_notify_buffer[4] = (data_counter >> 8) & 0xFF;
headstage_notify_buffer[3] = (data_counter >> 16) & 0xFF;
headstage_notify_buffer[2] = (data_counter >> 24) & 0xFF;
data_counter ++;
}
static void headstage_notify_flip_buffer() {
@@ -12,9 +12,8 @@ static void MCUReset(){
ResetINSTRUCTION();
// global variable reset
STI = false;
rec_sti_command = 0;
IsFirstData = true;
STI = false;
// SPI reset
SPI_close(headstage_spi_handle);
@@ -31,7 +30,7 @@ static void MCUReset(){
}
// CIS buffer reset
for(int i=0 ; i<BLE_CDR_SAMLL_SIZE ; i++){
for(int i=0 ; i<BLE_CDR_BUFF_SIZE ; i++){
cdr_buf[i] = 0;
}
@@ -43,10 +42,7 @@ static void MCUReset(){
not_time_stamp = 0;
if(ErrorRestart){
headstage_led_color(COLOR_RED);
}
else if(ConnectState){
if(ConnectState){
headstage_led_color(COLOR_CYAN);
}
else{
@@ -82,34 +78,32 @@ static void ResetINSTRUCTION(){
INSTRUCTION.sti_clock_ratio = 10;
INSTRUCTION.amplifier_gain = 0;
INSTRUCTION.chopper_ratio = 2;
INSTRUCTION.sti_t1[1] = 0;
INSTRUCTION.sti_t1[1] = 1;
INSTRUCTION.sti_t2[1] = 0;
INSTRUCTION.sti_t3[1] = 0;
INSTRUCTION.sti_t4[1] = 0;
INSTRUCTION.sti_t5[1] = 0;
INSTRUCTION.sti_channel = 0;
INSTRUCTION.sti_channel = 2;
INSTRUCTION.arbitrary_en = 0;
INSTRUCTION.arbitrary_index = 0;
INSTRUCTION.sti_h_bridge = 0;
INSTRUCTION.sti_mode = 0;
INSTRUCTION.sti_ref = 0;
INSTRUCTION.current_sti_polarity = 0;
INSTRUCTION.current_sti_polarity = 2;
INSTRUCTION.sti_amplitude_h = 0;
INSTRUCTION.sti_amplitude_l = 0;
INSTRUCTION.sti_amplitude_h_cali = 0;
INSTRUCTION.sti_amplitude_l_cali = 0;
INSTRUCTION.ins_opcode = BIAS_ONE;
INSTRUCTION.sti_ch_config_done = 0;
// uint8_t voltage_sti_channel = 0;
// uint8_t voltage_sti_amplitude = 0;
uint8_t voltage_sti_channel = 0;
uint8_t voltage_sti_amplitude = 0;
for(int i=0 ; i<NEU_STI_CHANNEL_COUNTS ; i++){
INSTRUCTION.current_sti_cycle[i] = 0;
}
NEULIVE_STATE.state = NEU_IDLE;
NEULIVE_STATE.config_type = NEU_WARM_UP;
NEULIVE_STATE.config_type = 0;
NEULIVE_STATE.index = 0;
}
@@ -22,6 +22,7 @@ static SPI_Handle headstage_spi_handle = NULL;
static SPI_Transaction headstage_spi_transaction;
static void headstage_spi_callback(SPI_Handle handle, SPI_Transaction* transaction);
static bool OpenSPI = false;
// SPI parameters initialize
#define headstage_spi_open() \
@@ -114,28 +114,29 @@
#ifndef FEATURE_OAD
// Minimum connection interval (units of 1.25ms, 80=100ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 8
//#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 14
//#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 6
// Maximum connection interval (units of 1.25ms, 800=1000ms) if automatic
// parameter update request is enabled
//#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 6
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 30
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 320
#else //! FEATURE_OAD
// Minimum connection interval (units of 1.25ms, 8=10ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
//#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 14
//#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 80
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL 8
// Maximum connection interval (units of 1.25ms, 8=10ms) if automatic
// parameter update request is enabled
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 80
//#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 25
//#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 80
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL 16
#endif // FEATURE_OAD
#define SBP_PERIODIC_EVT_PERIOD DEFAULT_DESIRED_MIN_CONN_INTERVAL + 2
//#define SBP_PERIODIC_EVT_PERIOD DEFAULT_DESIRED_MIN_CONN_INTERVAL*1.25 + 2
#define SBP_PERIODIC_EVT_PERIOD 8
// Slave latency to use if automatic parameter update request is enabled
#define DEFAULT_DESIRED_SLAVE_LATENCY 0
@@ -188,12 +189,16 @@ typedef struct {
* LOCAL VARIABLES
*/
// Entity ID globally used to check for source and/or destination of messages
static ICall_EntityID self;
// Semaphore globally used to post events to the application thread
ICall_Semaphore semaphore;
// Clock instances for internal periodic events.
static Clock_Struct periodicClock;
// Queue object used for app messages
static Queue_Struct application_message;
static Queue_Handle application_message_queue;
@@ -204,6 +209,9 @@ static Queue_Struct oad_queue;
static Queue_Handle oad_queue_handle;
#endif // FEATURE_OAD
// events flag for internal application events.
static uint16_t events;
// Task configuration
Task_Struct sbpTask;
Char sbpTaskStack[SBP_TASK_STACK_SIZE];
@@ -230,6 +238,10 @@ static void SimpleBLEPeripheral_freeAttRsp(uint8_t status);
static void SimpleBLEPeripheral_stateChangeCB(gaprole_States_t newState);
static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state);
static void SimpleBLEPeripheral_performPeriodicTask(void);
static void SimpleBLEPeripheral_clockHandler(UArg arg);
#ifndef FEATURE_OAD_ONCHIP
static void SimpleBLEPeripheral_charValueChangeCB(uint8_t paramID);
#endif //! FEATURE_OAD_ONCHIP
@@ -324,6 +336,9 @@ static void SimpleBLEPeripheral_init(void) {
// Create an RTOS queue for message from profile to be sent to app.
application_message_queue = Util_constructQueue(&application_message);
// Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT);
// Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, 100, 0, false, SBP_PERIODIC_EVT);
// Setup the GAP
GAP_SetParamValue(TGAP_CONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL);
@@ -416,9 +431,9 @@ static void SimpleBLEPeripheral_init(void) {
// Register for GATT local events and ATT Responses pending for transmission
GATT_RegisterForMsgs(self);
// HCI_LE_ReadMaxDataLenCmd();
HCI_LE_WriteSuggestedDefaultDataLenCmd(251, 2120); // this is used for data length extension
//
// HCI_LE_WriteSuggestedDefaultDataLenCmd(251, 2120); // this is used for data length extension
HCI_LE_ReadMaxDataLenCmd();
}
@@ -615,7 +630,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
// if (events & SBP_PERIODIC_EVT) {
// events &= ~SBP_PERIODIC_EVT;
//
// // Util_startClock(&periodicClock);
// Util_startClock(&periodicClock);
//
// // Perform periodic application task
// SimpleBLEPeripheral_performPeriodicTask();
@@ -699,6 +714,7 @@ static uint8_t SimpleBLEPeripheral_processGATTMsg(gattMsgEvent_t *message) {
} else if (message->method == ATT_MTU_UPDATED_EVENT) {
// MTU size updated
} else if (message->method == ATT_HANDLE_VALUE_CFM) {
// quick pass
}
@@ -785,6 +801,7 @@ static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *message) {
break;
case SBP_CHAR_CHANGE_EVT:
// Util_startClock(&periodicClock);
headstage_characteristic_updated(message->hdr.state);
break;
}
@@ -853,7 +870,7 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
if (SUCCESS == HCI_LE_SetDataLenCmd(cxnHandle, requestedPDUSize, requestTxTime)) {
ConnectState = true;
headstage_led_color(COLOR_CYAN);
// headstage_led_color(COLOR_CYAN);
}
// Use numActive to determine the connection handle of the last
// connection
@@ -869,22 +886,16 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)
// Device is started but not advertising, is in waiting period before advertising again
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
ConnectState = false;
if(ErrorRestart){
headstage_led_color(COLOR_RED);
}
else{
headstage_led_color(COLOR_GREEN);
}
headstage_led_color(COLOR_GREEN);
break;
case GAPROLE_WAITING_AFTER_TIMEOUT:
// Device just timed out from a connection but is not yet advertising, is in waiting period before advertising again
// disconnected
SimpleBLEPeripheral_freeAttRsp(bleNotConnected);
ErrorRestart = true;
headstage_led_color(COLOR_RED);
CONNECT_HANDLE = 0xFFFF;
flag_notify(EVT_DISCONNECTED);
headstage_led_color(COLOR_RED);
break;
case GAPROLE_ERROR: // Error occurred - invalid state
headstage_led_color(COLOR_RED);
@@ -969,3 +980,25 @@ static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state) {
Util_enqueueMsg(application_message_queue, semaphore, (uint8 *)message);
}
}
static void SimpleBLEPeripheral_performPeriodicTask(){
SimpleBLEPeripheral_blastData();
}
/*********************************************************************
* @fn SimpleBLEPeripheral_clockHandler
*
* @brief Handler function for clock timeouts.
*
* @param arg - event type
*
* @return None.
*/
static void SimpleBLEPeripheral_clockHandler(UArg arg) {
// Store the event.
events |= arg;
// Wake up the application.
Semaphore_post(semaphore);
}
@@ -82,7 +82,7 @@ extern "C" {
// Length of Characteristic 5 in bytes
#define SIMPLEPROFILE_CHAR1_LEN 2
#define SIMPLEPROFILE_CHAR2_LEN 50
#define SIMPLEPROFILE_CHAR2_LEN 10
#define SIMPLEPROFILE_CHAR3_LEN 20
#define SIMPLEPROFILE_CHAR4_LEN 200
//#define SIMPLEPROFILE_CHAR4_LEN 20
-68
View File
@@ -1,68 +0,0 @@
#!/bin/bash
folder=$(basename "$(pwd)")
if [ "$folder" == "bioprocc2650" ]; then
input="./Neulive_sti_cali.txt"
output="./simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage_cali_sti.h"
#variable
declare -i current_line=96
declare -i col_index=0
declare -i row_index=0
#constant
declare -i COL_MAX=8
declare -i START_ROW=27
declare -i UN_USED_ROW=$START_ROW-1
MAC="MAC"
while read -r line; do
for word in $line; do
# get device MAC
if [ $row_index -gt $UN_USED_ROW ] && [ $col_index -eq 3 ];then
MAC=$word
sed -i "${current_line} i \\\n#elif defined(BOARD_${MAC})\\n{" "$output"
sed -i 's/:/_/g' "$output"
current_line=$current_line+3
fi
# get device positive channel coeff and offset
if [ $row_index -gt $UN_USED_ROW ] && [ $col_index -eq 4 ];then
sed -i "${current_line} i \ .p_ch.coefficient = $word," "$output"
current_line=$current_line+1
fi
if [ $row_index -gt $UN_USED_ROW ] && [ $col_index -eq 5 ];then
sed -i "${current_line} i \ .p_ch.offset = $word," "$output"
current_line=$current_line+1
fi
# get device negative channel coeff and offset
if [ $row_index -gt $UN_USED_ROW ] && [ $col_index -eq 6 ];then
sed -i "${current_line} i \ .n_ch.coefficient = $word," "$output"
current_line=$current_line+1
fi
if [ $row_index -gt $UN_USED_ROW ] && [ $col_index -eq 7 ];then
sed -i "${current_line} i \ .n_ch.offset = $word" "$output"
current_line=$current_line+1
sed -i "${current_line} i };" "$output"
current_line=$current_line+1
fi
#update index
if [ $col_index -lt $COL_MAX ];then
col_index=$col_index+1
else
col_index=0
row_index=$row_index+1
fi
done
done < $input
else
echo "This script should be executed on CC2650 periperal only"
fi