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.

LAUNCHXL-CC2640R2: Bluetooth Connection Cannot Be Established - Coding/Software Issue

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640R2F,

Hi,

I have a custom-designed board that uses 7x7 MCU just like in the launch board. My board's schematic is almost the same as the launch board. I have also an external flash on the same pin, I have a motion sensor but I connected my sensor's interrupt pins on exactly the same with button pins of launch board, same I2C pins, same SPI pins, same UART pins, etc. Because of that, I did not think to create a custom board header and source files, instead, I use CC2640R2_LAUNCH.h and c files. I did not use 32KHz crystal but I already did this configuration properly. I am sure because before getting my custom board, I developed my code on the launch board referenced by custom board schematic. Only, I think, the related difference between custom and launch board is RF pins' schematic. I used Single-ended with external bias configuration.

I got my custom boards today and I can upload my code on it (as I said, I worked on launch board before, I directly upload this code just changing the "#define CC2650EM_7ID" line with the  "#define CC2650EM_4XS" line in CC2640R2_LAUNCH.h file). My code does really basic things via Bluetooth, just sends the data that it received before on the same characteristic. 

The PROBLEM IS: I cannot connect to the board, it seams connecting on UART terminal (since I use OAD Off-Chip example basis) just after I got "timed out" and it kicks out my connection suddenly ( I think, 3. party BLE applications try to connect successively, I tried with NRF Connect and BLE Scanner applications). I know I cannot explain the problem well, because of that, I added a video.

Also, THIS IS NOT A HARDWARE PROBLEM, you can check my other issue named "Custom Designed Board Bluetooth Connection Problem".

This project is very important for me and my company also, please help me about that.

Thanks.

