Smart Bluetooth Forum Discussions
I am using hello_sensor application in WICED SMART SDK V1.1.0.
I want to set my bcm20732's device name like this: prefix string + bt address. For example, if prefix is "RAE", and bt address is 0x20732a123456, so the device name should be "RAE20732a123456".
I found this ticket: To change the device's name dynamically, then I followed its content and had changed the adv device name, this is code snippet:
//convert bt address to string
static void btAddr2Ascii( UINT8* hex, UINT8 size, char *buff )
{
UINT8 value;
UINT8 i;
for( i = 0; i < size; i++){
value = hex[size - 1 - i];
//ble_trace1("value: 0x%x\r\n", value);
if( (value >> 4) < 10 ){
*buff++ = (value >> 4) + '0'; //'0' ~ '9'
}
else if ( ( (value >> 4) > 9 ) && ( (value >> 4) < 16 ) ){
*buff++ = (value >> 4) + 55; //'A' ~ 'F'
}
if( (value & 0xf) < 10 ){
*buff++ = (value & 0xf) + '0'; //'0' ~ '9'
}
else if ( ( (value & 0xf) > 9 ) && ( (value & 0xf) < 16 ) ){
*buff++ = (value & 0xf) + 55; //'A' ~ 'F'
}
}
*buff++ = '\0';
}
......
char friendly_name[20];
BLE_ADV_FIELD adv[2];
//prepare name
memcpy(friendly_name, "RAE", 3 );
btAddr2Ascii(bda, 6, &friendly_name[3]);
//ble_trace1("friendly_name: %s\r\n", friendly_name);
adv[0].len = 1 + 1;
adv[0].val = ADV_FLAGS;
adv[0].data[0] = LE_LIMITED_DISCOVERABLE | BR_EDR_NOT_SUPPORTED;
// name
adv[1].len = strlen(friendly_name) + 1;
adv[1].val = ADV_LOCAL_NAME_COMP;
memcpy(adv[1].data, friendly_name, adv[1].len - 1);
bleprofile_GenerateADVData(adv, 2);
I can use iOS lightBlue to scan and find my bcm20732tag as peripheral and the device name is what I want, but after establishing a connection, the device name reverted to "Hello". I think that device name of gatt database should be changed either.
CHARACTERISTIC_UUID16 (0x0015, 0x0016, UUID_CHARACTERISTIC_DEVICE_NAME,
LEGATTDB_CHAR_PROP_READ, LEGATTDB_PERM_READABLE, 16),
'H','e','l','l','o',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
I used INT32 bleprofile_WriteHandle(UINT16 hdl, BLEPROFILE_DB_PDU *p_pdu); to change the gatt database,
db_pdu.len = 16;
memcpy(db_pdu.pdu, friendly_name, 16);
ble_trace1("wrHandle: 0x%X", bleprofile_WriteHandle(0x0015, &db_pdu));
the result of write handle was always 0x0d, so how can I change the device name of gatt?
Show LessHi Sir,
I compare the code difference between hello_sensor and ota_firmware_upgrade samples.
The following three parameters are different.
After I check the definition, it shows the GATT related stuffs and define the max number is 5.
UINT16 hdl[HANDLE_NUM_MAX]; // GATT HANDLE number
UINT16 serv[HANDLE_NUM_MAX]; // GATT service UUID
UINT16 cha[HANDLE_NUM_MAX]; // GATT characteristic UUID
In hello sensor,
/*.hdl =*/ {0x00, 0x0063, 0x00, 0x00, 0x00}, // [HANDLE_NUM_MAX];
/*.serv =*/ {0x00, UUID_SERVICE_BATTERY, 0x00, 0x00, 0x00},
/*.cha =*/ {0x00, UUID_CHARACTERISTIC_BATTERY_LEVEL, 0x00, 0x00, 0x00},
In OTA firmware upgrade,
/*.hdl =*/ {0x00, 0x00, 0x00, 0x00, 0x00}, // [HANDLE_NUM_MAX];
/*.serv =*/ {0x00, 0x00, 0x00, 0x00, 0x00},
/*.cha =*/ {0x00, 0x00, 0x00, 0x00, 0x00},
My question is how to define the contents of them?
Thanks,
Fran
Show LessHi,
Is it possible to configure a GPIO as open-drain? It doesn't seem like this configuration is allowed through the SDK (2.0) at the moment. Will it be added in the future?
Would the following workaround accomplish open-drain functionality?
-Configure GPIO as output enable and set low when signal needs to be low.
-Configure GPIO as output disable (so that it is high-Z) and allow external pullup to set the signal high.
Thanks,
Mike
Show LessI have developed a custom board based on the 20732S module and would like to migrate to the 20736S.
I built a few of our boards using the 20736S chip, and am currently trying to get our app to work on them.
I am successfully able to download and run "Hello Sensor" to my board using the 2.1.0 SDK.
However, when I try running my app that I developed in the 1.1.0 SDK, it seems to get what looks like a stack overflow in the create() function.
14:26:14 -
14:26:14 - permission check retCode = 00
14:26:14 - b4
14:26:14 - b400
14:26:14 - HELLO=0
<slight delay>
<booting again...>
14:26:14 -
14:26:14 - 0201060409546167
14:26:14 - 020a02
14:26:14 -
14:26:14 - permission check retCode = 00
14:26:14 - b4
14:26:14 - b400
14:26:14 - HELLO=0
14:26:15 -
14:26:15 - 0201060409546167
14:26:15 - 020a02
14:26:15 -
14:26:15 - permission check retCode = 00
14:26:15 - b4
14:26:15 - b400
14:26:15 - HELLO=0
14:26:15 -
14:26:15 - 0201060409546167
14:26:15 - 020a02
The last line in my create() function calls another function to complete board initialization. If I put a trace directly before that function call, it prints out; but putting a trace at the very start of the other function never prints, and then it reboots.
It's as if calling that function overwrites the stack and crashes the device.
Any ideas what is going on here? Is the application stack on the new SDK smaller than on the old one?
Is there any way to debug this?
void application_create(void)
{
extern UINT32 blecm_configFlag ;
blecm_configFlag |= BLECM_DBGUART_LOG | BLECM_DBGUART_LOG_L2CAP | BLECM_DBGUART_LOG_SMP;
bleprofile_Init(bleprofile_p_cfg);
bleprofile_GPIOInit(bleprofile_gpio_p_cfg);
// Configure battery monitor
blebat_batmon_cfg.fullVoltage = 1800;
blebat_batmon_cfg.emptyVoltage = 0;
blebat_batmon_cfg.shutdownVoltage = 0;
blebat_batmon_cfg.maxLevel = 180;
blebat_Init();
// register connection up and connection down handler.
bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_UP, connection_up);
bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_DOWN, connection_down);
bleprofile_regAppEvtHandler(BLECM_APP_EVT_ADV_TIMEOUT, advertisement_stopped);
//register to receive write callbacks
legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB)write_handler);
ble_trace0("HELLO=0\n"); // <-- this runs.
// system bootup
boot_start();
}
void boot_start()
{
BLEPROFILE_DB_PDU db_pdu;
UINT8 i;
ble_trace0("HELLO=1\n"); // <-- this never runs.
UINT8 *addr = emconinfo_getAddr();
UINT8 unexpected_boot = 0;
ble_trace0("HELLO1\n");
// Test mode input pin
UINT16 mask[3] = {1<<2,0,0};
gpio_registerForInterrupt(mask, boot_test_mode_button_cb, NULL);
gpio_configurePin(0,2,GPIO_OUTPUT_DISABLE | GPIO_INPUT_ENABLE | GPIO_PULL_UP | GPIO_EN_INT_FALLING_EDGE, 0);
// Clear out any spurious interrupt status.
gpio_clearPinInterruptStatus(0,2);
...
Show LessHi,
While doing scanning and creating connection at the same time, how does the scan interval and window behave while calling blecm_startScan and blecm_CreateConnection in the same period (not in sequence order).
Shall I use the same interval/window for these 2 function calls? What's the result of different interval/window that applied to these 2 functions?
Show LessDear,
I'm trying to develop the BLE connection manager as WICED SMART explorer.which is supported by Broadcom
Meanwhile I heard that WICED SMART explorer App seems to be open source.
Is it true? if it is, please let me know how to get the source.
Even WICED SMART explorer is not open source,
Could you let me know any other BLE Connection Manager App which is similar to WICED SMART Explorer?
Thank you.
Show Less
I've succesfully used the SMART (BLE) end of WICED for the last few months, but I have a question.
I know that after a BLE scan, that I can see the resultant Bluetooth Address and 'Friendly Device Name' of the various targets.
Now, without doing a 'connect' and get into the GATT Services/Descriptors/Values, can I retrieve the "advertised data"?
There are apps on iPhone ("LightBlue" for one) that can display the 'advertised' data, which can include the Manufacturer's Data, etc.
How do we retrieve this adverstised data with WICKED SMART commands?
Cheers, Robert Moore
Show LessThe BCM920736, like any other BLE SoC, has hardware AES support, and a true random number generator. In the BLE spec, there are HCI commands for direct access to this hardware, e.g. HCI_LE_Rand and HCE_LE_Encrypt.
Some HCI commands are obviously supported when delivered over the UART - see e.g. Tools/mbt/mbt.cpp.
Can these commands be delivered from the application level - for example to use the built-in AES hardware to perform encryption at the application, not the link layer?
If there is no direct support in the SDK, is there a possibility to use register-level access to deliver HCI commands and receive HCI events?
Show LessAfter migrating from SDK 2.0.1 to SDK 2.1.0 we found a very annoying issue.
After successfully building and downloading a new app from within the Eclipse IDE the following message appears:
Move DIP switch 2 of SW4 to off position and push Reset button to start application
This means that DIP switch 2 of SW4 has to be switched to the on position before downloading the app and then be switched to off to launch the app.
We tested this on both Linux and MacOS. We haven't tested this on Windows yet.
Our concern is that changing the state of this DIP switch will eventually lead into a mechanical failure of the DIP switch because such switches are not made for this.
Why is this necessary? In SDK 2.0.1 it works without changing the DIP switch all the time.
Show Less