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.

BTPS_ERROR_HCI_DRIVER_ERROR when using BSC_Initialize() in my own application

Other Parts Discussed in Thread: MSP-FET

Hello,

I am trying to write my own sample project after successfully running several of the SS1 examples on the EXP430f5438A with the C256x prototype board.

I cannot get as far as initializing the stack when writing my own application. I have searched many of the examples and the initialization routine is the same for all of them. Here is my stripped down version:

void main(void) {
	WDTCTL = WDTPW | WDTHOLD;    // Stop watchdog timer

	HAL_ConfigureHardware();
	
	/* Initialize the Stack                                        */
	HCI_DriverInformation_t HCI_DriverInformation;
	BTPS_Initialization_t BTPS_Initialization;

	HCI_DRIVER_SET_COMM_INFORMATION((&HCI_DriverInformation), 1, 115200,
			cpHCILL_RTS_CTS);
	HCI_DriverInformation.DriverInformation.COMMDriverInformation.InitializationDelay =
			100;

	BTPS_Initialization.GetTickCountCallback = GetTickCallback;
	BTPS_Initialization.MessageOutputCallback = DisplayCallback;

	BTPS_Init((void *) &BTPS_Initialization);
	int Result = BSC_Initialize((&HCI_DriverInformation), 0);

	if (Result > 0) { // if successful
        ...
}

I would show more code but this is all that is necessary. Result = -14 when return from BSC_Initialize. Can anyone help determine what I may be excluding from my init code?

thanks,

Mark Gill

  • Hi,

    The -14 error indicates that the command is sent to the Bluetooth chip and we get no response. Has there been any change to the HCITRANS or anywhere else?

    Thanks,

    Stonestreet One. 

  • Hello,

    Thank you for this information. The files HCITRANS.h and HCITRANS.c have not been modified. The stack functions perfectly fine for the sample applications. I think this demonstrates that the files are ok.

    The only modification I have made is adding #define __SUPPORT_CC256XB_PATCH__ to BTPSVEND.c

    I was just looking through my code and HCITRANS.h is not included as I am not using anything from this file.

    EDIT:

    I was able to get the stack to open successfully one time without changing anything in the code. I immediately tried again and it returned -14.

    I have found that static variables are not initialized to 0, and the sample applications seem to rely on this behavior.

    EDIT 2:

    I noticed that when debugging the sample application DEBUG_UART_INTERRUPT is called when initializing the stack. This does not happen in my ownapplication.

  • Hello,

    I'm finding that if I flash my code onto the board after flashing one of the example programs my code will work for one debugging session. Any subsequent debugging attempts will not work. I have to flash an example app onto the board, and then flash my own code onto the board. This is the only way I've been able to reliably run my code. 

    This seems like a restarting problem, but I am unsure how to make sure it runs after several attempts. This seems very closely related to some other threads I have seen. I will continue to research the forum.

    Best,
    Mark

  • Mark,

    Are you using the CCS or IAR libraries?

    Regards,

    Miguel

  • Hello,

    Thanks for looking into my issue. I am using the CCS libraries.

    Mark

    EDIT:

    This morning my code ran successfully 4 times in a row without loading other firmware onto the board in between successful trials. After this it began to exhibit the old symptoms.

  • Hi,

    That is strange.

    1. Make sure your jumper setting are correct on MSP-EXP430F5438A (Jumper 4 should not be connected as shown in the below link ).
    http://processors.wiki.ti.com/index.php/CC256x_MSP430_Bluetopia_Basic_Demo_APPS#Hardware_Setup

    2. are you still getting the same -14 error?

    3. Are you facing this issue when you are doing a reset of the board using S3 switch or when you disconnect the USB?

    4. It could be something related to _system_pre_init().

  • Hi,

    It seems like you are missing some initialization code, for instance something that would be in HAL. The MSP430 has some hardware modules that do not always reset on a powered reset (i.e. what would normally happen when the chip is powered but the reset line is toggled, for example by the MSP-FET).

    Thanks,

    Stonestreet One.

  • Thanks for the continued help guys. Using a custom _system_pre_init call did the trick. I used the one found in ANPDemo if others are curious.