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

Merging nRF52 blinky into uart for peripheral as well as central role.

I'm merging nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_blinky\pca10040\s132\ses to nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_uart\pca10040\s132\ses, but getting error. Also, I want to merge nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_blinky_c\pca10056\s140\ses to nRF5_SDK_17.0.2_d674dde\examples\ble_central\ble_app_uart_c\pca10056\s140\ses. Can anybody help me? or If their already merged then it will be benefit.

Please find below error screenshot,

Parents
  • Hi,

    I don't think we have any ready examples that merges ble_app_blinky and ble_app_uart.

    If you can upload your project here, then I will take a look at what's missing.

  • Hi,

    Please find below link to download the project:

    https://smetgroup-my.sharepoint.com/:u:/g/personal/megha_choudhari_mysmindia_com/ESMV-B9MJLdEvC0eyhJ2ghgBXCsVIT4OQg3A2CFfrWDq9w?e=lYWprR

    Added comments with //03/05/21 for easy understanding of changes, I have merged - 

    1. ble_peripheral - ble_app_blinky into ble_app_uart

    2. ble_central -  ble_app_blinky_c into ble_app_uart_c 

    Now both project builds successfully but enable to connect ble_app_uart to ble_app_uart_c. Also, the advertising, connection LED status not visible.

    Checked in debug mode both goes to NRF_BREAKPOINT_COND; in app_error_weak.c file

    Looking forward for your reply.

    Regards,

    Megha Choudhari

  • MeghaC said:

    What will be the changes required in central side. Can you just check in same sdk & let me know.

     For the central, the first steps to get it to connect is:
    in sdk_config.h set these:

    NRF_BLE_SCAN_NAME_CNT to 1
    NRF_SDH_BLE_VS_UUID_COUNT to 2

    You then will get this in the log:
    <warning> nrf_sdh_ble: Change the RAM start location from 0x20002A38 to 0x20002A48.
    <warning> nrf_sdh_ble: Maximum RAM size for application is 0x3D5B8.

    So you need to set these values for the linker:

    RAM_START=0x20002A48
    RAM_SIZE=0x3D5B8

  • Hi,

    Done changes suggested on central side also, now peripheral getting connected with central device. Please find below screenshot for your reference.

    But when I'm pressing button from peripheral the LED from central should turn ON. This is not happening.

    I have added all necessary logic from ble_app_blinky to ble_app_uart & from ble_app_blinky_c to ble_app_uart_c.

    If I missed out anything, kindly suggest me. My sdk is already with you. I have maked peripheral as nRF52832 DK & central as nRF52840 DK.

    Waiting for your reply.

    Thanks for your valuable guidance.

    Regards,

    Megha Choudhari

  • Hi, 

    Also I have observed while debugging that the when switch pressed from peripheral it again goes to NRF_BREAKPOINT_COND;

    Why it so?

    Regards,

    Megha Choudhari

  • MeghaC said:

    But when I'm pressing button from peripheral the LED from central should turn ON. This is not happening.

     I took a look at the code, in db_disc_handler() you need to add ble_lbs_on_db_disc_evt(&m_ble_lbs_c, p_evt); , so that the function looks like this:

    /**@brief Function for handling database discovery events.
     *
     * @details This function is a callback function to handle events from the database discovery module.
     *          Depending on the UUIDs that are discovered, this function forwards the events
     *          to their respective services.
     *
     * @param[in] p_event  Pointer to the database discovery event.
     */
    static void db_disc_handler(ble_db_discovery_evt_t * p_evt)
    {
        ble_nus_c_on_db_disc_evt(&m_ble_nus_c, p_evt);
        ble_lbs_on_db_disc_evt(&m_ble_lbs_c, p_evt);
    }

     

    MeghaC said:

    Also I have observed while debugging that the when switch pressed from peripheral it again goes to NRF_BREAKPOINT_COND;

     This did not happen when I tested here. Maybe this will be resolved when you fix the db_disc_handler() function.

  • Hi,

    Have a nice day!!!!!

    Sorry to revert you late.

    I have done changes in db_disc_handler(); as suggested. But still while pressing button from peripheral no LED indication observed on central board. Please find below link for video:

    https://smetgroup-my.sharepoint.com/:v:/g/personal/megha_choudhari_mysmindia_com/EevKoIF0g0FHsMoe2dRAIvkBKJLytnGN5S9IfelY2uSQmw?e=IdAL1P

    Also, I have checked with in main.c added just to check on button press goes to button_event_handler(); or not. But its goes to NRF_BREAKPOINT_CONDITION;

    /**@brief Application main function.
     */
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        log_init();
        uart_init();
        leds_init();  //03/05/21     
        timers_init();
        buttons_init(); //03/05/21
    //    buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
           //ble_nus_data_send(&m_nus,"SMET\r\n",5,m_conn_handle);
           if(LEDBUTTON_BUTTON == true)
           {
            bsp_board_led_on(LEDBUTTON_LED);
           }
        }
        
       
    }
    
     

    If it's working at your side, Can you resend me that sdk?

    Regards,

    Megha Choudhari

Reply
  • Hi,

    Have a nice day!!!!!

    Sorry to revert you late.

    I have done changes in db_disc_handler(); as suggested. But still while pressing button from peripheral no LED indication observed on central board. Please find below link for video:

    https://smetgroup-my.sharepoint.com/:v:/g/personal/megha_choudhari_mysmindia_com/EevKoIF0g0FHsMoe2dRAIvkBKJLytnGN5S9IfelY2uSQmw?e=IdAL1P

    Also, I have checked with in main.c added just to check on button press goes to button_event_handler(); or not. But its goes to NRF_BREAKPOINT_CONDITION;

    /**@brief Application main function.
     */
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        log_init();
        uart_init();
        leds_init();  //03/05/21     
        timers_init();
        buttons_init(); //03/05/21
    //    buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        // Start execution.
        printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
           //ble_nus_data_send(&m_nus,"SMET\r\n",5,m_conn_handle);
           if(LEDBUTTON_BUTTON == true)
           {
            bsp_board_led_on(LEDBUTTON_LED);
           }
        }
        
       
    }
    
     

    If it's working at your side, Can you resend me that sdk?

    Regards,

    Megha Choudhari

Children
Related