Dogus

  • Hi Dogus,

    Assigning an expert to review.

  • Hi Dogus,

    Have you added any tasks? IF so, what's their priority?

    What mode are you using UART in (blocking/callback)?

    To figure out what's going on in the application in terms of connecting and disconnecting I would recommend using a BLE sniffer and posting a log.


  • Hi

    Thank you for your reply.

    I did not add an additional task on my code and my UART mode is exactly the same within SDK/blestack/oad_off_chip example.

    As I mentioned above my custom board's schematic is almost the same with the launch board's schematic. Because of that, I can use my code on the launch board and If I changed the "#define CC2650EM_7ID" line with the "#define CC2650EM_4XS" line in CC2640R2_LAUNCH.h file, then I can use (actually I am trying to) the same on my custom-designed board.

    Here, I shared 2 wireshark logs. I used this sniffer. One of my logs is NOK log that I logged with my custom-designed board and OK one is (with same code) log of launch board.


    Please note that, in the NOK log, I tried to connect to the custom board with my phone, after that with my pc and again with my phone. Of course, the whole attempting are failed. In OK log, I just connected to the launch board with my phone and it succeeded.

    my phone Bluetooth mac address: b4:8b:19:c8:24:49

    my pc Bluetooth mac address: 4C-34-88-17-7F-F4

    my custom-designed board mac address: 0x806FB0AFEE91

    my launch board mac address: 0x546C0EA04E24

    Since I cannot add files here, you can download them via this link:

    Thanks.

  • Hi,

    Could you download the log documents? Please inform me if you cannot download it.

    Thanks.

  • Hi Dogus,

    It looks like you have the same problem on both logs. At some point the slave stops responding to the connection event packets from the master.

    What is the peer device?

    Is your device the master or the slave in the connection?

  • Hi,

    My devices are in slave mode, I mean they have "resourceExplorer/blestack/OAD_OffChipExample".

    In my OK.log, I used CC2640R2 Launchxl Board as a slave with OAD_OffChip example and to connect it, I used an app named "nRF Connect" of Nordic Company placed on my phone.

    In NOK.log, I used custom-designed hardware that has exactly the same schematic with Launchxl Board (same peripherals, same MCU, etc.) but RF Front-end schematic. Instead of using LaunchBoard's RF Front-end schematic, I used "single-ended with external bias" configuration in my custom board schematic and because of that, I changed the "#define CC2650EM_7ID" line with the "#define CC2650EM_4XS" line in CC2640R2_LAUNCH.h file. 

    In short, the only difference between my custom designed card and LaunchXL Board is RF Front End schematic and the only difference between my custom-designed-card-software and the software used in LaunchXL Board is changing the "#define CC2650EM_7ID" line with the "#define CC2650EM_4XS" line in CC2640R2_LAUNCH.h file. Nothing more. My code is the "resourceExplorer/blestack/OAD_OffChipExample".

    With this configuration, OK log is for LaunchXL Board-MyPhone connection (nRF Connect app) and NOK log is for CustomDesignedBoard-Phone connection.

    So, I cannot understand the problem.

  • Hi,

    By the way, you said "It looks like you have the same problem on both logs. " but in OK log, I faced no problem. My phone connects to LaunchXL Board without a problem. So I cannot understand why you said that. 

    I mean, if you saw any problematic issue that I could not see in the OK log, please enlighten me because I assumed my code is not problematic on LaunchXL Board.

  • Hi,

    Is there any update about this issue?

    My company is about to invest a big project and we plan to use this MCU. So, it is very important to solve this problem for us.

    Please help me and let me know about the process.

  • Hi Dogus,

    Try just focusing on bluetooth connection, no UART connection and no IO's. Try loading the off-chip oad example with only these modifications below.

    CC2640R2_LAUNCHXL.h

    CC2650EM_4XS

    CC2640R2_LAUNCHXL.c

    const PIN_Config BoardGpioInitTable[] = {

    //CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    //CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    //CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    //CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    //CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
    //CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
    //CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
    //CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
    //CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
    //CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */

    PIN_TERMINATE
    };

    -kel

  • Hi,

    Thank you for your reply.

    I thought that maybe I changed some files inside the SDK, I used SDK 3.10.0.15 and yesterday, I downloaded the SDK 3.20.0.21 and imported blestack/off-chip example. I tried it first on my launch board without any coding changes and it worked normally of course. Just after that, I did CC2650EM_4XS modification in CC2640R2_LAUNCHXL.h file (I just changed this line, nothing more) and tried it on my custom-board and the, unfortunately, the problem still exists.

    I saw your reply today. Since I tried yesterday what you suggested, I just checked "BoardGpioInitTable[]" array in CC2640R2_LAUNCHXL.c file and it is exactly the same as you wrote above.

    In short, I am still seeing this problem.

  • Hi Dogus,

    Did you comment out the pin initialization at BoardGpioInitTable[]? Like this below. This is just to isolate whether any IO's is causing your problem?

    const PIN_Config BoardGpioInitTable[] = {

    //CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    //CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
    //CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    //CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
    //CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
    //CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
    //CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
    //CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
    //CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
    //CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */

    PIN_TERMINATE
    };

    Are you able to debug this and see where it hangs at your custom board? How do you power the board?

    Do the same with the simple peripheral example program, the non oad example program. If the same happens then your problem is pointing more of hardware problem.

    Check everything that is needed to make the CC2640R2F work such as crystal frequency, power supply and others. If you do not have experience with this, ask someone who can. Also you need to proper tools to do it such as oscilloscope, etc.

    Have your PCB design and schematic reviewed again by TI Engineer. If your not comfortable sharing that at forum. Ask a TI Engineer through private messaging.

    -kel

  • Hi,

    As you said, I tried my card with simple_peripheral example and it did not work. I saw exactly the same problem on UART console (connected-not connected-connected etc) just like the video I shared.

    Then I remember that I did not use 32KHz crystal on my design and I followed this link to configure simple_peripheral example and IT WORKED!!!

    Actually, I followed the same link to configure oad_off_chip example (I re-tried in a clean project) before and I could compile it without any error and I tested it on Launch Board and it worked. So I assumed I did it but apparently I could not. Since the link explains configuration steps for simple_pheripheral example, I could not make it on oad_off_chip example.

    In short, my major problem is that I cannot configure my oad_off_chip example without 32-kHz crystal-less mode.

    Am I right? What do you think?

    Could you please guide me to configure oad_off_chip example without 32KHZ crystal-less mode.

  • Hi Dogus,

    Let me see if I can configure 32-khz crystal-less mode using simple peripheral off chip oad from SDK 3.20. Also wait for a TI engineer help regarding this.

    -kel

  • Hi,

    Really appreciated. 

    I am waiting a feedback from you.

  • Hi Dogus,

    See, this post below.

    http://www.ti.com/lit/an/swra499b/swra499b.pdf

    But following the document guide just adding the necessary files at off-chip oad I encounter build errors at CCS.

    , please provide procedure for modifying SDK 3.20 simple peripheral off-chip oad example program to run without 32khz crystal.

    -kel

  • Hi Marie

    Could you please help me about procedure for modifying SDK 3.20 simple peripheral off-chip oad example program to run without 32khz crystal.

  • Part Number: LAUNCHXL-CC2640R2

    Tool/software: Code Composer Studio

    Hi,

    I cannot configure blestack/oad_off_chip example (3.20 SDK) to run without 32kHz crystal-less mode.

    My application cannot establish healthy Bluetooth connection just because of that (you can look at my previous issue named: Bluetooth Connection Cannot Be Established - Coding/Software Issue).

    Could you please guide me to do that? The current guide is for simple_pheripheral example but oad examples have also bim application and I cannot do that.

    I need your help.

  • Dogus,

    Please reference this app note for Crystalless operation guidelines.

    http://www.ti.com/lit/an/swra499b/swra499b.pdf

  • Hi,

    Is there any update about that?

  • Hi,

    Thank you for your reply.

    Sorry for my late reply. I was trying to make these configurations as you said.

    Since I have custom designed card, I need to work on it because when I work on launch board, I cannot see any problem even if I cannot configure my code to work without 32kHz crystal.

    I read an issue about that and it says "also BIM project must be configured to work without 32kkHz crystal" and I thing I could not do that. When I tried to implement the steps what the document says you shared, I got errors.


    Since I have custom-designed board, it is difficult to figure it out about error source, is it caused by hardware or software. Because of that, it would be great if you can share me exact steps to configure blestack/oad_offchip example to work without 32kHz crystal.

    Also, I read an issue about that and a texas-instruments engineer said to update the document but I could not find the document anywhere.

    Please look at my previous issue to make it clear about what is the background  of this issue (previous issue: LAUNCHXL-CC2640R2: Bluetooth Connection Cannot Be Established - Coding/Software Issue)

      

  • Hi,

    Sorry for the late answer,

    In the 3.20 SDK, rcosc_calibration.c, rcosc_calibration.h and ccfg_app_ble_rcosc.c are found in C:\ti\simplelink_cc2640r2_sdk_3_20_00_21\source\ti\blestack\common\cc26xx\rcosc. 

    You don't need to add all the code changes in bim:

    1. Include rcosc_calibration.c, rcosc_calibration.h -> In simple peripheral project,

    2. Include ccfg_app_ble_rcosc.c in bim and exclude ccfg_app_ble.c from build in bim

    3. Add USE_RCOSC to Defined symbols in both projects

    4. Add in the periphera project

    5. Add in the peripheral project 

    6. If using a custom board file, enable the RCOSC in the power policy of your peripheral project.

    7. Constrain the temperature variation to be less than 1°C/sec in the peripheral project.

  • Hi,

    I am really sorry for my late response. I have an issue and I could not try the steps you said.

    In this week, I had a chance to try it and here are my results;

    As you said, I followed your instructions.

    Your 1. instruction is clear and it is about just simple_pheripheral_oad_offchip_app. I include both .h and .c file from the path you said (right-clicked on the project, pressed the "Add Files" button, selected both files and I also add their paths to project->properties->including path options.

    Your 2. instruction is also clear and it is about just bim. I included the file you said with the way that I explained above. Also, I added the path to project->properties*->including path options

    The 3. instruction is also clear. I added USE_RCOSC in project->properties->predefined option for app and bim.

    I cannot understand your 4. and 5. instructions and I did nothing about that.

    Since I did not use a custom project file, I did not do 6. and 7. instructions.

    With the configuration above, the project can compile without any error but it does not work.

    When I tried it, I cannot see the device on my Bluetooth search list. 

    Could you please verify the steps that I explained above. I tried to follow your steps of course and I could miss something.

  • Hi Dogus,

    Sorry, the code snippets fell out of my previous post:

    4. Add the following code to your peripheral project.c

    #ifdef USE_RCOSC
    #include "rcosc_calibration.h"
    #endif //USE_RCOSC

    5. Add the following code to your peripheralproject_init function in peripheral project.c

    #ifdef USE_RCOSC
    RCOSC_enableCalibration();
    #endif // USE_RCOSC

  • Hi,

    Thank you for your reply.

    Since I used blestack/simple_peripheral_oad_offchip example directly, simple_peripheral_oad_offchip.c file already has  these code parts. 

    I also re-check it now.

    So, my problem still exists.

    Did you try the steps you said above on your board?

    I am just asking. Because, when I try it on launch board, it does not work, the launch board does not advertising. When I tried my configuration (just before opening this issue) on launch board, it worked but it did not work (I mean advertising but not connecting) on my custom board and I thought that the problem was I could not do the configuration well because I observed the problem on 32khz crystal-less device (I mean, my board really does not have the crystal in physically).

    My point is I think we should consider also crystal's hardware effect maybe.

    I do not know, just an idea but my problem still exist unfortunatelly.

  • Hi Dogus,

    I finally have time to help you with this.

    First of all make sure the simple peripheral off-chip oad example from SDK 3.20 works at CC2640R2F Launchpad. Do this exact procedure below.

    1. Enable hex generation for BIM, STACK, APP projects.
    2. Rebuild All BIM, STACK, APP CCS Projects.
    3. Using SmartRF Flash Programmer 2. Select hex files in this order BIM HEX, STACK HEX, APP HEX, then press the right button to flash hex files. After flashing the hex files the CC2640R2F Launchpad, which most likely is a TI SDK Problem. They don't provide procedure how to do this in their documentation.
    4. At SmartRF Flash Programmer 2 un-check BIM HEX, STACK HEX, APP HEX files.
    5. At SmarRF Flash Programmer 2 Browse App OAD BIN file and select it. After that press the right button to flash bin file.

    After step 5. you will be able to see at your BLE Smart Phone App SBP OAD off-chip.

    To enable off-chip oad example program to work without 32 Khz do this below. But I am not sure this works because the CC2640R2F Launchpad has 32 Khz Crystal connected.

    1. Import to CCS simple peripheral example program the non oad example.
    2. From simple peripheral copy files rcosc_calibraton.c and rcosc_calibration.h to simple peripheral off-chip oad Application folder.
    3. From simple peripheral copy file ccfg_app_ble_rcosc.c simple peripheral off-chip oad Startup folder.
    4. At simple peripheral off-chip oad Application folder open rcosc_calibration.c add "#include icall_ble_api.h" see below. Rebuild All simple peripheral off-chip oad app.
    /*********************************************************************
     * INCLUDES
     */
    
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    #include <ti/sysbios/knl/Clock.h>
    
    #include "icall_ble_api.h"
    
    #include "hci.h"
    
    #include "util.h"
    #include "rcosc_calibration.h"

    After modification change at SmartRF Flash Programmer 2 with oad app.bin still selected press the right button to flash the bin file. You will see at your BLE Smart Phone App SBP OAD off-chip.

    Let me know if the procedure works.

    -kel

  • Hi Kel,

    Thank you for your interest first of all.

    I am really sorry because I give bad news all the time.

    I tried what you explained above at the beginning of my issue and I saw this problem with the configuration you explained. I also used this link just lile you did.

    The only difference between you explained and I did, is I cannot remember what is my SDK number at the beginning so I will re-try the example on the launch board directly.

    And the other difference is, I add the 3 "rcosc_..." files in my project by linking, not copying just like you said.

    And finally, I will test my custom-designed board by soldering a 32khz-crystal with a cable outside. If this configuration works (as I said before, my custom-designed card worked with blestack/simple_pheripheral example without 32khz crystal but anyway) then we will really sure about I could not do necessary modifications well and probably I will continue to seek help.

  • I forgot, you need to add the code as suggested by Marie H at peripheral.c

  • Hi Dogus,

    Did you figure it out?

    I will close this thread due to inactivity.