USB configuration

Hi
I have a question regarding USB port on the nrf52840 device
When connecting a new device to computer is it possible to tell PC
to assigne the same COM port number as last Nordic device connected ?

Regards
Olav

Parents
  • Hi Olav

    Unfortunately this is controlled by the host (PC), and you can't influence this from the device side. 

    There is some more information in this thread.

    Depending on how you are connecting to the comport from the host side, it might be possible to refer to the product name rather than the comport number. The product name should stay the same even if the comport number changes. 

    Best regards
    Torbjørn

  • Thanks,

    We'll look into the explanation and hints in the thread

    However, is it possible to alter some of the variables in the USB
    descriptor in order to make two devices look "identical" ?

    Hence computer will enumerate the same COM port each time ?

    /**
     @brief Default device descriptor initializer @ref app_usbd_descriptor_device_t
    * */
    #define APP_USBD_CORE_DEVICE_DESCRIPTOR  {                                                                               
       .bLength = sizeof(app_usbd_descriptor_device_t),                     /* descriptor size */                            
       .bDescriptorType = APP_USBD_DESCRIPTOR_DEVICE,         /* descriptor type */                            
       .bcdUSB = APP_USBD_BCD_VER_MAKE(2,0,0),                        /* USB BCD version: 2.0 */                       
       .bDeviceClass = 0,                                                                               /* device class: 0 - specified by interface */   
       .bDeviceSubClass = 0,                                                                       /* device subclass: 0 - specified by interface */
       .bDeviceProtocol = 0,                                                                           /* device protocol: 0 - specified by interface */
       .bMaxPacketSize0 = NRF_DRV_USBD_EPSIZE,                          /* endpoint size: fixed to: NRF_DRV_USBD_EPSIZE*/
       .idVendor = APP_USBD_VID,                                                             /* Vendor ID*/                                   
       .idProduct = APP_USBD_PID,                                                           /* Product ID*/                                  
       .bcdDevice = APP_USBD_BCD_VER_MAKE(                                /* Device version BCD */
           APP_USBD_DEVICE_VER_MAJOR,                                                                                                          
           APP_USBD_DEVICE_VER_MINOR,                                                                       
           APP_USBD_DEVICE_VER_SUB),                                                                        
       .iManufacturer = APP_USBD_STRING_ID_MANUFACTURER,   /* String ID: manufacturer */                   
       .iProduct = APP_USBD_STRING_ID_PRODUCT,                          /* String ID: product */                         
       .iSerialNumber = APP_USBD_STRING_ID_SERIAL,                    /* String ID: serial */                          
       .bNumConfigurations = 1                                                                     /* Fixed value: only one configuration supported*/
    }

    Kind regards

    Olav

Reply
  • Thanks,

    We'll look into the explanation and hints in the thread

    However, is it possible to alter some of the variables in the USB
    descriptor in order to make two devices look "identical" ?

    Hence computer will enumerate the same COM port each time ?

    /**
     @brief Default device descriptor initializer @ref app_usbd_descriptor_device_t
    * */
    #define APP_USBD_CORE_DEVICE_DESCRIPTOR  {                                                                               
       .bLength = sizeof(app_usbd_descriptor_device_t),                     /* descriptor size */                            
       .bDescriptorType = APP_USBD_DESCRIPTOR_DEVICE,         /* descriptor type */                            
       .bcdUSB = APP_USBD_BCD_VER_MAKE(2,0,0),                        /* USB BCD version: 2.0 */                       
       .bDeviceClass = 0,                                                                               /* device class: 0 - specified by interface */   
       .bDeviceSubClass = 0,                                                                       /* device subclass: 0 - specified by interface */
       .bDeviceProtocol = 0,                                                                           /* device protocol: 0 - specified by interface */
       .bMaxPacketSize0 = NRF_DRV_USBD_EPSIZE,                          /* endpoint size: fixed to: NRF_DRV_USBD_EPSIZE*/
       .idVendor = APP_USBD_VID,                                                             /* Vendor ID*/                                   
       .idProduct = APP_USBD_PID,                                                           /* Product ID*/                                  
       .bcdDevice = APP_USBD_BCD_VER_MAKE(                                /* Device version BCD */
           APP_USBD_DEVICE_VER_MAJOR,                                                                                                          
           APP_USBD_DEVICE_VER_MINOR,                                                                       
           APP_USBD_DEVICE_VER_SUB),                                                                        
       .iManufacturer = APP_USBD_STRING_ID_MANUFACTURER,   /* String ID: manufacturer */                   
       .iProduct = APP_USBD_STRING_ID_PRODUCT,                          /* String ID: product */                         
       .iSerialNumber = APP_USBD_STRING_ID_SERIAL,                    /* String ID: serial */                          
       .bNumConfigurations = 1                                                                     /* Fixed value: only one configuration supported*/
    }

    Kind regards

    Olav

Children
Related