Setting the USB CDC-ACM Serial Number at Runtime

If I have an application where I have implemented USB CDC-ACM, how can I set the serial number seen by the PC when I connect my device? Is it possible to set it at runtime?

Parents
  • Hi,

    Normally the serial number is set on boot, e.g.: 

    USBD_DESC_SERIAL_NUMBER_DEFINE(sample_sn); 
        err = usbd_add_descriptor(&sample_usbd, &sample_sn);
        if (err) {
            LOG_ERR("Failed to initialize SN descriptor (%d)", err);
            return NULL;
        }

    I guess it's potentially possible to manipulate it if you want to.

    Kenneth

  • I imagine I need to call this function before enabling USB, or can I call it at any time?

    Also, I noticed that your example uses the USB device stack (usbd*), while I am currently using usb*. In fact, for enabling USB, I use usb_enable instead of usbd_enable. Does that make any difference?

    While we're at it, what is the difference between using usb_enable and usbd_enable?

Reply Children
Related