This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

regarding "ble_app_hrs_rscs_relay"

Hi. I'm using PCA10028, SDK10.0.0 S130.

I think "ble_app_hrs_rscs_relay" provides Central function and Peripheral function. So it should be advertising right after running program.

I just added code as below to get bd address of nRF51 on PCA10028 board.

int main(void) {

......

ble_gap_addr_t	 addr;
ble_gap_addr_t * p_addr = &addr;
err_code = sd_ble_gap_address_get(p_addr);
if(err_code==0){
	printf("address :");
}
int i;
for(i=0;i<6;i++)
{
	printf(" %x", p_addr->addr[i]);
}
printf("\n\r");

...... }

It returns "90 ee 62 e8 c7 f9", but I can't find this bd address at Cetral device. I'm sure the Central Device is OK because it shows me other device's bd address.

Is this sample code advertising? I hope your reply.

  • FormerMember
    0 FormerMember

    The advertised MAC address is the device address stored in NRF_FICR->DEVICEADDR[], this post explains how to retrieve the BLE address from NRF_FICR->DEVICEADDR[] and how it is generated.

    Update 09.03.16: The application will start to scan and advertise immediately when running the example, see main():

    int main(void)
    {
        ...
        ...
        /** Start scanning for peripherals and initiate connection to devices which
         *  advertise Heart Rate or Running speed and cadence UUIDs. */
        scan_start();
    
        // Turn on the LED to signal scanning.
        LEDS_ON(CENTRAL_SCANNING_LED);
    
        // Start advertising.
        err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
        APP_ERROR_CHECK(err_code);
    
        for (;;)
        {
            // Wait for BLE events.
            power_manage();
        }
    }
    
  • Thanks. But linked post shows me ble_app_hrs_rscs_relay() function makes me get MAC address as well. Anyway I used NRF_FICR->DEVICEADDR[]. Then the result was same.

    printf("DEVICEADDR :");
    for(i=0;i<2;i++)
    {
    	printf(" 0x%08x", NRF_FICR->DEVICEADDR[i]);
    }
    printf("\n");
    bd_address[0]=((NRF_FICR->DEVICEADDR[0]>>0)&0xff);
    bd_address[1]=((NRF_FICR->DEVICEADDR[0]>>8)&0xff);
    bd_address[2]=((NRF_FICR->DEVICEADDR[0]>>16)&0xff);
    bd_address[3]=((NRF_FICR->DEVICEADDR[0]>>24)&0xff);
    bd_address[4]=((NRF_FICR->DEVICEADDR[1]>>0)&0xff);
    bd_address[5]=((NRF_FICR->DEVICEADDR[1]>>8)&0xff)|0xC0;
    printf("bd address :");
    for(i=0;i<6;i++)
    {
    	printf(" %x", bd_address[i]);
    }
    

    The result is DEVICEADDR : 0xe862ee90 0xff8cb9c7 bd address : 90 ee 62 e8 c7 f9 My question is that "Does ble_app_hrs_rscs_relay example code start advertising right after code running?" I hope your reply. Thanks.

  • FormerMember
    0 FormerMember in reply to FormerMember

    Yes, the example will start to advertise immediately when running, see updated answer.

  • I found what problem is. My Central supports 3 types of SCAN mode. Limited/Generic/Observation

    Normally I use Generic scan. So I couldn't find it.

    When I change scan type to Observation, I can find this device.

    I really want to know "how can I find it when I scan Generic mode"?

  • FormerMember
    0 FormerMember in reply to FormerMember

    I am not sure what kind of scanning modes you mean, this answer explains the various scanning modes.

Related