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

How to advertise with nRF52810 in order to be seen by BT4

Dear Sirs,

How to advertise with nRF52810 (peripheral mode) in order to be seen by BT4 devices (Smartphones)?

Is it necessary to make a special configuration (settings)? If yes, where can I find an example?

I try to use

with S112 softdevice
In addition, I spent hours(days) to make run a simple advertisement, without any success.
The example I use requires usage of your board with LEDs an buttons.
BTW, all your examples are very hard to understand and are very complex... Even for a simple functionality  Frowning2
On my PCB board, I have no buttons and LEDs and I cannot initialise services as you make in your example...
Could you give us a SIMPLE example, without complex event handlers, LEDS and buttons, with a minimum initialization?
I would like only be seen from a smartphone, giving only basic info as device name and product series number, nothing more...
Thank you in advance for your help
Cordially yours
Andre
Parents
  • Hi,
    You don't need any additional configurations for a BLE supported smartphone to scan for advertising peripherals. On the other hand, that means that every device which supports BLE can scan for the peripheral, not just the smartphone if whitelist and directected advertising is not used. You can use directed advertising and whitelist if you only want to advertise to a device with a specific address. 
    A good start point for developing BLE examples is our template example in the SDK. You can find it at YourSDK\examples\ble_peripheral\ble_app_template. I would also encourage you to read our tutorials on BLE, which explains how to setup advertising, services, whitelist etc. You can find them here.
    Best regards
    Jared 
  • Thank you very much for your reply.

    Unfortunately, your SDK examples are very complex and hard to understand, using event handlers, LEDS, buttons etc.

    On my PCB board I have not LEDS and buttons.

    I have already tried with your SDK example, I have even began with it, but I could not understand it.

    It is my reason to ask you a simpler one.

    It MUST work on my custom board, not on your proprietary board...

    I need a an example of advertising with a minimum initialization and without communication (no services), not depending of hardware.

    Is it possible?

    Cordially yours

    Andre

  • Again, our tutorials is a good starting point for understanding how to use the Softdevice. 

    A custom board would require a new board file that maps the pins accordingly to your custom board. More info can found here.

  • Dear Jared,

    I really do not understand your position.

    Two times I asked you for simpler example. I KNOW and USE your current SDK examples.

    Before ask you anything, I had already read your tutorials. Several times, but could not deeply understand them.

    Or they are not good, or I am an imbecile...  Frowning2

    I use custom board without LEDS and buttons, so your example from SDK is not adapted at all for me....

    However, I try to use your SDK example, but I get run time errors.

    Even if your example works with your board, it seems to bee very problematic with the custom board because of missing of LEDS, buttons and its event handlers.

    In general, your examples use too much functionalities at the same time, so they are too hard to understand.

    I repeat, I need a SIMPLE example of advertisement, without any communication, witout LED & button usage.

    So, could you help me or not?

    Could you have a look on my code?

    BTW, what is happened with my code I had added to my post  yesterday?

    I will add it once more...

    Cordially

    Andre

    My initialization sequence:

                    ble_stack_init();                    
                    gap_params_init();                
                    gatt_init();
                    services_init();
                    advertising_init();
                    //conn_params_init();
                    

                    // Start execution
                    advertising_start();
                    for (;;);        // debug break   

    Unfortunately the conn_params_init()  function gives an error (value 3, internal error).

    I do not know what it means.

    Is it possible to start advertisement without this initialization?

    This function is copied from your SDK example, only with light modification of error management (no LEDS but UART)



    /**@brief Function for initializing the Connection Parameters module.
     */
    static void conn_params_init(void)
    {
            printf("nRF52: conn_params_init\r\n");
            nrf_delay_ms(200);
        
        ret_code_t             err_code;
        ble_conn_params_init_t cp_init;

        memset(&cp_init, 0, sizeof(cp_init));

        cp_init.p_conn_params                  = NULL;
        cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
        cp_init.next_conn_params_update_delay  = NEXT_CONN_PARAMS_UPDATE_DELAY;
        cp_init.max_conn_params_update_count   = MAX_CONN_PARAMS_UPDATE_COUNT;
        cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
        cp_init.disconnect_on_fail             = false;
        cp_init.evt_handler                    = on_conn_params_evt;
        cp_init.error_handler                  = conn_params_error_handler;

        err_code = ble_conn_params_init(&cp_init);
        //APP_ERROR_CHECK(err_code);
            if (err_code!=NRF_SUCCESS)
            {
                printf("nRF52: conn_params_init ERROR %d\r\n", err_code);
                nrf_delay_ms(200);    
                return;
            }
            printf("nRF52: conn_params_init done\r\n");
            nrf_delay_ms(200);
    }

Reply
  • Dear Jared,

    I really do not understand your position.

    Two times I asked you for simpler example. I KNOW and USE your current SDK examples.

    Before ask you anything, I had already read your tutorials. Several times, but could not deeply understand them.

    Or they are not good, or I am an imbecile...  Frowning2

    I use custom board without LEDS and buttons, so your example from SDK is not adapted at all for me....

    However, I try to use your SDK example, but I get run time errors.

    Even if your example works with your board, it seems to bee very problematic with the custom board because of missing of LEDS, buttons and its event handlers.

    In general, your examples use too much functionalities at the same time, so they are too hard to understand.

    I repeat, I need a SIMPLE example of advertisement, without any communication, witout LED & button usage.

    So, could you help me or not?

    Could you have a look on my code?

    BTW, what is happened with my code I had added to my post  yesterday?

    I will add it once more...

    Cordially

    Andre

    My initialization sequence:

                    ble_stack_init();                    
                    gap_params_init();                
                    gatt_init();
                    services_init();
                    advertising_init();
                    //conn_params_init();
                    

                    // Start execution
                    advertising_start();
                    for (;;);        // debug break   

    Unfortunately the conn_params_init()  function gives an error (value 3, internal error).

    I do not know what it means.

    Is it possible to start advertisement without this initialization?

    This function is copied from your SDK example, only with light modification of error management (no LEDS but UART)



    /**@brief Function for initializing the Connection Parameters module.
     */
    static void conn_params_init(void)
    {
            printf("nRF52: conn_params_init\r\n");
            nrf_delay_ms(200);
        
        ret_code_t             err_code;
        ble_conn_params_init_t cp_init;

        memset(&cp_init, 0, sizeof(cp_init));

        cp_init.p_conn_params                  = NULL;
        cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
        cp_init.next_conn_params_update_delay  = NEXT_CONN_PARAMS_UPDATE_DELAY;
        cp_init.max_conn_params_update_count   = MAX_CONN_PARAMS_UPDATE_COUNT;
        cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
        cp_init.disconnect_on_fail             = false;
        cp_init.evt_handler                    = on_conn_params_evt;
        cp_init.error_handler                  = conn_params_error_handler;

        err_code = ble_conn_params_init(&cp_init);
        //APP_ERROR_CHECK(err_code);
            if (err_code!=NRF_SUCCESS)
            {
                printf("nRF52: conn_params_init ERROR %d\r\n", err_code);
                nrf_delay_ms(200);    
                return;
            }
            printf("nRF52: conn_params_init done\r\n");
            nrf_delay_ms(200);
    }

Children
Related