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.

OpenStack(), Stack Init Failed: -4, Unable to open the stack.



I'm trying to get the SPPDemo running on my LM4F232H5QD Eval Board using a TiWi-uB2 module from LSR. Following the instructions here:

http://processors.wiki.ti.com/index.php/CC256x_MSP430_Bluetopia_Basic_SPPDemo_APP#Running_the_Bluetooth_Code

I see the Stellaris Virtual Serial Port (COM20) in Device Manager and am able to attach a serial terminal to it. The suggested 9600, 8N1 settings turned out wrong, but I was able to figure out that 115200, 8N1 is the correct UART configuration. That said, once I attached the serial terminal and reset the board, I get the following message:

The terminal waits at OpenStack() and after what seems like a timeout, shows the "Stack Init Failed: -4 Unable to open the stack." error. If I try to run in debug mode, setting a breakpoint at BSC_Initialize(), the code will hang after I try to continue to step in. I was not able to find the source file containing BSC_Initialize() other than the BSCAPI.h header file.

Here's a picture of the TiWi-uB2 module connected to the eval board. It appears to be happily powered.

  • Hi James,

    Did you populate the slow clock oscillator on the eval board?

     

  • Hi James,

    This indicates an HCITRANS issue.  Steps would be:

            1 - Verify all UART pins are correct.  Here is a snippit that shows the PINs for that board (using Stellaris Ware):

             SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
             SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

             SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);

             GPIOPinConfigure(GPIO_PC4_U1RX);
             GPIOPinConfigure(GPIO_PC5_U1TX);
             GPIOPinConfigure(GPIO_PF1_U1CTS);
             GPIOPinConfigure(GPIO_PF0_U1RTS);

             GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
             GPIOPinTypeUART(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1);

             UARTFlowControlSet(UartContext.Base, UART_FLOWCONTROL_RX | UART_FLOWCONTROL_TX);

             /* Make sure the Bluetooth Device is in Reset.                 */
             GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);

             BTPS_Delay(100);

            // go ahead and finish init (threads/events/etc)

            // finish the UART init (below)

                      UARTConfigSetExpClk(UART1_BASE, SysCtlClockGet(), COMMDriverInformation->BaudRate, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

             /* FreeRTOS requires RTOS-aware int handlers to be priority    */
             /* value 5 or greater                                          */
             MAP_IntPrioritySet(INT_UART1, 6 << 5);

             IntEnable(INT_UART1);
             UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
             UartContext.Flags |= UART_CONTEXT_FLAG_FLOW_ENABLED;

             /* Clear any data that is in the Buffer.                       */
             FlushRxFIFO(UartContext.Base);

             /* Bring the Bluetooth Device out of Reset.                    */
             GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

             /* Check to see if we need to delay after opening the COM Port.   */
             if(COMMDriverInformation->InitializationDelay)
             {
                BTPS_Delay(COMMDriverInformation->InitializationDelay);
             }

            2 - Make sure that the correct Reset/Shutdown PIN is correct and toggled.  Note that delays are needed to give the chip time to settle.

            3 - As said above, the slow clock 32KHz needs to be populated on the board

    Debug output can be added to (and the HCI transport UART code changed) in:

             Bluetopia\HCITRANS.c

    Please let us know the results.

     

    Regards,

    Stonestreet One.

  • Hi.

    I am getting same error. I have checked HCITRANS.c file. There is nothing wrong in initialization. But I have doubt that the module has own slow clock 32KHz oscillator still I have to solder oscillator on kit. 

    Regards,

    Meet

  • Hi,

    Can you please try the demos(both the debug and release version) from the Stonestreet One BT+ BLE Stack on Tiva C SDK,Version 1.1 for TM4C123G from here http://www.ti.com/tool/stonestreetone-bt-sdk and see if you are still facing the problem.

  • Hi Sundeep.

    Thanks for  your reply. I have solved the issue. It was related to Slow clock Oscillator. I need  change jumper setting in tiwi uB2 boards for slow clock input.

    Regards,

    Meet

     

  • Hi Meet,

    Thanks for the response with the solution.

  • Hi Sundeep,

    I am looking for HFP profile demo  sample codes for Tiva C. You have mention in one of your post that Ti going to release it soon. Have Ti uploaded demo code for HFP? If they have, would you please tell me where to download it.

     

    Regards,

    Meet     

  • Hi,

    Sorry that should have been a mistake. The new release for TivaC is uploaded but  it does not include HFP at.

  • Hi,

    Thanks for your reply.

    Regards,

    Meet