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.
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 *p = tx_buf;
*p++ = (handle & 0xff);
*p++ = ((handle >> 8) & 0xff);
*p++ = result;
trans_rc = wiced_transport_send_data( HCI_CONTROL_SPP_EVENT_TX_COMPLETE, tx_buf, ( int )( p - tx_buf ) );
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.
1 of 1 people found this helpful
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?