This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EZ430-RF2560, error_handler()



 

thx in advance!


Hello,
Using EZ430-rf2560 with sample acceleromter application for a project.  For now, I'm trying to turn BT on and make local device discoverable for phone pairing.  Debug session takes me to error handler function when script is running.  Code is based on accelerometer application explanation from DEVELOPER'S GUIDE.  IAR is running on a virtual windows. Please help.  I'm a noob at this so detailed solutions are greatly appreciated.  The following is my main script code.  

int main(void)
{
 sdk_start_scheduler(); /* Start OS scheduler */
 // sdk_handle_init_sequence();
 P1DIR=BIT0+BIT1;
 UINT16 retval = sdk_bluetooth_on();
 if (API_SUCCESS == retval)
{
 UINT16 sdk_bt_power = SDK_BT_ON_IN_PROGRESS;
 for(int z=0;z<20;z++)
 {
 P1OUT ^=BIT1;
 }
 }
 /* Write Inquiry Scan mode (Interlaced scanning = 0x01) */
 //UCHAR scan_type2=0x01;
 //Interlaced scanning=0x01;
 retval = BT_hci_write_inquiry_scan_type(0x01);
 if (retval != API_SUCCESS) {
 //sdk_display(SDK_MSG_AREA,(const UCHAR *)"Failed to set inquiry scan type\n", 0);
 }
 /* Change write Page Scan mode (Interlaced scanning = 0x01)*/

 retval = BT_hci_write_page_scan_type(0x01);
 if (retval != API_SUCCESS) {
 // sdk_display(SDK_MSG_AREA,(const UCHAR *)"Failed to set page scan type\n", 0);
 /* Make local device discoverable (Inquiry Scan & Page Scan enabled =0x03)*/
 }
 UCHAR scan_type=0x03;
 retval = BT_hci_write_scan_enable( 0x03);
 if (API_SUCCESS == retval)
 {
 UCHAR sdk_bt_visible = SDK_DISC_ON;
 for(int z=0;z<20;z++)
 {
 P1OUT |=BIT0;
 }
 }
 /* for(int i=5000;i>0;i--)
 {
 P1OUT ^=BIT0;
 }*/
 retval = BT_hci_inquiry(SDK_INQUIRY_LAP, SDK_INQUIRY_LEN,SDK_NUM_RESPONSES);
 if (retval != API_SUCCESS)
 {
 for(int z=0;z<10;z++)
 {
 P1OUT ^=BIT0;
 }
 }
 // sdk_display(SDK_MSG_AREA, (const UCHAR *), "Failed to initiate Inquiry\n", 0);
 // sdk_print_message( "Error: failed to initiate INquiry \O");
 else
 {
 //sdk_diplay( "Inquiry started...Wait for completion]n",0);
 }
 API_RESULT sdk_hci_event_indication_callback(UCHAR event_type, UCHAR * event_data, UCHAR event_datalen);
 // {
 /* Switch on the Event Code */
 /* switch (event_type)
 {
 case HCI_INQUIRY_RESULT_EVENT:
 hci_inquiry_result_event_handler(event_data);
 break;
 }
 return API_SUCCESS;
 }*/
 UCHAR * bd_addr;
 UCHAR page_scan_rep_mode;
 UCHAR page_scan_mode;
 UINT16 clock_offset;
 retval = BT_hci_remote_name_request(bd_addr,page_scan_rep_mode,page_scan_mode,clock_offset);
 if (retval != API_SUCCESS)
{
 printf("Remote Name Request FAILED !! Error Code = 0x%04x\n",
 retval);
 }
 for(;;)
 {}

 return 0; /* Should never reach here */
}

 

  • Hi Gabriel Jalil,

    The sdk_error_handler() function is used in the SDK to handle different types of error conditions. These error conditions are defined in bt_sdk_error.h.

    The sdk_error_code variable is used to identify the error condition.

     

    It will be useful if you can report back the value of this variable and also the callstack leading to this error condition.

     

    Regards,

  • Hello,

    It usually goes to the error condition when I declare any of the following functions i my code:

    1) BT_hci_write_scan_enable(scan_type);

    2)sdk_start_scheduler()

    3)sdk_handle_init_sequence()

    The sdk_bluetooth_on() function works properly.  I'm guessing i'm missing some initial setup I haven't taken into account, which is not easy to find in the developer's guide.  Could you give a list of instructions mentioning all the required initializations before being able to invoke those functions? 

    When I try to do a step in to trace the error, it invokes sdk_error_handler() when its communicating with assembly.

    Thanks,

    Gabriel

     

  • Gabriel,

    Were you able to solve your problem?

    Regards,

    Miguel