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.
Tool/software:
i'm looking for something "smaller" than the basic_ble example shipped with SDK 8.x, which **ONLY** supports the broadcaster role....
i see a source file name app_broadcaster.c, but i'm not sure how to build an app with just this functionality....
i'm not interest in the "terminal menu" either....
my ultimate object is to shrink my executable size, so any suggestions on how to eliminate stuff from this minimal example would be greatly appreciated....
Hi,
You can remove the menu by selecting "Disable The Display Module" in SysConfig under the Advanced Settings of the BLE tab
To reduce even more the executable, remove strip the unused modules, such as UART2, in SysConfig.
Regards,
Tanguy
this is WAY too big for my use-case, where all i need is a beacon....
i noticed the SDK contains a ti/drivers/rcl/handlers/ble5.c file, which seems to provide low-level access to the BLE patch images.... and i see functions in there for issuing various BLE commands -- including advertising....
i've already worked with the generic.c handler in conjunction with your rfPacketTX example.... but i couldn't ANY code in the SDK that actually used the ble5.c handler....
an example of advertising at this level would likely solve my problem....
Hi,
I am Tanguy's colleague.
Please consider a similar solution shared here: https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1301556/cc2340r5-building-equivalent-of-tida00759-ble-pir-sensor
Thanks,
Toby
what i can tell, this example is literally built upon the rfPacketTx example -- though it would load the BLE images into the radio itself, instead of the propRF (generic) images....
more to the point, i assume this code would use the generic.c RCL handler....
i was looking for somethat used the ble5.c handler -- which has commands and features more aligned with the BLE protocol.... for example, i can pass a mask of advertising channels to the RCL_Handler_BLE5_adv command; sequencing through the channels is handled in ble5.c....
while this could theoretically be done with no more than basic radio TX/RX, there is clearly extra logic inside ble5.c which i'd like to leverage.... more important, ble5.c uses a large number of radio registers **specific** to the BLE patches....
silly question, but why does TI ship ble5.c (as well as ble_cs.c and ieee.c) with the SDK and yet provide no examples of how to use these handlers???
The ble5.c is meant to be used with BLE stack.
Please refer to RCL docs here for the handlers (e.g. ble, generic, ...): https://dev.ti.com/tirex/explore/content/simplelink_lowpower_f3_sdk_8_10_01_02/docs/rcl/html/index.html
i've read the docs and the code.... can i look at the source code in the BLE stack that actually uses ble5.c???
i believe i have simple advertising working.... what i'm not entirely sure about, however, is passing my advertising packet to the handler via the FIFO.... do i include the length of my advertising packet in the FIFO txPacket???
i can see the packet being removed from the FIFO inside the handler.... but i think it's not quite pointing to the correct place....
/* * 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); } }
from what i tell using power analyzer, this program IS advertising once per-second on all three channels at 5dB....
i believe the actual advertising packet (advData) is NOT be transmitted, however....
when i single step through the handler code, it seems to pick off the value 0x2 (the first length byte) as the type of advertising being used....
could you verify that i'm passing the buffer in correctly
Thanks for sharing your progress.
Our SDK does not support using BLE in this way, and we expect developers to use the BLE Stack Library provided to use any BLE functionalities.
For simpler operations, such as only BLE broadcasting advertisements, the above example could be used, as in my previously mentioned post it was ported from an existing implementation (TIDA00759, BLE PIR sensor).
If you need advertising on different channels/frequencies, each TX command has a frequency field.