I have build a ez430-bt5190 board myself and using MindTree's EtherMind Bluetooth® SDK. My board connected with a PC with bluetooth adapter. I have to enter pin code every times when my board power on. Is there any way (for example setting SDK) connecting with my PC directly without pin code needed.
Shali,
Please refer to this thread.
Regards,
Miguel
Thanks Miguel, That is just what I needed program. I would try it to see if it works well.
Hi, Miguel
I have tried that program according to your thread, I changed sm_storage_pl.c and appl_sdk.c, but it seems have some problem. First all, the statement appl_sdk_display_status(STATUS_BLUETOOTH_ON); could not pass compile. and if I shield this statement, It can pass compiltion but my board could not be found by other blue tooth device. I have not read this program in detail but I set a breakpoint at if(1== v_dev_info){...} in void appl_sm_reconnect() in appl_sdk.c and found that this condition is never established. that is to say reconnection is failed. Please let me know how I modify them and let it work well.
Thanks
Hi Shali,
1. We have given sample code that refers temperature application so that "appl_sdk_display_status(STATUS_BLUETOOTH_ON);" statements are available in auto reconnect sample code. we are suggesting you to add only
appl_sm_reconnect(); /* ------> Newly added */ function call in the end of appl_bluetooth_on_complete_event_handler(void) function definition.
2. if(1== v_dev_info){...}
Please check in your code, Have you replaced the following line( in sm_storage_pl.c), "#define SM_STORAGE_START_ADDR 0x4C00" with #define SM_STORAGE_START_ADDR 0x1800 ?
Senthil.
Hi, srisenthilkumar chandrasekaran
I have tried my program according to you advice(select flash memory 0x1800, change sm_ps_write(), call appl_sm_reconnect(); at the end of appl_bluetooth_on_complete_event_handler(void) ). and I found that function call appl_sm_reconnect(); often led my program into sdk_error_handler(); So I just skip this function call and my program work well, that is to say: my board can reconnect with PC without need pin code even if power off and power on again. Can I just use my board this way? Mybe there are some disadvantages, astable etc. would you mind tell me the result.
sincerely yours
appl_sm_reconnect() function is required to establish the reconnection, I think in your case PC is trying to re-connect with your board based the previous paired information.
Could you please give us the call stack information once it is enter into "sdk_error_handler" function. Normally there is no relation between "appl_sm_reconnect()" function and "sdk_error_handler()" function.
sm_ps_write() -> it saves the paired information into flash. appl_sm_reconnect() -> establish the reconnection based on the pairing information from flash.
Regards
the call stack is like this when it into "sdk_error_handler"
CALL STACK:sdk_error_handler()hci_command_complete_event_handler(?)sdk_hci_event_indication_callback(?,?,?)hci_transport_read_data()ht_read_task_start_routine()[PC=Memory:0x2AB6]
the steps that my program into "sdk_error_handler" are:
>download and debug >goconnect to PC and trasformation data through a virtual serial port >break>reset>goenter sdk_error_handler()from then on program always enters sdk_error_handler() ,LED1 and LED2 blink synchronously.
And I also found that my board connects with one other bluetooth device normally(without pin code needed) if I skip appl_sm_reconnect(), even if I power off my board and then power on it again.But my board will changes when I connect it to more than one other bluetooth, Pin code will be required everytimewhile power on my board, even if I connect it to the device last time it connected(paired).
void appl_sm_reconnect() { API_RESULT retval; UCHAR *sm_temp_ptr; UCHAR dev_bd_addr[6]; UCHAR v_dev_info; sm_temp_ptr =(unsigned char*) 0x1815; v_dev_info = *(sm_temp_ptr); if(1== v_dev_info){ sm_temp_ptr++; for(int i=0;i<=5;i++){ dev_bd_addr[i] = *sm_temp_ptr; sm_temp_ptr++; } BT_mem_copy(sdk_status[0].peer_bd_addr,dev_bd_addr, BT_BD_ADDR_SIZE); retval= BT_hci_create_connection(dev_bd_addr, SDK_CONFIG_ACL_PKT_TYPE, rem_bt_dev[0]. page_scan_rep_mode, 0, rem_bt_dev[0].clock_offset, 0x01); /* If already connected */ if (HCI_STATE_ALREADY_CONNECTED == retval) { /* Initiate SDP Query */ appl_spp_sdp_query(0); SDK_SPP_CHANGE_STATE(0, SDK_IN_SDP_QUERY); } else if (API_SUCCESS == retval) { /* On Success */ SDK_SPP_CHANGE_STATE(0, SDK_IN_ACL_CONNECTION); } else { sdk_display((const UCHAR *)"SM device does not exist\n"); } }else{ printf("Device info does not exist..So,Initiate the new connection\n"); } }
Thanks for your reply. Today I have tested auto reconnect with EZ430 board.
Please comment out the below code in appl_cb.c file (last 4 lines in hci_command_complete_event_handler() function)
// if (0x00 != status) {// sdk_error_code = SDK_WRONG_EVENT_RECEIVED;// sdk_error_handler();// }
Test condition:
>download and debug >goconnect to PC and trasformation data through a virtual serial port >break>reset>go
>close the old terminal(ex.putty)>reopen the terminal for same port.
Please check the same in your end and let me know the feedback.
It seems work well according to your advice of commenting out those three instructions. But I still find that my board somehow straped into sdk_error_handler() by other ways. I have two MID devices with bluetooth funcion, my board always traped into sdk_error_handler() when It connects with them. The call stack like this:
CALL STACK:sdk_error_handler()BT_alloc_mem()BT_rfcomm_write()BT_spp_send()user_task_routine[DATA16_HEAP_SIZE+0]
sdk_error_handler()BT_alloc_mem()rfcomm_transmit_data()rfcomm_write_bh()wt_service_queue()write_task_start_routine()[PC=Memory:0x2AB6]
sdk_error_handler()BT_alloc_mem()rfcomm_common_appi_handler()BT_rfcomm_write()BT_spp_send()user_task_routine()[PC=Memory:0x0]
But my board works well with my PC and notebook computer. Are those two MID failed? No, they work well with other bluetooth modul. When will the program enter sdk_error_handler()? and what should we do to avoid my program traped into sdk_error_handler() ?