**re-connection attempt Bluetooth CYBT413055 Evaluation Board ** How can I reconnect BT on SPP. If a device are paired but have become disconnected. I want to know about API

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
237_KGKT
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

I use the CYBT413055 Eval an want to attemps reconnect the Eval Board when the connection was lost.

i want to it periodically so i attemps each 10 seconds (using a timer) to reconnect as follow:

/*
* SPP connection up callback
*/
void spp_connection_up_callback(uint16_t handle, uint8_t* bda){

wiced_stop_timer(&spp_reconnect_timer); // stop the timer when connection is established

}

/*
* SPP connection down callback
*/
void spp_connection_down_callback(uint16_t handle)
{

/* check if timer is initialized and start it */
if(wiced_init_timer(&spp_reconnect_timer, spp_reconnect_timeout, 0, WICED_SECONDS_PERIODIC_TIMER) == WICED_SUCCESS){
wiced_start_timer(&spp_reconnect_timer,5);

}

 

 

 

void spp_reconnect_timeout(uint32_t param){

spp_reconnect_result = wiced_bt_spp_connect(bda);//reconnect;
}

It does not work! I need your help Thank u

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Update:

The more appropriate example here would be rfcomm-spp-multi-port where we have demonstrated client and server roles and implementation of two rfcomm ports ( 2 spp connection). 

https://github.com/Infineon/mtb-example-btsdk-rfcomm-spp-multi-port 

 

Before we call wiced_bt_spp_connect, we have to make sure that the service control block is set properly and the initialization of rfcomm server is active, etc. This app is expected to communicate with an external MCU/Host and the demonstration is done using ClientControl application which is present in the SDK. Instead, the host logic can be implemented in any other MCU or we can skip those and make it an individual embedded app. For example, instead of receiving the connect command from the external MCU, if we press the button it reconnects. I would suggest you to refer the above example. Please create a new thread if you have any doubts.

View solution in original post

0 Likes
5 Replies

What's the peer device? If you are using a smartphone, the connection result may depends on the app you are using. I can re-connect successfully with the RFCOMM_Serial_Port_Multi-Port demo and BlueSPP app on Android phone.

0 Likes
237_KGKT
Level 2
Level 2
25 sign-ins 10 replies posted 10 sign-ins

I am using an android smartphone. And the application I tried to reconnect to is called serial Bluetooth Terminal see link below and the project I downloaded on my Eval Board is an edited RFCOMM_Serial_Port.

please let me see what you did. which device do you work on?

/*
* SPP connection up callback
*/
void spp_connection_up_callback(uint16_t handle, uint8_t* bda){

wiced_stop_timer(&spp_reconnect_timer); // stop the timer when connection is established

}

/*
* SPP connection down callback
*/
void spp_connection_down_callback(uint16_t handle)
{

/* check if timer is initialized and start it */
if(wiced_init_timer(&spp_reconnect_timer, spp_reconnect_timeout, 0, WICED_SECONDS_PERIODIC_TIMER) == WICED_SUCCESS){
wiced_start_timer(&spp_reconnect_timer,5);

}
wiced_result_t spp_reconnect_result;
void spp_reconnect_timeout(uint32_t param){
spp_reconnect_result = wiced_bt_spp_connect(bda);//reconnect;
}

https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=de&gl=US

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Update:

The more appropriate example here would be rfcomm-spp-multi-port where we have demonstrated client and server roles and implementation of two rfcomm ports ( 2 spp connection). 

https://github.com/Infineon/mtb-example-btsdk-rfcomm-spp-multi-port 

 

Before we call wiced_bt_spp_connect, we have to make sure that the service control block is set properly and the initialization of rfcomm server is active, etc. This app is expected to communicate with an external MCU/Host and the demonstration is done using ClientControl application which is present in the SDK. Instead, the host logic can be implemented in any other MCU or we can skip those and make it an individual embedded app. For example, instead of receiving the connect command from the external MCU, if we press the button it reconnects. I would suggest you to refer the above example. Please create a new thread if you have any doubts.

0 Likes