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

Set public address(MAC) without BLE stack

I am trying to write a radio code without using BLE stack here i was able to write down code for initialization of radio and was advertising some random packets. But how should i debug to know that am i advertising correctly or not. I tried to use sniffer for debugging but it was not able to detect it as i have not setted any public address(MAC addr). Do anybody have any idea how to set public address without using BLE stack. So that i can see adv packets on sniffer for that device. Or you know any other technique to debug the code, in-short to validate what i am doing correctly.

Parents
  • Hi,

    You can see how it is done in advertiser_beacon.c in the hrs_advertiser example from SDK 8.1. ("..\examples\experimental_ble_app_multiactivity_beacon\hrs_advertiser....") Particularly the radio configuration part should be interesting.

    If you have a spectrum analyzer or a software defined radio available you can check the spectrum for any impact when transmitting, note that this might be difficult due to WiFi or other in-band noise. Hopefully this answers your question.

    Best regards,

    Øyvind

  • Hi again,

    You can implement the sd_ble_gap_adress_get() without using the BLE stack like this:

    // BLE_GAP_ADDR_TYPE_RANDOM_STATIC = 1.
        beacon_init.beacon_addr.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
        beacon_init.beacon_addr.addr[0] = (uint8_t)NRF_FICR->DEVICEADDR[0];
        beacon_init.beacon_addr.addr[1] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>8);
        beacon_init.beacon_addr.addr[2] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>16);
        beacon_init.beacon_addr.addr[3] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>24);
        
        beacon_init.beacon_addr.addr[4] = (uint8_t)NRF_FICR->DEVICEADDR[1];
        //2 MSBit must be '11' for RANDOM_STATIC, see Corespec v4.0, Vol 3, Part C, chapter 10.8
        beacon_init.beacon_addr.addr[5] = (uint8_t)(NRF_FICR->DEVICEADDR[1]>>8) | 0xC0;
    

    Hopefully this answers your question

Reply
  • Hi again,

    You can implement the sd_ble_gap_adress_get() without using the BLE stack like this:

    // BLE_GAP_ADDR_TYPE_RANDOM_STATIC = 1.
        beacon_init.beacon_addr.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
        beacon_init.beacon_addr.addr[0] = (uint8_t)NRF_FICR->DEVICEADDR[0];
        beacon_init.beacon_addr.addr[1] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>8);
        beacon_init.beacon_addr.addr[2] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>16);
        beacon_init.beacon_addr.addr[3] = (uint8_t)(NRF_FICR->DEVICEADDR[0]>>24);
        
        beacon_init.beacon_addr.addr[4] = (uint8_t)NRF_FICR->DEVICEADDR[1];
        //2 MSBit must be '11' for RANDOM_STATIC, see Corespec v4.0, Vol 3, Part C, chapter 10.8
        beacon_init.beacon_addr.addr[5] = (uint8_t)(NRF_FICR->DEVICEADDR[1]>>8) | 0xC0;
    

    Hopefully this answers your question

Children
No Data
Related