Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to handle Time Consuming Function Calls in Application Having SoftDevice?

Hello everybody,

I am working on a nRF52832 DK  and implemented libuarte (on a nRF52832) to communicate with another uC on said board.
I am using sdk 17.0.2. The goal is to receive data from the other uC and transmit it via BLE to a connected device using notifications/Indication via Characteristics.

I need To handle some state application handle functions that consume more time in execution. I'm not aware of where to call these functions, so that softdevice communication timing remain maintained.  Currently, I'm calling these functions in idle_state_handle(); and i'm not pretty sure that it is correct way to call here.

Parents
  • Thanks for reply Jørgen Holmefjord,

    nRF52832 stuck at "NRF_BREAKPOINT_COND;" and get hanged when sending data via  libuarte continuously..so I just want to know the proper place to call "nrf_libuarte_async_tx()"  function or how to handle Continuous sending routine, so that I am able to send data without processor reset.

    void Send_Uarte_Data(uint8_t  msg[], size_t length)
    {
        ret_code_t err_code;         
        err_code = nrf_libuarte_async_tx(&libuarte, msg,length);
        APP_ERROR_CHECK(err_code);
        bsp_board_led_invert(1);
    
    }
    static void idle_state_handle(void)
    {
        
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
        if(sendUart)
        {
            uint8_t test_Text[]="Button_Pressed.\r\n";
            Send_Uarte_Data(test_Text,sizeof(test_Text));
            sendUart =0;
        }
    }
    /**@brief Application main function.
     */
    int main(void)
    {
        //bool erase_bonds;
    
        //Initialize.
        uart_init();
        log_init();
        timers_init();
        //User_timer_Init(APP_TIMER_MODE_REPEATED,user_timer_handle);
    
        //buttons_leds_init();
        bsp_configuration();
    
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        //Start execution.
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }

Reply
  • Thanks for reply Jørgen Holmefjord,

    nRF52832 stuck at "NRF_BREAKPOINT_COND;" and get hanged when sending data via  libuarte continuously..so I just want to know the proper place to call "nrf_libuarte_async_tx()"  function or how to handle Continuous sending routine, so that I am able to send data without processor reset.

    void Send_Uarte_Data(uint8_t  msg[], size_t length)
    {
        ret_code_t err_code;         
        err_code = nrf_libuarte_async_tx(&libuarte, msg,length);
        APP_ERROR_CHECK(err_code);
        bsp_board_led_invert(1);
    
    }
    static void idle_state_handle(void)
    {
        
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
        if(sendUart)
        {
            uint8_t test_Text[]="Button_Pressed.\r\n";
            Send_Uarte_Data(test_Text,sizeof(test_Text));
            sendUart =0;
        }
    }
    /**@brief Application main function.
     */
    int main(void)
    {
        //bool erase_bonds;
    
        //Initialize.
        uart_init();
        log_init();
        timers_init();
        //User_timer_Init(APP_TIMER_MODE_REPEATED,user_timer_handle);
    
        //buttons_leds_init();
        bsp_configuration();
    
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
        //Start execution.
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }

Children
No Data
Related