• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF Bluetooth® Low Energy & ANT Forum » scanning and pairing of CC2540 Custom Boards
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

scanning and pairing of CC2540 Custom Boards

scanning and pairing of CC2540 Custom Boards

This question is not answered
Timothy Bauer
Posted by Timothy Bauer
on Aug 20 2012 12:14 PM
Prodigy30 points
We are having trouble Discovering our custom boards. We are able to make our custom board as well as Keyfob in discovered mode as default.  Also we are able to scan, pair and connect the keyfob with USB dongle by using BTool. We can also scan our custom board from USB Dongle with BTool, but unfortunately we are not able to pair the custom board from USB dongle. 

Below are the tests that we've done and the problems that we are facing:

We are working on custom boards with a CC2540 SOC. We paired CC2540 Keyfob from CC2540 usb dongle board, and we programmed usb dongle with CC2540_USBdongle_HostTestRelease_All.hex and Keyfob with CC2540_SmartRF_SimpleBLEPeripheral.hex.  Using this approach, we are able to scan, connect and pair both the device successfully by using BTool.exe.

We tried the same setup with our Custom Board and CC2540 usb dongle, and with this we are able to scan and find our Custom Device from the USB dongle.  however, when we try to establish a link between USB Dongle and Custom Board, the BTool.exe application displays the device info for a fraction of second and it disappears, so we are not able to go to next step, 'pairing'.

We also tried to scan and pair the custom devices to each other. We programmed one board with SerialApp project and other with SerialAppCentral and tried to scan the one from the other, the modification that we made in the code is
In serialAppCentral_Main.c from SerialAppCentral project is as follows

int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();

// Initialize board I/O
InitBoard( OB_COLD );

/* Initialze the HAL driver */
HalDriverInit();

/* Initialize NV system */
osal_snv_init();

/* Initialize LL */

/* Initialize the operating system */
osal_init_system();

/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();

// Final board initialization
InitBoard( OB_READY );

#if defined ( POWER_SAVING )
//osal_pwrmgr_device( PWRMGR_BATTERY );
osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
#endif

simpleBLEScanning = TRUE;
simpleBLEScanRes = 0;

uint8 addrType;
uint8 *peerAddr;

GAPCentralRole_StartDiscovery( DEFAULT_DISCOVERY_MODE,
DEFAULT_DISCOVERY_ACTIVE_SCAN,
DEFAULT_DISCOVERY_WHITE_LIST );

if ( simpleBLEScanRes > 0 )
{

// connect to current device in scan result
peerAddr = simpleBLEDevList[simpleBLEScanIdx].addr;
addrType = simpleBLEDevList[simpleBLEScanIdx].addrType;

simpleBLEState = 1;//BLE_STATE_CONNECTING;


GAPCentralRole_EstablishLink( DEFAULT_LINK_HIGH_DUTY_CYCLE,
DEFAULT_LINK_WHITE_LIST,
addrType, peerAddr );
}
#endif 
/* Start OSAL */
osal_start_system(); // No Return from here

return 0;
}

We added the lines that shows in bold Italics. Once we starts to debug the code we found that it is not able to scan the other BLE module, simpleBLEScanRes shows Zero.

To make the Custom Board in Discovered mode, we modified SerialApp Project as follows.
In SerialApp Project, serialAppPeripheral.c file, within the function SimpleBLEPeripheral_Init()

We changed uint16 gapRole_AdvertOffTime = 1 from 0

Also,
added  GAP_UpdateAdvertisingData() in the function GAPRole_SetParameter() in peripheral.c :

case GAPROLE_ADVERT_DATA:

if ( len <= B_MAX_ADV_LEN )
{VOID osal_memset( gapRole_AdvertData, 0, B_MAX_ADV_LEN );
VOID osal_memcpy( gapRole_AdvertData, pValue, len ) ;
// Update the advertising data
GAP_UpdateAdvertisingData( gapRole_TaskID,TRUE, B_MAX_ADV_LEN, gapRole_AdvertData );
we would like to know that whether we are going in right way? or is there any alternate approach to do the pairing of our custom board with Each other?

Thanks and Regards
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Eng351
    Posted by Eng351
    on Aug 21 2012 13:57 PM
    Expert2980 points

    Hi Timothy,

    The structure of your code is a long way from working.

    The CC2540 is a single threaded processor, and the TI stack and app run using a non pre-emptive OS (i.e. a prioritized task loop).

    You should not be putting any code inside main.c - it should all run inside your app task. Your task should not block for more than a few ms when you are using the BLE interface.

    Also, you cannot expect GAPCentralRole_StartDiscovery() to provide valid results on the very next line of code. The stack needs to process for several seconds and will trigger an event once it is complete.

    You will need to read the software developers guide and read through the example code and understand how the examples work before modifying. The API is also an essential document here.


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use