52833 esb+usbd use together issue

I use SDK17.10, when I send radio data using the esb,At this time, insert the usb, it takes a long time to enumerate the usb successfully;  when I disable the esb,I plugged in the usb and soon the enumeration was successful.I wonder what causes USB enumeration to be slow?  I used nrf52833DK board to do the experiment

Parents Reply
  • Hi

    Interesting. It should be possible to enter sleep, even when using USB. The critical thing is that you make sure to run app_usbd_event_queue_process() as long as it returns true, before you can go to sleep. 

    The snippet below is from one of the USB examples in the SDK:

        while (true)
        {
            while (app_usbd_event_queue_process())
            {
                /* Nothing to do */
            }
            
            if(m_send_flag)
            {
                static int  frame_counter;
    
                size_t size = sprintf(m_tx_buffer, "Hello USB CDC FA demo: %u\r\n", frame_counter);
    
                ret = app_usbd_cdc_acm_write(&m_app_cdc_acm, m_tx_buffer, size);
                if (ret == NRF_SUCCESS)
                {
                    ++frame_counter;
                }
            }
            
    
            UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
            /* Sleep CPU only if there was no interrupt since last loop processing */
            __WFE();
        }

    Best regards
    Torbjørn

Children
Related