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

Question about burning firmware to USB Dongle

Hi,

I have a project based on the NUS (Nordic Uart Service) example.

I have bought a USB dongle MDBT50Q-RX manufactured by RAYTAC (https://www.raytac.com/product/ins.php?index_id=89), but I am not sure how to deploy my application to it. I would like to see if there is anyone here have experience on USB dongle which could give me some suggestion or guide.

At first, I just insert the USB dongle to the PC's USB. The PC can recognize the USB (Image 1) but nrf Connect for Desktop application (latest version, i.e. nRF Connect v3.3.1, Programmer v1.4.1) said the device does not support (Image 2), tested on both Mac OS and Windows.


(Image 1)


(Image 2)

Afterward I found these blog pages:
raytaccorp.blogspot.com/.../burn-your-firmware-onto-mdbt50q-rx-that.html
raytaccorp.blogspot.com/.../firmware-coding-dfu-onto-mdbt50q-rx.html

So I tried to wired with J-Link, I am able to burn my firmware either through SEGGER Embedded Studio > Target > Download ble_app_uart_c_pca10056_s140 or nrf Connect for Desktop. Just like other devices I previously used.
(Image 3, Sample of the dongle connected with J-Link RTT Viewer can view the NRF_LOG properly)


(Image 3)

However after burned and insert the dongle to PC, the COM port does not appear (Image 4).

(Image 4)

Am I missing something like incorrect setting?


Thank you very much.
Joe

  • Hi Joe

    Can you confirm which SDK example you are basing your project on?

    The ble_app_uart example does not configure the USB interface, and if you flash this firmware into your dongle it will not enumerate as a USB device. 

    The usbd_ble_uart example combines the USBD CDC example (virtual comport) with the ble_app_uart, and should work on the dongle: \nRF5_SDK_16.0.0\examples\peripheral\usbd_ble_uart example 

    Best regards
    Torbjørn

  • Hi Torbjørn

    Thank you for your reply.

    I am using SDK 16.0.0.
    I have tried your suggested example "usbd_ble_uart" and my PC (windows) can detect the USB dongle as a COM port device (COM24).

    My goal is to use the dongle as a NUS (Central side) connect to the PC, so it can receive data from another BLE device which is NUS (Peripheral side).
    The data transfer flow is only one way from Peripheral --(BLE)--> Central --(USB)--> PC
    Before using the dongle, my original project "ble_app_uart_c" (under examples\ble_central) and "ble_app_uart" (under examples\ble_peripheral) works correctly on two Development board.

    So I tried to combine the sample project "usbd_ble_uart" to the central project "ble_app_uart_c".
    With the combined code, the PC can detect the dongle, but the BLE no longer connect to the peripheral.

    Here is the main function of my combined code as sample:

    int main(void)
    {
        ret_code_t ret;
        static const app_usbd_config_t usbd_config = {
            .ev_state_proc = usbd_user_ev_handler
        };
        // Initialize.
        log_init();
        timer_init();
        uart_init();
        //uarte_init();
        buttons_leds_init();
    
        app_usbd_serial_num_generate();
    
        ret = app_usbd_init(&usbd_config);
        APP_ERROR_CHECK(ret);
    
        app_usbd_class_inst_t const * class_cdc_acm = app_usbd_cdc_acm_class_inst_get(&m_app_cdc_acm);
        ret = app_usbd_class_append(class_cdc_acm);
        APP_ERROR_CHECK(ret);
    
        db_discovery_init();
        power_management_init();
        ble_stack_init();
        gatt_init();
        nus_c_init();
        scan_init();
    
        // Start execution.
        printf("BLE UART central example started.\r\n");
        NRF_LOG_INFO("BLE UART central example started.");
        scan_start();
    
        ret = app_usbd_power_events_enable();
        APP_ERROR_CHECK(ret);
    
        // Enter main loop.
        for (;;)
        {
            while (app_usbd_event_queue_process())
            {
                /* Nothing to do */
            }
            idle_state_handle();
        }
    }

    If I comment out the while (app_usbd_event_queue_process()) part, the PC cannot detect the USB dongle as a COM port device, but the it can connect to the BLE Peripheral.

        // Enter main loop.
        for (;;)
        {
    //        while (app_usbd_event_queue_process())
    //        {
    //            /* Nothing to do */
    //        }
            idle_state_handle();
        }

    I have spent for 2 days for this problem.
    Is there any hints for me to solve it?

    Best Regards
    Joe

  • Hi

    After many tries, I finally can receive the data through BLE and COM port detected by the PC.

    So the next step I have to send out the buffer data.
    As the dongle doesn't have UART, I think I have to send the data through the USB D+/D- pin to PC?

    So my question is:
    1. Shall I send the data through the app_usbd_cdc_acm_write(&m_app_cdc_acm, &data_buffer, data_len)?
    2. How should I initialize the pin setting?
    The pin for D+/D- are 35/34 repectively, so shall I set CDC_ACM_DATA_EPIN to 35 and CDC_ACM_DATA_EPOUT to 34?

    APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
    cdc_acm_user_ev_handler,
    CDC_ACM_COMM_INTERFACE,
    CDC_ACM_DATA_INTERFACE,
    CDC_ACM_COMM_EPIN,
    CDC_ACM_DATA_EPIN,
    CDC_ACM_DATA_EPOUT,
    APP_USBD_CDC_COMM_PROTOCOL_AT_V250);

    Thank you
    Joe

  • Hi Joe

    Sorry for the slow response. 

    It's good to hear that you got some progress on your end. 

    sdtjoe said:
    1. Shall I send the data through the app_usbd_cdc_acm_write(&m_app_cdc_acm, &data_buffer, data_len)?

     Yes. This function can be used to send data to the USB host from the nRF device. The CDC example that you're linking to can be used as a reference for this. 

    sdtjoe said:
    2. How should I initialize the pin setting?

     You don't have to select the pin when using USBD, since the USBD interface has dedicated pins on the chip that can  not be used for any other purpose. 

    The CDC_ACM_DATA_EPIN and CDC_ACM_DATA_EPOUT defines sets the USB endpoints (EPIN means EndPoint IN), not the pins, and have to be values in the 0-5 range. I would recommend just using the same values as the CDC example, and not change these defines. 

    Best regards
    Torbjørn

Related