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.

CC2340R5: limit peripheral to connect to only one dedicated central.

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

CC2340R5 configured as peripheral would need to connect it to only one dedicated central (I'm currently using my android phone as central).

I'm exploring ways to prevent the CC2340R5 from connecting to other centrals.

Several options found (not sure what is the best):

  1. Direct advertising - tried to configure CC2340R5 syscfg to direct advertising and set my android BDADDR. 
    result: cc2340R5 is not visible in android phone scanning phase.
  2. Whitelist - can't find suitable example (different chip, old stacks with different API's, example found are for centrals not peripherals).
  3. Accept List - can't find suitable example. (HCI API documentation suggest we can add remove items from the accept list).


    if it helps, currently the CC2340R5 use Public Address mode. Bonding capabilities are "no display no input devices".


    What of the solution above may fit our requirement?
    if possible, please share link to relevant implementation/syscfg configuration examples.

Thanks,
Oren
  • Hi,

    You can use the accept list, in SysConfig localize "Filter Policy" under Advertisement Parameters

    You can add device address to the Accept list with the HCI_LE_AddAcceptListCmd command.

    I hope it will help,
    Tanguy

  • Hi,

    Still not working.
    I Also reversed the byte order of the BLE address.

    Using stack version : f3  74_40_00_64

    Thanks,
    Oren

  • Hi Oren,

    Hope you are doing well. Thank you for looking into this. I believe your central device is a smart phone. By default, smart phones use RPA address modes which change their advertising address every few seconds which may be why we arent able to the advertisement.

    Do you have a second launchpad? As a quick test, I would like to perform the same procedure, but this time with the central being another CC2340R5 device.

    Best Regards,

    Jan

  • Hi Jan,

    Thanks for the info. I created a setup with another cc2340R5 as central,
    using "simple ble project" and configured central's syscfg as public address mode.
    on the peripheral side I changed syscfg advertisement parameters:

    update peer address from aa:aa:aa:aa:aa:aa to central's BLE address.
    update flag Legacy Event Properties Option to Connectable directed.

    using this setup, the feature direct advertisement is working.

    haven't tested yet the HCI commands with this setup.

    regarding flash:
    I will need to save the address at internal flash at dedicated area.
    How can I form dedicated flash area for user data? 
    I tried to use NVS example that write and read at 0x7c000.
    the example work but the values are overwritten by other code later on.
    My guess is the osal_nv function..
    is there a way to separate the flash to several predefine regions?
    One for the osal_nv and other for user data?

    Thanks,
    Oren

  • Hi Oren,

    Glad to see it is working on your side now! You should be able to use NVS to store any data of interest during runtime. In a BLE example, there is already an NVS region defined that is used for bonding information. This region cannot be used for user data. You must define an additional region through sysconfig and place the data there. The NVSinternal example should be a helpful reference.

    Best Regards,

    Jan

  • Hello Jan,

    Thanks,

    regarding the NVS:
    I created using another NVS region with size of one sector 0x800 at address below the already defined region (ie the NVS for bonding info). It seems to work.

    Last thing:
    I am adding watchdog timer (WDT).

    The Watchdog_clear() placed in idle hook function.
    At power-on, It seems to enter there at least once, but then it stops and the WDT expires and reset triggered.
    This behavior continues to loop forever.
    The WDT is set to relatively long time 20 seconds. 

    1/ What is the best WDT practice for TI CC2340R5 + BLE stack F3 7.40.00.64 + FreeRTOS + low power design? where its recommended to place the Clear watchdog function?
     
    2/ In case of CC2340R5 - Does the WDT continue to run during sleep / low power modes / standby policy?
    (it seems that some chips WDT clock stops and at some chips it stays active).

    I suspect that after power on there are two options that may explain what we see:
    2.1 Idle task starvation -> no WDT clear -> reset triggered.
    2.2 Entering sleep -> WDT keep running during sleep/low power ->reset triggered.
     
    Regards,
    Oren

  • Hi Oren,

    The watchdog should be able to operate in standby. It should be possible to add the watchdog refresh to the idle loop, but depending on your application it could also make sense to add it elsewhere. The best place will depend on your application. As mentioned in Table 8-3 Power Mades, the WDT can operate in Active, Idle and Standby:

    I believe for the WDT to run in standby, it must be configured as such.

    I would also suggest referencing the watchdog example included in the SDK as this shows how the watchdog may be used in an application.

    Best Regards,

    Jan

  • Hi Jan,

    Thanks,

    1/
    Regarding the TI example: it's very basic, constructed from one main thread one loop with watchdog_clear().
    I wander if there may be example watchdog + TI FreeRTOS example?

    2/
    We are using FreeRTOS + lowpower sleep configuration. (ie when OS has nothing to do it goes to sleep), so no idle loop.
     
    3/
    Also, as the watchdog operates while the CC2340R5 is in standby mode and we don't wake up until user press button, 
    Is there a way to config the watchdog sleep also during the standby mode and re-run it when device wakes up?

    4/
    How the BLE stack protect itself from hang?
    Does the BLE stack has some sort of hook or dedicated place to place Watchdog clear()?

  • Hi,

    1/
    Regarding the TI example: it's very basic, constructed from one main thread one loop with watchdog_clear().
    I wander if there may be example watchdog + TI FreeRTOS example?

    Currently, that is the only example which comes with the watchdog already implemented. However, you can add the watchdog to any other example in the SDK by using the watchdog example as a reference.

    We are using FreeRTOS + lowpower sleep configuration. (ie when OS has nothing to do it goes to sleep), so no idle loop.

    Understood, if the project never goes into the idle loop, then you will need to add a periodic task or some logic that calls the watchdog_clear() function during program execution to avoid resetting the device.

    Also, as the watchdog operates while the CC2340R5 is in standby mode and we don't wake up until user press button, 
    Is there a way to config the watchdog sleep also during the standby mode and re-run it when device wakes up?

    You may be able to leverage the Power Notify functionality present in the Power driver. This can be used as a callback/notification for when the device changes power states. Information about this may be found here: https://dev.ti.com/tirex/content/simplelink_lowpower_f3_sdk_8_10_01_02/docs/drivers/doxygen/html/_power_8h.html

    How the BLE stack protect itself from hang?
    Does the BLE stack has some sort of hook or dedicated place to place Watchdog clear()?

    I don't believe the BLE5-Stack thread automatically clears a watchdog by itself. A separate task, logic, or periodic event should be added to clear a watchdog (if a watchdog is used). The BLE5-Stack does have some protection against issues to ensure it is able to continue operating (for example if too many ble packets are being queued up, then API functions will return blePending instead until the queue clears up instead of hanging). However, if a significant issue occurs, the BLE5-Stack is expected to hang in an icall_abort.

    Best Regards,

    Jan