- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
After debugging my application I've noticed that although my module receives an SPP data command, it just does not send it via Bluetooth.
I attatch a capture of the debugging process so you can see that the module is discoverable, pairable and connectable and that it receives the spp commands sent to it.
I have added a few WICED_BT_TRACE statements inside the SPP functions in order to see if the program reaches the critical points.
Like this:
uint32_t hci_control_process_rx_cmd( uint8_t* p_data, uint32_t length )
{
.
.
.
case HCI_CONTROL_GROUP_SPP:
WICED_BT_TRACE("SPP COMMAND\n");
hci_control_spp_handle_command( opcode, p_data, payload_len );
break;
.
.
.
void hci_control_spp_handle_command( uint16_t cmd_opcode, uint8_t* p, uint32_t data_len )
{
.
.
.
case HCI_CONTROL_SPP_COMMAND_DATA:
handle = p[0] | ( p[1] << 8 );
hci_control_spp_send_data( handle, &p[2], data_len - 2 );
WICED_BT_TRACE("SPP DATA DELIVERED\n");
break;
}
}
Do you have any idea about why could this be happening?
Thanks in advance for your help.
Best regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the logs that you have posted, I see that you have already established RFCOMM connection with a peer device whose address is 0xD065CA067D92. You are then again trying to establish a RFCOMM connection with another device, which is why you are seeing that "no free control block" message.
I don't see correlation between the logs and the prints you have posted. Where are the "SEND_TX_COMPLETE" and "SPP DATA COMMAND HANDLED" prints included?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you connect to a remote Bluetooth device first using HCI_CONTROL_SPP_COMMAND_CONNECT?
Do you get any HCI_CONTROL_SPP_EVENT_TX_COMPLETE event back? What was the result code?
I'd study a demo project and understand how SPP works first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response.
Yes, I use the HCI_CONTROL_SPP_COMMAND_CONNECT, but I always get the "hci_control_spp_connect - no free control block for connection" message.
I have also added a WICED_BT_TRACE right after the HCI_CONTROL_SPP_EVENT_TX_COMPLETE event is sent:
/*
* Send a data packet to the server
*/
uint8_t hci_spp_send_tx_complete( uint16_t handle, wiced_bt_rfcomm_result_t result )
{
uint8_t tx_buf[5];
uint8_t *p = tx_buf;
uint8_t trans_rc;
*p++ = (handle & 0xff);
*p++ = ((handle >> 😎 & 0xff);
*p++ = result;
trans_rc = wiced_transport_send_data( HCI_CONTROL_SPP_EVENT_TX_COMPLETE, tx_buf, ( int )( p - tx_buf ) );
WICED_BT_TRACE("HCI_CONTROL_SPP_EVENT_TX_COMPLETE\n");
return trans_rc;
}
In the capture I attatch you can see that "HCI_CONTROL_SPP_EVENT_TX_COMPLETE" is printed during the debugging process.
However, the connection seems not to be completed. It looks like if the p_scb->state variable changes to state other than "IDLE" before the connection can be fulfiled by the hci_control_spp_connect function, which causes it to immediately return.
Why could this be happening?
Thanks again for your attention.
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the logs that you have posted, I see that you have already established RFCOMM connection with a peer device whose address is 0xD065CA067D92. You are then again trying to establish a RFCOMM connection with another device, which is why you are seeing that "no free control block" message.
I don't see correlation between the logs and the prints you have posted. Where are the "SEND_TX_COMPLETE" and "SPP DATA COMMAND HANDLED" prints included?