is that possible to send the peripheral device data to bluetooth less desktop over ble

Hello,

In my project, I want to send the data from the ble device nrf52832 dev kit to a connected in-built Bluetooth desktop/PC. Some desktop doesn't have inbuilt Bluetooth and for that, so I used a third-party dongle(TP link dongle) that provides Bluetooth capability to Bluetooth-less desktop. I scanned the peripheral devices with a third-party dongle same as the in-built desktop/PC Bluetooth. next, successfully send the data from the peripheral device to the desktop/PC. but i want to develop a custom dongle to send/receive the data from peripherals devices as well as it provides Bluetooth capability to Bluetooth less desktop/PC.

I have tried the nrf52840 dongle and most of them say that it's not recommended for development and even it didn't provide any Bluetooth capability to the desktop as in-built. using nrf connect desktop app we can scan and connect the device but i need the same as the in-built Bluetooth.

So please let me know how can i achieve this.

Thank You. 

Parents
  • Hello,

    If you want a Bluetooth dongle for a bluetooth-less desktop/PC, it needs to contain a certain firmware. This firmware is Bluetooth HCI (Host Controller Interface) over USB. If the dongle doesn't contain this, then the computer will not be able to use it as a Bluetooth dongle. 

    However, if you want to add more functionality into this dongle, thus changing the FW to no longer be pure HCI, the computer will no longer see it as a Bluetooth dongle, so I don't think what you describe is possible.

    It is however possible to use a Bluetooth HCI dongle for what you want to, but it requires some sort of application running on your PC. But if I understand you correctly, you have already accomplished this?

    Best regards,

    Edvin

  • Hello,

    so I don't think what you describe is possible.

    So it's not possible to scan the peripheral devices and send the data from the peripheral to a central device that is connected to a Bluetooth-less desktop.

    But how TP link Bluetooth adapter can achieve this.? in their website they give some drivers for pc. will it work for all,?

    I didn't try hci example so can I try that once to get an idea? or its not suitable for my application.

    Thank You

  • Hello,

    After this, I tried to debug the nrf52840 dev kit which has the code of the dongle and i got SOFTDEVICE: INVALID MEMORY ACCESS.

    See my point is my dongle code doesn't have any problem because if I use the ble_app_uart example on my peripheral device it is get connected to my dongle.

    but when I use the ble_app_hids_keyboard example then only it is not connected. so now I am confused about which side have to debug. I just added ble_app_uart to the ble_app_hids_keyboard example to enable the NUS service to it. but now it is not connecting to my dongle. 

    my dongle is working fine with ble_app_uart. so tell how can I debug it.?

    Thank You. 

  • Hello,

    The ble_app_uart and the ble_app_hids_keyboard are two completely different applications. The fact that one works on the dongle doesn't mean that the other one does. And since you don't have any output, it is difficult for me to say whether it is at all running, or if it is just the central that you are using that doesn't try to connect to it, because the advertisements doesn't match the central's scanning filters.

    When you compile the ble_app_hids_keyboard. Did you set the dongle as the target board? Do you see it if you scan for it in nRF Connect for Mobile/Desktop -> Bluetooth Low Energy?

    Best regards,

    Edvin

  • Hello,

    Thank You so much..!!,

    Yes, now it's working I can able to push the data from ble_app_hids_keyboard to the dongle also.

    I think most of the things are completed finally I have only one requirement whatever the data I received at the dongle and add hid examples to it and print the data in Notepad. 

    is this possible to do it on the dongle side.??

    Thank You

  • That requires you to have an application running on your computer saving the incoming data to a .txt file. I don't think you will be able to make the dongle print directly into notepad.

  • Hello,

    Can't we do it with usbd_hid_coposite example.??

    then how  \examples\ble_peripheral\ble_app_hids_keyboard  examples can do that.?? i did this already with my peripheral device.

    when I connect my peripheral device to my phone/PC i can directly write the data notepad.

