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
  • Unfortunately, your SDK examples are very complex

    Unfortunately, Bluetooth is not simple!

    https://devzone.nordicsemi.com/f/nordic-q-a/42551/nrfgo-studio-dont-detect-my-nrf52840/165776#165776

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

    I would strongly recommend that you start on a Nordic board - it will be far easier to learn and gain familiarity & understanding in that way.

    Once you have gained sufficient familiarity & understanding, then you will be in a position to move on to a custom board.

    This is exactly why all manufacturers - not just Nordic - make development/evaluation/demo boards!

  • I can only repeat my post I sent to Jared...

    I understand the necessity of  your demo board, I used it for my first codes a year ago.

    Now I have the pre-manufacturing prototype board (without LEDS, without buttons), so how to make working your SDK example on this board?

    I have never said, that your example does not work on your demo board!!!

    I really do not understand your position.

    Two times I asked you for a simpler example. Nothing more...

    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...  

    I use custom board without LEDS and buttons, so your example from SDK is not quite adapted 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, without LED & button usage.

    So, could you help me or not?

    Could you have a look on my code?


    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);
    }

  • Event handlers are necessary to receive events from the Softdevice. You can't use it without them. If you don't want to modify the board file you can just remove every reference to it in the main file. It should work without it.  0x03 returned from the ble_conn_params_init() is NRF_ERROR_INTERNAL, which may indicate that the bug is before the function call. ble_conn_params_init() is necessary first once you connect to the central. 

  • Dear Jared,

    Thank you very much for your reply.

    I am simply trying to strip unnecessary code. Relaxed

    My board works (advertises) well, and I use, of course, my custom board file, but without LEDS and GPIOS used by your examples...

    I was talking about GPIO event handler, not about event handlers in general...

    It seems, I have to use services_init() function before advertising, I do not understand why (I do not use any service). Otherwise I get run time error from also from advertising_init function.

    Maybe I am wrong, I will check it once more...

    Concerning error, I have copied all initialization functions from your example, so I do not understand the bug...

    However, I have removed conn_params_init(), since I do not need the connection at this moment.

    I would like simply to know, when such error occurs (if I plan to use connection in future).

    Cordially yours

    Andre

  • Hi,

    • What error is thrown? 
    • I may have misunderstood your intention, if you're not going to make a connection in the future, then I strongly suggest that you to start with the beacon example instead.

    Jared 

Related