1
\$\begingroup\$

In our system, we want to plug more than 50 devices that have PIC1846j50, connected through USB serial COM port to a computer. We are experiencing that the computer does not recognize more than 44 PIC devices. But it recognizes other CDC devices beyond that 44 devices. We tried different computers and operating systems (Win7 and Win10). What I realized is that our devices do not have SerialNumber to inform the computer about that, or the USB capabilities are different. I compared (using UsbTreeVeiw app) the PIC81F Serial Port with an STM32L CDC COM Port:

for PIC81F: "Capabilities : 0x84 (Removable, SurpriseRemovalOK)"

for STM32L: "Capabilities : 0x94 (Removable, UniqueID, SurpriseRemovalOK)"

So, my device does not have either this capability of UniqueID or Serial number, or they are tied to each other. I could not understand if these are the settings that must be set in the MCU or the computer driver, or both. Following is the piece of code I have, and I added a few lines to add the serial number. But it seems it is not set properly or not transmitted to computer. The computer does not show this serial number.

Can you help me to fix the problem either by setting the serial number or change this limit on the computer?

Inside usb_descriptors.c file in MPLAB:

//Language code string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409}};

//Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[25];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'M','i','c','r','o','c','h','i','p',' ',
'T','e','c','h','n','o','l','o','g','y',' ','I','n','c','.'
}};

//Product string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[25];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'H','H','M','S',' ','W','e','a','r','a','b',
'l','e',' ','M','o','n','i','t','o','r','i','n','g','.'}
};
// This is what I added:
//Serial string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[10];}sd003={
sizeof(sd003),USB_DESCRIPTOR_STRING,
{"0123456789"}
};

And I just added sd003 to the following code:

//Array of string descriptors
ROM BYTE *ROM USB_SD_Ptr[USB_NUM_STRING_DESCRIPTORS]=
{
    (ROM BYTE *ROM)&sd000,
    (ROM BYTE *ROM)&sd001,
    (ROM BYTE *ROM)&sd002,
    (ROM BYTE *ROM)&sd003
};

And, I changed the serial number string index from 0x00 to 0x03:

/* Device Descriptor */
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
    0x12, // Size of this descriptor in bytes
    USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
    0x0200, // USB Spec Release Number in BCD format
    CDC_DEVICE, // Class Code
    0x00, // Subclass code
    0x00, // Protocol code
    USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_config.h
    0x04D8, // Vendor ID
    0x000A, // Product ID: CDC RS-232 Emulation Demo
    0x0100, // Device release number in BCD format
    0x01, // Manufacturer string index
    0x02, // Product string index
    0x03, // Device serial number string index
    0x01 // Number of possible configurations
};

Apart from the above solution or question, is there any way to increase/remove this limit on computer? Is it the USB proliferation issue?

Thanks

\$\endgroup\$
3
  • \$\begingroup\$ Use something (maybe sudo lsusb -v -v under Linux) which lets you read out the actual descriptors sent. If it's not showing up there, you may need to read/debug deeper into the USB stack. Note that while issues setting the serial number may be on topic, how a host operating system deals with an abnormal number of devices is not an Electronic Design question, but a question about that particular operating system. \$\endgroup\$ Nov 12 '20 at 16:27
  • \$\begingroup\$ Thanks for your reply. I used a tiny Raspberry Pi device (running linux) and it could detect all ports. But, once I connect the same hardware with the same number of devices connected to it, Windows detects a maximum of 44 devices. I do not know how could I remove this limit on Windows. \$\endgroup\$ Nov 19 '20 at 15:23
  • \$\begingroup\$ That would seem to make this a Windows question and so off topic here. \$\endgroup\$ Nov 19 '20 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.