Studio Bluetooth Forum Discussions
I want to limit who can pair with my device to who I give the code to.
Hello,
I've read through the forum and the advice to get single step debugging working on the CYW920719Q40EVB-01 is to implement the following:
In application_start or button interrupt handler:
SETUP_APP_FOR_DEBUG_IF_DEBUG_ENABLED();
BUSY_WAIT_TILL_MANUAL_CONTINUE_IF_DEBUG_ENABLED
The above seems to work for the example snippets such as gpio_hal and beacon etc. but not for any of the Bluetooth Mesh examples. Can someone please advise on how to get single step debugging working for Bluetooth Mesh?
Thanks in advance.
Show LessHi,
We are routing audio data(SCO) to the app using setup as follows:
wiced_bt_voice_path_setup_t stBlAudioPathSetup =
{
.path = WICED_BT_SCO_OVER_APP_CB,
.p_sco_data_cb = BlAudioHandleSCOData,
};
What I'm noticing is the sco data callback is not called at the expected frequency at the beginning of an audio session. To be exact, I'm expecting 16-bit audio data at 8kHz sample rate, equating to 16000 bytesper second. According to my log below, in the first second I got 13900 bytes, in the second second I got 14700 bytes, and only until the 4th second I got the expected 16000 bytes.
Debug log from my custom app:
[1]Audio byte rate:13900
[2]Audio byte rate:14700
[3]Audio byte rate:15600
[4]Audio byte rate:16000
[5]Audio byte rate:16000
My questions:
1) What can cause the low data rate described above at the beginning of an audio session?
2) What triggers the sco data callback? I seem to remember at some point I get 120 bytes per callback, but now I'm only getting 100 bytes per callback. Is this amount configurable?
Thanks!
Show LessWe are using WICED-Studio for developing an embedded Bluetooth application. Is it possible to initiate/control BLE DTM (Direct Test Mode) direct from our WICED application which is running on a BCM920706 respectively CYBT-343026-01? Alternatively is there any way to send 'internal' HCI commands from the WICED app to implement this feature by our own?
Show LessI wonder I can get the CYBT-423028 footprint for Altium
I was browsing through the SDK directories and found source codes for complete implementations of profiles like the HFP and SPP under include/libraries/handsfree_profile and spp_lib. There also seems to be compiled version of those under Wiced-BT/tier2/brcm/libraries/lib/20703/.
Are those intended to be used by us trying to create a custom app?
If so, where are the header files that specifies the user interfaces to the libraries?
Also, why are all the sample projects implementing their own version of the profile while a library is available?
Thanks.
Show LessHello All!
I hope this is the right place to post this question.
I just got a kit and am trying to scan for BLE packets and send them to a local server on my computer. It's mostly working but my HTTP connection get stuck after a few BLE packets are scanned and sent. My current implementation has a console command tied to a callback function that scans for BLE packets and then opens a connection to the server set up on my laptop.
I haven't had much experience working with HTTP requests, but I have to re-open a connection every time I want to send a packet, since I get a HTTP_DISCONNECTED event after sending a packet. I don't know if this is how it is designed to work. Is there another way of implementing it?
I picked up the HTTP post request implementation from http://www.cypress.com/blog/technical/wiced-http-client and I added a BLE scan callback function to the ble_hello_sensor example in WICED IDE.
After all the packets are scanned, I think that the call http_client_connect is stuck, although it has a timeout, so I'm not sure what's happening there.
Connecting to 10.0.0.59
Connected
Disconnected from 10.0.0.59
device found!
Connecting to 10.0.0.59 <--- Never goes beyond this!
My ble_scan, packet sending code and event handler is like this:
static int hello_sensor_scan_ble( int argc, char *argv[] )
{
WPRINT_BT_APP_INFO( ("************************\n") );
WPRINT_BT_APP_INFO( ("Scanning for BLE devices\n") );
WPRINT_BT_APP_INFO( ("************************\n") );
// wiced_bt_ble_observe (WICED_TRUE, 2,(wiced_bt_ble_scan_result_cback_t *) hello_sensor_scan_ble_callback);
wiced_bt_ble_scan(BTM_BLE_SCAN_TYPE_HIGH_DUTY, WICED_TRUE, (wiced_bt_ble_scan_result_cback_t *) hello_sensor_scan_ble_callback);
return ERR_CMD_OK;
}
static void hello_sensor_scan_ble_callback(wiced_bt_ble_scan_results_t *p_scan_result, uint8_t *p_adv_data)
{
uint8_t adv_data_length;
uint8_t *p_data = NULL;
uint8_t LENGTH = 7;
char* name = "abcdefg";
switch (p_scan_result->ble_evt_type)
{
case BTM_BLE_EVT_CONNECTABLE_ADVERTISEMENT:
/* Check the contents of the ADV - what's the name? */
p_data = wiced_bt_ble_check_advertising_data( p_adv_data, BTM_BLE_ADVERT_TYPE_NAME_COMPLETE, &adv_data_length);
if (adv_data_length != 0) {
if (( memcmp( p_data, name, LENGTH ) == 0 )) {
WPRINT_BT_APP_INFO(("device found!\n"));
send_packet();
}
return;
default:
return;
}
}
static void send_packet(void)
{
wiced_result_t result;
http_client_init( &client, WICED_STA_INTERFACE, event_handler, NULL );
WPRINT_APP_INFO( ( "Connecting to %s\n", SERVER_HOST ) );
/* configure HTTP client parameters */
client_configuration.flag = (http_client_configuration_flags_t)(HTTP_CLIENT_CONFIG_FLAG_SERVER_NAME | HTTP_CLIENT_CONFIG_FLAG_MAX_FRAGMENT_LEN);
client_configuration.server_name = (uint8_t*) SERVER_HOST;
client_configuration.max_fragment_length = TLS_FRAGMENT_LENGTH_1024;
http_client_configure(&client, &client_configuration);
/* if you set hostname, library will make sure subject name in the server certificate is matching with host name you are trying to connect. pass NULL if you don't want to enable this check */
client.peer_cn = (uint8_t*) SERVER_HOST;
if ( ( result = http_client_connect( &client, (const wiced_ip_address_t*)&ip_address, SERVER_PORT, HTTP_NO_SECURITY, CONNECT_TIMEOUT_MS ) ) != WICED_SUCCESS )
{
WPRINT_APP_INFO( ( "Error: failed to connect to server: %u\n", result) );
return;
}
WPRINT_APP_INFO( ( "Connected\n" ) );
http_header_field_t header[3];
char messageBody[128]; // Enough to hold the message body
char messageLengthBuffer[10]; // Enough to hold the characters for the Content-Length: header
char *receiverAddress = "192.168.1.255";
char *rssi = "1";
char *senderAddress = "192.168.1.255";
sprintf(messageBody,"&receiverAddress=%s&rssi=%s&senderAddress=%s", receiverAddress, rssi, senderAddress);
header[0].field = HTTP_HEADER_HOST;
header[0].field_length = sizeof( HTTP_HEADER_HOST ) - 1;
header[0].value = SERVER_HOST;
header[0].value_length = sizeof( SERVER_HOST ) - 1;
#define MIME_FORM_URL "application/x-www-form-urlencoded"
header[1].field = HTTP_HEADER_CONTENT_TYPE;
header[1].field_length = sizeof( HTTP_HEADER_CONTENT_TYPE ) - 1;
header[1].value = MIME_FORM_URL;
header[1].value_length = sizeof( MIME_FORM_URL ) - 1;
sprintf(messageLengthBuffer," %d",strlen(messageBody)); // Put the message body into the buffer so that you can strlen it
header[2].field = HTTP_HEADER_CONTENT_LENGTH;
header[2].field_length = sizeof( HTTP_HEADER_CONTENT_LENGTH ) - 1;
header[2].value = messageLengthBuffer;
header[2].value_length = strlen(messageLengthBuffer);
http_request_init( &requests[0], &client, HTTP_POST, request_uris[2], HTTP_1_1 );
http_request_write_header( &requests[0], &header[0], 3 );
http_request_write_end_header( &requests[0] );
http_request_write( &requests[0], (uint8_t*)messageBody, strlen(messageBody) );
result = http_request_flush( &requests[0] );
if ( result != WICED_SUCCESS )
{
WPRINT_APP_INFO( (" POST request flush failed\n") );
}
else
{
result = wiced_rtos_get_semaphore(&requestSemaphore,10000);
if ( result != WICED_SUCCESS )
WPRINT_APP_INFO( (" POST request timed out \n") );
else
{
WPRINT_APP_INFO( ("\nPOST successful\n") );
}
}
http_request_deinit( &requests[0] );
http_client_disconnect( &client );
}
static void event_handler( http_client_t* client, http_event_t event, http_response_t* response )
{
switch( event )
{
case HTTP_CONNECTED:
WPRINT_APP_INFO(( "Connected to %s\n", SERVER_HOST ));
break;
case HTTP_DISCONNECTED:
{
WPRINT_APP_INFO(( "Disconnected from %s\n", SERVER_HOST ));
break;
}
case HTTP_DATA_RECEIVED:
{
wiced_rtos_set_semaphore(&requestSemaphore);
break;
}
default:
break;
}
}
}
}
Thanks!
Message was edited by: agusta mir Added modifications to include more code
Show LessGreetings,
After having sucessfuly connected the bluetooth module with other bluetooth enabled devices such as an android phone or a PC and being able to send data to them via SPP, I am currently trying to send messages from these devices to the module.
I am periodically sending the module a byte in hexadecimal format (0x10) from my phone.
In the debug UART I see that all the callback functions are called as expected. However, the "WICED_BT_TRACE(" spp_data_cb: %x, %d \n", p_data, len );" inside the "hci_control_spp_rfcomm_data_callback" function gives everytime a different value for the "p_data" field.
Since I'm always sending the same message, shouldn't it be the same everytime?
I'd like to be able to display the exact value of the byte received by the module. Any idea on how could I do it?
Thank you in advance.
Regards.
Show LessUsing the 20706 chip our app connects to an external audio device using the HSP profile. When call starts, the app sets up the SCO voice link to the headset. I've been noticing the time it takes to establish the connection ranges from a few ms up to 3s. Is there any way for us to control/minimize this setup time?
Show Less