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

NRF52840 DK - Connecting to Windows with x2 different dev boards results in the same COM port being assigned

The issue:

1) Program x2 NRF52840 dev boards 

2) comment board A to windows, windows reports COM n

3) unplug board A and connect board B

4) windows reports the same COM port as board A

5) I have to have x2 boards connected to the same PC in order to test an NRF52840 based product, each board is switched on/off independently so 

 

Is there any way of programming a unique serial number into the NRF52840 Dev board for the USB serial device so windows assign a different Com Port for each device?

Please note I am using the correct port (the one on the side), Serial comms is working OK its just that all boards appear as the same number when connected.

  • No problem, I appreciate your help.  We are on V16.0.0 of the SDK. I have got as far as:

    1) Call app_usbd_serial_num_generate().  This generates a serial number and copies it to  g_extern_serial_number

    2) This works OK,  g_extern_serial_number is referenced by several #defines, eventually ends up being mapped to #define APP_USBD_STRING_ID_SERIAL 

    3) #define APP_USBD_STRING_ID_SERIAL is referenced inside app_usbd_core.c, this library being enabled with #define APP_USBD_ENABLED (which I have done)

    3) Inside app_usbd_core.c #define APP_USBD_CORE_DEVICE_DESCRIPTION references define APP_USBD_STRING_ID_SERIAL along with many other USB configuration parameters.

    So, having created a unique serial number in step 1) how do I use the library functions in app_usbd_core.c to update the USB serial number on the driver?

  • I agree that it is a bit difficult to see how/where it is used, but I believe it is something like:

    app_usbd_core_event_handler()

    case APP_USBD_EVT_DRV_SETUP:

    app_usbd_core_setup_req_handler()

    setup_device_req_std_handler()

    setup_device_req_get_descriptor()

    app_usbd_string_desc_get()

    app_usbd_prepare_string()

    m_string_dsc[], which uses 

    APP_USBD_STRING_SERIAL

    which is defined as g_extern_serial_number, 

    which is set by app_usbd_serial_num_generate().

    Have you checked that this behavior is replicateable on several computers? As mentioned, I do not see the same behavior on my Windows 10 machine. Each nRF has different COM ports, which stay the same accross power cycles.

    BR,
    Edvin

  • That's what I have, though to get it to build I had to declare "extern int g_extern_serial_number[]" in app_usbd_string_desc,c to avoid a compiler error.  g_extern_serial_number is not defined as extern in any header file.

    I'm looking at speading the tests which use the Dongle accross several PC's to avoid the port conflict issue.

Related