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.

CC2640R2F: Pairing stops working after creating a task

Part Number: CC2640R2F

I noticed when I create a task in simpleBLE peripheral project I can't pair anymore. Has anyone seen this issue before ?

Thanks,
Mario

  • Can you elaborate how you create a task and what you do inside the task? You can also refer to sunmaysky.blogspot.com/.../how-to-create-new-task-in-ti-rtos-to.html which shows how to create a task.
  • Hi Mario,

    Can you check the status of the task stacks and the heap when the pairing fails? You can use the Heap Manager to see if the heap has any fails ( dev.ti.com/.../ble-index.html )
  • Hi Marie,

    this may be a dumb question but what function would I use to check for heap issues? Would HEAPMGR_SANITY_CHECK() be the right function?
    If so where would I call it to check for failure?

    Thanks,
    Mario
  • Hi Mario,

    Please see the link I posted for directions n how to use the Heap Manager to check the heap.
  • This is my what I do to create the task:

    Task_Params taskParams;

    // Configure task
    Task_Params_init(&taskParams);
    taskParams.stack = TaskStack;
    taskParams.stackSize = SBP_TASK_STACK_SIZE;
    taskParams.priority = SPI_TASK_PRIORITY;

    Task_construct(&spiTask, ATMELcomm_taskFxn, &taskParams, NULL);

  • Hi Marie,

    Here's my screenshot for the heap details(I'm using IAR). to be honest the isntructions for troubleshooting Heap are not very clear. Does "remainSize" mean I didn't go over my heap size?

    Thanks

    Mario

  • Hi Mario,

    Can you enable the heap manager as described in the link I posted?
  • Hi Marie,

    I enabled the heap manager by adding HEAPMGR_METRICS to the defined processor symbols.
    But what function can I use?

    I tried the following code and I got a linking error:

    #include <xdc/cfg/global.h> // This is included to access cfg file variables

    //...

    // Get the HeapSize
    ICall_heapStats_t stats;
    ICall_getHeapStats(&stats);

    if((HEAPMGR_CONFIG & 0x03) == 0x00)
    {
    Display_print0(dispHandle, 6,0, "Using Heap: OSAL");
    }
    else if ((HEAPMGR_CONFIG & 0x03) == 0x01)
    {
    Display_print0(dispHandle, 6,0, "Using Heap: HeapMem");
    }
    else if((HEAPMGR_CONFIG & 0x03) == 0x02)
    {
    Display_print0(dispHandle, 6,0, "Using Heap: HeapMem + HeapTrack");
    }

    Error[Li005]: no definition for "ICall_getHeapStats" [referenced from C:\ti\simplelink_cc2640r2_sdk_1_35_00_33\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashOnly_OAD_ImgB\Obj\


    Thanks,
    Mario
  • Hi Mario,

    I find the easiest is pausing the debugging session and adding the heapmgr global variable to the watched expressions (heapmgrBlkFree, heapmgrMemAlo, heapmgrMemMax, heapmgrMemFail etc).

    If heapmgrMemFail > 0 you probably have a heap issue.
  • Hi Marie,

    After adding heapmgrMemFail and pausing each time after pairing is attempted I can see that the count is going up each time so I'm getting memory allocation failures. So now the question is what can I do about it?

    Can I increase the size of the heap? 

    Also, I am using SDK 1.35.00.33.

    Thanks,

    Mario

  • Hi Mario,

    Check out this app note: www.ti.com/.../swra537.pdf
  • Hi Marie,

    Thanks for that app note. I made a lot of progress. I used AUX RAM as RAM and I'm not getting heap memory allocation failures anymore, however I encountered one new issue. I can only run my application when I run it through my debugger. As soon as I disconnect my debugger and power cycle my board it doesn't advertise anymore. If I use start a debugging session then it works fine.

    Any ideas why?

    btw I'm using the cc2640r2 OAD build configuration so I don't know if that makes any difference.

    Thanks,

    Mario

    EDIT:

    If I flash my device using Btool then it boots up so it must be tied to debug code. This might have existed the whole time and not related to AUX RAM. 

  • Hi Mario,

    Did you remember to flash the BIM project onto your device?