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.

CC2652R: Calling GapScan_enable crashes application

Part Number: CC2652R

I am working with the cc26x2 sdk using the multi-role example on the CC2652R Launchpad. In this sample code you can press a button on the launch pad to initiate a device discovery and then connect to a device to read its characteristics.

I am trying to add RS232 communications to trigger this scanning process but for some reason it crashes the application.

I have added a second uart to the application and can send commands over this Uart. One I send the start scan command, the application generates an event that gets processed in the

multi_role_processAppMsg()

function in the same way the hardware key button presses are processed. But When my even calls the 

multi_role_doDiscoverDevices

the application crashes. I have traced it down to the GapScan_enable() call and within this call it seems to crash when it called 

icall_directAPI at this function

  ICall_sendServiceMsg(ICall_getEntityId(), service,
                       ICALL_MSG_FORMAT_DIRECT_API_ID, &(liteMsg.msg));

Since I am calling multi_role_doDiscoverDevices from within the application thread I do not understand why its crashing. Can anyone shed some light onto this?

  • Hi Shawn,

    What version of the SimpleLink CC26x2 SDK are you using?

    If you want to use a two-device approach (Host-Controller), why not start with the host test example?
  • I am using simplelink_cc26x2_sdk_2_30_00_34

    Turns out my issue was when I posted the message to process the UART message, the call to ICALL_free at the end of the multi_role_processAppMsg function was causing heap corruption. This was a pain to figure out.

    Are you suggesting I implement the HCI protocol that BTool uses? That seems like a lot of work on the host side. Our Host micro is processing a lot of CAN messages and other wireless communications so it does not have a lot of free cycle time to handle all the BLE processes. I was hoping to use the CC2652 to handle most of the BLE functions and leave the host to simply send simple control messages.

    Maybe this is the wrong approach. I guess I should look into this a bit more.

    Shawn
  • Shawn,
    Happy to hear you figured it out.
    Sounds like your'e on the right track if your Host micro is limited on resources.