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.

BSC_Initialize returns -4

Other Parts Discussed in Thread: MSP430F5529, CC2564

We’ve got a TI MSP430F5529 experimenter board and a CC2564 Bluetooth chip.  We’ve used the SPPLEDemo_Lite and have gotten it to work.

We are now trying to get it to work on our board.  Again, we’ve got the 5529 and the CC2564 chip hooked up with our 4 lines (TX, RX, CTS, and RTS) hooked up (each flipping into the other’s counterpart as shown in the diagrams).  We get to the BCS_Initialization and it returns with –4.

In Debug during HCITR_COMOpen, we can watch RTS go high and CTS go low.  After that, we never see traffic on these lines or the RX and TX lines.

Any advise would be great

Update:  We decided to watch the RX and TX lines.  The TX line sends some data and the RX line then sends some data.  This happens once then BSC_Initialize returns -4.  Upon closer inspection, the RTS and CTS do alter during this event.

  • Sundeep

    We believe that the first two steps are functioning correctly

    • We see RTS come up with the FLOW_ON command in HCITR_COMOpen after the BT_DEVICE_UNRESET() is called.
    • HAL_CommConfigure is called from HCITR_COMOpen.  It sets the baud rate as 115200 and passes in the flags of (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE).  I don't see where the Hardware Flow Control gets set however

    We then get to the rub.  We can see TX send over what looks like 3 bytes (one at a time if we are stepping through the function) then RX sends something back.  At this point all communication stops.  If we jump to the conclusion of BSC_Initialize we find that it has returned -4 and the the nSHUTDOWN line is low, indicating that the chip has turned off.

    We setup the ACLK to run off XT1 at 32,768 Hz.  We setup the A1 Timer as follows

    TIMER_A_configureUpMode(
                  TIMER_A1_BASE,
                  TIMER_A_CLOCKSOURCE_ACLK,
                  TIMER_A_CLOCKSOURCE_DIVIDER_1,
                  33,
                  TIMER_A_TAIE_INTERRUPT_DISABLE,
                  TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE,
                  TIMER_A_DO_CLEAR
    );

    We use this to drive a millisecond tick counter that we provide in the Tick Counter Call Back.

  • Hi,

    Error -4 is defined as BTPS_ERROR_HCI_INITIALIZATION_ERROR, which means that your uart is not configured correctly.

    You are saying that the nSHUTDOWN is low? this pin should be high before the RTS goes low.

    Mind that the accuracy of the slow clock frequency must be 32.768 kHz ±250 ppm for Bluetooth use.

    As the soft ware is working with he 5529 EXP board. I don't think you need to change any thing in the software for your board. If you are trying to use different pins for UART then this is all you need to change in the SW as mentioned in the hardware porting guide.pdf, which is part of the documentation folder of the SDK.

  • Hi Sundeep

    nSHUTDOWN starts low, when we hit BT_DEVICE_UNRESET() in HCITR_COMOpen(), nSHUTDOWN goes high.  After this, HCI_RTS does go low.  It remains high until we finish BSC_Initialize() at which point -4 is returned and nSHUTDOWN goes low.

    We us XT1 to generate the 32.768 kHz for the Bluetooth.  XT1 is an oscillator, not a crystal.  We feed this through a level translator into the CC2564 chip.  It goes into the MSP430 chip on P5.4 and we use it for the ACLK as described in the last post.

    We still receive one burst of data on the TX and RX line (on the MSP430 Side).  

    We originally used some different pins and modified HRDWCFG.h to match this.  We've since changed our pins around to be an exact copy of the SPPLEDemo_Lite:  nSHUTDOWN P7.5, RTS P2.1, CTS P2.4, TX 4.4, RX 4.5.  The Slow Clock is still on P1.0, but that line is not brought to the CC2564 chip since we are bringing in the Slow Clock directly from the XT1 oscillator.

  • Hi,

    I hope the command that is sent could be HCI_Read_Local_Version_Information.

    Can you get me the data what is been received? 

  • Sundeep

    We transmit 0x1, 0x3, 0xC, 0x0.

    The byte that is read back is 0x0.  However, the scope shows that data is being sent that is clearly not zero and clearly longer then one byte.  The first byte attempting to be returned is 0x4.  The problem looks to be the rate of transmission.

    • On the Experiment Board, the each bit (either RX or TX) is 8 micro seconds long.  
    • On our board, a TX bit is 24 micro seconds while a RX bit is 12 micro seconds.  

    What could cause this difference in rate?  I'm assuming this difference is what causes the communication to fail and the BSC_Initialize to return -4.

    From the USB side of the code (which is where we started our project), we set up our clocks as follows (mclkFreq is 8,000,000).  Is there something off in here?

    void initClocks(DWORD mclkFreq)
    {
      
    UCS_clockSignalInit(
      UCS_BASE,
      UCS_FLLREF,
      UCS_REFOCLK_SELECT,
      UCS_CLOCK_DIVIDER_1);
    UCS_clockSignalInit(
      UCS_BASE,
      UCS_ACLK,
      UCS_XT1CLK_SELECT,
      UCS_CLOCK_DIVIDER_1);
         
    UCS_initFLLSettle(
        UCS_BASE,
        mclkFreq/1000,
        mclkFreq/32768);
    }
    Edit: We attempted to figure out what the TX buffer had returned.  It returned 4 bytes (with each bit lasting 12 microseconds).  The software only attempted one byte read however (it captured 0x00).  Assuming the first bit was always 0, it returned
    • 0x04 (Raw Data from scope was 0 0010 0000)
    • 0x10 (Raw Data from scope was 0 0000 1000)
    • 0x01 (Raw Data from scope was 0 1000 0000)
    • 0x0C (Raw Data from scope was 0 0011 0000)

  • Found the problem

    The BT_CPU_FREQ defined in HRDWCFG was wrong for our setup.  It was set to cf25MHZ_t, but should have been cf8MHZ_t.  This was throwing off our communications as setup by HAL_CommConfigure..  BSC_Initialize now returns a non-zero value (in this case 1).