This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52832 mac address filtering - updating the address, and scan intervals

hello Nordic

i am using nrf52832, sdk 16.0, s132 v7.01

i am scanning for ble beacon but i want to be able to change the filtered mac address (i still want to filter by mac address, but the mac will change from time to time and i need to reconfigure that)

i am working on the central ble_app_blinky example ()developed a lot of code above it but still.. what's the best way to do that 

can i just recall the 

nrf_ble_scan_filter_set(..)

and the  .. nrf_ble_scan_filters_enable(..)

do i need to stop the ble scan before reconfiguring ? will that be enough ?

another question is about scanning intervals of a beacon (no pairing to be established at this point)

if i understood correctly, then if the defined "SCAN_INTERVAL" is the same as the defined "SCAN_WINDOW", then the system is scanning all the time (pls confirm), if that's the case then theoretically i should not miss any message, but in fact messages sent to me every 1 second are sometimes lost (now i know the bigger the interval between each advertise the lesser the chance that i will catch the message, but its projects demands). so what is the meaning of scanning all the time?  if the scanning stops every time a message is detected even if it is not from the mac address i am filtering, for how long does it stops and can i improve that somehow to increase my chance to catch all the messages, every one second ?

best regards

Ziv 

Parents
  • Hi ziv, 

    Could you show the code where you change the filtered MAC address ? 
    Please note that if you call nrf_ble_scan_filter_set() it will add the address to the list and if you don't have big enough list (NRF_BLE_SCAN_ADDRESS_CNT) you will receive an error: NRF_ERROR_NO_MEM

    If you want to replace the old addresses with new ones, I would suggest to call nrf_ble_scan_all_filter_remove() before you add the new addresses. 

    Regarding your 2nd question, it's correct that if you set scan window = scan interval you will have 100% duty cycle and scan all the time (unless you do something else, for example connection, advertising). Please try using a long enough interval, if you use short interval (for example, few ms) the switching time between each cycle would cause disruption when you can scanning for long period. 
    We are talking about wireless communication here, so there will be interference and there won't be guarantee of 100% that you will receive all the packets you sent. There are many RF protocols working in the same bandwidth, including wifi and other BLE devices around. 
    What's the error rate you are seeing ?

Reply
  • Hi ziv, 

    Could you show the code where you change the filtered MAC address ? 
    Please note that if you call nrf_ble_scan_filter_set() it will add the address to the list and if you don't have big enough list (NRF_BLE_SCAN_ADDRESS_CNT) you will receive an error: NRF_ERROR_NO_MEM

    If you want to replace the old addresses with new ones, I would suggest to call nrf_ble_scan_all_filter_remove() before you add the new addresses. 

    Regarding your 2nd question, it's correct that if you set scan window = scan interval you will have 100% duty cycle and scan all the time (unless you do something else, for example connection, advertising). Please try using a long enough interval, if you use short interval (for example, few ms) the switching time between each cycle would cause disruption when you can scanning for long period. 
    We are talking about wireless communication here, so there will be interference and there won't be guarantee of 100% that you will receive all the packets you sent. There are many RF protocols working in the same bandwidth, including wifi and other BLE devices around. 
    What's the error rate you are seeing ?

Children
No Data
Related