主题中讨论的其他器件:SysConfig
工具与软件:
我正在寻找一个比 SDK 8.x 附带的 basic_ble 示例更小的东西、*仅**支持广播设备角色...
我看到一个源文件名为 app_broadcenter.c、但我不知道如何使用此功能构建应用...
我对"终端菜单"也不感兴趣..
我的最终目标是缩小我的可执行文件的大小,所以任何关于如何从这个最小的例子中删除东西的建议将非常感谢..
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具与软件:
我正在寻找一个比 SDK 8.x 附带的 basic_ble 示例更小的东西、*仅**支持广播设备角色...
我看到一个源文件名为 app_broadcenter.c、但我不知道如何使用此功能构建应用...
我对"终端菜单"也不感兴趣..
我的最终目标是缩小我的可执行文件的大小,所以任何关于如何从这个最小的例子中删除东西的建议将非常感谢..
这对于我的用例来说太大了、我只需要一个信标...
我注意到该 SDK 包含一个 ti/drivers/rcl/handlers/ble5.c 文件、该文件似乎提供对 BLE 补丁映像的低级访问。。 我看到其中的函数用于发出各种 BLE 命令、包括广播。。
我已经将 generic.c 处理程序与您的 rfPacketTX 示例配合使用了。。 但我不能在 SDK 中任何实际使用 ble5.c 处理程序的代码...
在这个级别的广告示例可能会解决我的问题..
您好!
我是 Tanguy 的同事。
谢谢!
Toby
我要说的是、这个例子实际上是建立在 rfPacketTx 示例之上的--尽管它会将 BLE 映像加载到无线电本身、而不是 propRF (通用)映像...
更重要的是、我认为此代码将使用 generic.c RCL 处理程序...
我正在寻找一些使用 ble5.c 处理程序的人--它的命令和功能更符合 BLE 协议。。 例如、我可以将广播通道掩码传递给 RCL_Handler_BLE5_Adv 命令;在 ble5.c 中处理通道排序。
虽然这在理论上可以通过不超过基本无线电 TX/RX 来实现、但 ble5.c 中显然有额外的逻辑、我想利用它... 更重要的是、ble5.c 使用大量的无线电寄存器**特定**用于 BLE 修补程序...
这个问题很愚蠢、但 为什么 TI 随 SDK 一起提供 ble5.c (以及 ble_cs.c 和 IEEE-c)、但没有提供有关如何使用这些处理程序的示例???
ble5.c 旨在与 BLE 堆栈一起使用。
有关处理程序(例如 ble、generic、...)、请参阅此处的 RCL 文档: https://dev.ti.com/tirex/explore/content/simplelink_lowpower_f3_sdk_8_10_01_02/docs/rcl/html/index.html
我已经阅读了文档和代码。。 我能不能查看 BLE 堆栈中实际使用 ble5.c 的源代码???
我相信我有简单的广告工作.. 我不是完全确定,然而,是传递我的广播包到处理程序通过 FIFO.... 我是否在 FIFO txPacket 中包含我的广播包的长度??
我可以看到数据包正在从处理程序内的 FIFO 中删除... 但我认为它不是很指明正确的地方..
/* * Copyright (c) 2013-2022, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /***** Includes *****/ /* Standard C Libraries */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <limits.h> /* TI Drivers */ #include <ti/drivers/GPIO.h> #include <ti/drivers/rcl/RCL.h> #include <ti/drivers/rcl/RCL_Scheduler.h> #include <ti/drivers/rcl/commands/ble5.h> /* SysConfig Generated */ #include "ti_ble_config.h" #include "ti_drivers_config.h" #include "ti_radio_config.h" /* Packet TX Configuration */ #define MAX_LENGTH (40U) // Max packet length #define NUM_DATA_ENTRIES (2U) // Number of data entries #define NUM_PAD_BYTES (3U) // Number of pad bytes #define HDR_LEN (1U) #define PACKET_INTERVAL 1000000 // Set packet interval to 500000us or 500ms /***** Variable declarations *****/ /* RCL Commands */ static RCL_CmdBle5Advertiser advCmd = RCL_CmdBle5Advertiser_Default(); static RCL_CtxAdvertiser advCtx = RCL_CtxAdvertiser_Default(); /* RCL Client used to open RCL */ static RCL_Client rclClient; /* Counters for RCL event callback */ volatile uint32_t gCmdDone = 0; // Command done /* TX packet buffer */ uint32_t packet[NUM_DATA_ENTRIES][NUM_PAD_BYTES + ((MAX_LENGTH + 10)/ 4)]; /* Adv data */ uint8_t advData[] = { 0x02, GAP_ADTYPE_FLAGS, GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED | GAP_ADTYPE_FLAGS_GENERAL, 0x04, GAP_ADTYPE_LOCAL_NAME_SHORT, 'T', 'X', 'N', }; /***** Callback Functions *****/ void defaultCallback(RCL_Command *cmd, LRF_Events lrfEvents, RCL_Events rclEvents) { if (rclEvents.lastCmdDone) { gCmdDone += 1; } } /***** Function definitions *****/ void *mainThread(void *arg0) { /* Initialize and open RCL */ RCL_init(); RCL_Handle rclHandle = RCL_open(&rclClient, &LRF_config); advCtx.advA[0] = 0xaaaa; advCtx.advA[1] = 0xbbbb; advCtx.advA[2] = 0xcccc; /* Callback triggers on last command done */ advCmd.common.runtime.callback = defaultCallback; advCmd.common.runtime.rclCallbackMask.value = RCL_EventLastCmdDone.value; advCmd.ctx = &advCtx; advCmd.chanMap = 0x7; advCmd.txPower.dBm = 0; advCmd.txPower.fraction = 0; /* Set RCL TX buffer packet to be packet buffer */ RCL_Buffer_TxBuffer *txPacket = (RCL_Buffer_TxBuffer *)&packet; uint8_t val = 0; while(1) { /* Create packet with random payload */ uint8_t *txData; txData = RCL_TxBuffer_init(txPacket, NUM_PAD_BYTES, 0, MAX_LENGTH); memcpy(txData, advData, sizeof(advData)); /* Set packet to transmit */ RCL_TxBuffer_put(&advCmd.ctx->txBuffers, packet); advCmd.common.status = RCL_CommandStatus_Idle; /* Submit command */ RCL_Command_submit(rclHandle, &advCmd); /* Pend on command completion */ RCL_Command_pend(&advCmd); // return 0; usleep(PACKET_INTERVAL); //HapiWaitUs(PACKET_INTERVAL); } }
根据我使用功率分析仪所说的、此程序在所有三个通道上每秒广播一次、频率为5dB……
我认为实际广播包(advData)不会被传输、但是...
当我单步执行处理程序代码时、它似乎挑选值0x2 (第一个长度字节)作为所使用的广播类型...
能否验证我是否正确地通过了缓冲区
感谢您分享您的进展。
我们的 SDK 不支持以这种方式使用 BLE、我们希望开发人员能够使用提供的 BLE Stack 库来使用任何 BLE 功能。
为了实现更简单的操作(例如仅 BLE 广播广播广播广播广播广播广播)、可以使用上面的示例、正如我之前提到的文章中所说的、它是从现有实施(TIDA00759、BLE PIR 传感器)移植的。
如果您需要在不同的信道/频率上广播、每条 TX 命令都有一个频率字段。