Reply Children
  • In that case it would act as a keyboard, yes. Then you need to read the incoming data, and translate it into keyboard presses. You can do that.

  • Hello,

    so that is possible with dongle right.

  • Yes, but I advice that you do the development on a DK, where you have a debugger, and then port it over to the dongle when you are done.

  • Hello,

    Thanks for the reply,

    let me try and update you,

  • Hello,

    I tried to add usbd_hid_composite example to ble_app_uart_c example and i got this error,

    <info> app: drv_clock_init:133
    
    <error> app: ERROR 133 [NRF_ERROR_MODULE_ALREADY_INITIALIZED] at C:\NFC_NRF\nRF5_SDK_17.1.0_ddde560\examples\ble_central\ble_app_uart_c - Copy\main.c:862
    PC at: 0x0002E939

    so cross-checked in main.c I didn't find any reinitialization. but in nrf_drv_clock.c of usbd_hid_composite this code is  not visible,

    static void clock_irq_handler(nrfx_clock_evt_type_t evt)
    {
        if (evt == NRFX_CLOCK_EVT_HFCLK_STARTED)
        {
            m_clock_cb.hfclk_on = true;
            clock_clk_started_notify(NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
        }
        if (evt == NRFX_CLOCK_EVT_LFCLK_STARTED)
        {
            m_clock_cb.lfclk_on = true;
            clock_clk_started_notify(NRF_DRV_CLOCK_EVT_LFCLK_STARTED);
        }
    #if CALIBRATION_SUPPORT
        if (evt == NRFX_CLOCK_EVT_CTTO)
        {
            nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item);
        }
    
        if (evt == NRFX_CLOCK_EVT_CAL_DONE)
        {
            nrf_drv_clock_hfclk_release();
            bool aborted = (m_clock_cb.cal_state == CAL_STATE_ABORT);
            m_clock_cb.cal_state = CAL_STATE_IDLE;
            if (m_clock_cb.cal_done_handler)
            {
                m_clock_cb.cal_done_handler(aborted ?
                    NRF_DRV_CLOCK_EVT_CAL_ABORTED : NRF_DRV_CLOCK_EVT_CAL_DONE);
            }
        }
    #endif // CALIBRATION_SUPPORT
    }
    
    #ifdef SOFTDEVICE_PRESENT
    /**
     * @brief SoftDevice SoC event handler.
     *
     * @param[in] evt_id    SoC event.
     * @param[in] p_context Context.
     */
    static void soc_evt_handler(uint32_t evt_id, void * p_context)
    {
        if (evt_id == NRF_EVT_HFCLKSTARTED)
        {
            m_clock_cb.hfclk_on = true;
            clock_clk_started_notify(NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
        }
    }
    NRF_SDH_SOC_OBSERVER(m_soc_evt_observer, CLOCK_CONFIG_SOC_OBSERVER_PRIO, soc_evt_handler, NULL);
    
    /**
     * @brief SoftDevice enable/disable state handler.
     *
     * @param[in] state     State.
     * @param[in] p_context Context.
     */
    static void sd_state_evt_handler(nrf_sdh_state_evt_t state, void * p_context)
    {
        switch (state)
        {
            case NRF_SDH_EVT_STATE_ENABLE_PREPARE:
                NVIC_DisableIRQ(POWER_CLOCK_IRQn);
                break;
    
            case NRF_SDH_EVT_STATE_ENABLED:
                CRITICAL_REGION_ENTER();
                /* Make sure that nrf_drv_clock module is initialized */
                if (!m_clock_cb.module_initialized)
                {
                    (void)nrf_drv_clock_init();
                }
                /* SD is one of the LFCLK requesters, but it will enable it by itself. */
                ++(m_clock_cb.lfclk_requests);
                m_clock_cb.lfclk_on = true;
                CRITICAL_REGION_EXIT();
                break;
    
            case NRF_SDH_EVT_STATE_DISABLED:
                /* Reinit interrupts */
                ASSERT(m_clock_cb.module_initialized);
                nrfx_clock_enable();
    
                /* SD leaves LFCLK enabled - disable it if it is no longer required. */
                nrf_drv_clock_lfclk_release();
                break;
    
            default:
                break;
        }
    }
    
    NRF_SDH_STATE_OBSERVER(m_sd_state_observer, CLOCK_CONFIG_STATE_OBSERVER_PRIO) =
    {
        .handler   = sd_state_evt_handler,
        .p_context = NULL,
    };
    

    but its visible in ble_app_uart_c example so did I make any mistake here. please let me know.

    Thank You.

Related