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

Advertising on a single channel in nrf51822

hi, i am using sdk 10, with s120.

i want to advertise data on a single channel with frequency say (2426). is there any sample code or something, with which i can play with.

thanks!!

Parents Reply Children
  • i am not able to understand how do i inmplement this. in ble_gap_adv_ch_mask_t structure i found 3 channel as follows

    uint8_t ch_37_off : 1;
    uint8_t ch_38_off : 1;
    uint8_t ch_39_off : 1;
    

    now how should i implement this in my main program. please help me. thanks!!

  • the struct ble_gap_adv_params_t --> ble_gap_adv_ch_mask_t give the option to turn any advertising channel OFF. i am not able to use this in my main program. how can i use this to disable the channel.

  • If you define:

    static ble_gap_adv_params_t m_adv_params;
    static ble_gap_adv_ch_mask_t ch_off;
    

    Then in your advertising_init function you should have something like:

    // Initialize advertising parameters (used when starting advertising).
        memset(&m_adv_params, 0, sizeof(m_adv_params));
    
        m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
        m_adv_params.interval    = NON_CONNECTABLE_ADV_INTERVAL;
    

    You can now just add:

    	ch_off.ch_37_off = 0;
    	ch_off.ch_38_off = 1;
    	ch_off.ch_39_off = 1;
    	m_adv_params.channel_mask = ch_off;
    

    This will only advertise in channel 37

  • hi thanks for your reply, i am able to implement the channel. but when i off any one of these 3 channels then , nrf sniffer dongle is not able to detect my advertisement packet.

    why it is happening I have no idea. can you please explain me why sniffer is not able to detect when i off any one of these 3 channels.

    thanks!!

  • I have used advertising in only one channel and I could detect it with both sniffer and the nRF Master Control Panel. But I do confirm that in the control panel I could see that it takes time to detect the advertisement and also there were missing packets in between. This is expected as the sniffer or the phone search for all three channels in different time slots and might scan the channel you are using in a time that you are not sending anything. Try to reduce the advertisement interval to 100 msec and see what happens (if you are not already less than this). You might also want to double check if you are actually advertising or not? Any error codes in return?

Related