RDB1768cmsis_usb_serial multiple units on a single PC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RDB1768cmsis_usb_serial multiple units on a single PC

1,554 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Wed Dec 07 05:44:25 MST 2011
I have implemented the RDB1768cmsis_usb_serial in my code but now I need to connect two different LPC1768 end units to the same PC being recognized as two different serial ports.  Currently I get two instances with the same serial port.

I think I could could change in the main_serial.c file the abDescriptors but I do not know which fields I can adjust.

I most likely would need to adjust the usbser.inf file for the adjusted unit.

Anybody can give me a little help?
0 Kudos
Reply
5 Replies

1,545 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Wed Dec 14 06:23:20 MST 2011

Quote: kiryat8
Since I am the sole real time programmer at a very small company, I do not have the resources or time to go over the whole USB 2.0 documentation



SSDD :eek:

If you look at my posting history you will see that there are months that I hardly post anything but there are also weeks where I am a heavy user of this forum. This depends on how busy this one-man team is with running projects.

The good thing is that seeing a posting like your triggered me that I have a similar problem which I never bothered to look at (until now). I managed to get a working USB keyboard implementation by just hacking together the USB examples from Betrik (thankfully ported to LPCXpresso by Code Red) and scanning through teh USB spec. I never bothered to read the full spec.
I also never bothered to look at the stuff I did not understand - I had no idea what the DEADCODE thing was in the USB code but I just left it there since I gathered it does have some use ...
thanks to your question, my search through the USB spec to look up iSerialNumber and your answer I now know what it is for :D.

Now all I need to do is to look at the USB in order to place this serial in EEPROM as a configuration parameter instead of placing it in program flash.

Thanks,[INDENT]Rob
[/INDENT]
0 Kudos
Reply

1,545 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Wed Dec 14 05:57:24 MST 2011
Since I am the sole real time programmer at a very small company, I do not have the resources or time to go over the whole USB 2.0 documentation which I see is  (.zip file format, size 13.7 MB). This is the plain truth. I never have time to reinvent the wheel so I hoped someone else on the forum had already experienced the same situation I had.

I used the standard Code Red LPC170xx USB stack example to build on.
Since you say that the iSerialNumber field indexes a string descriptor field.
Three is used in their example, so it must be the last string.
I reverted to the original example code with iSerialNumber as 3 on my main LPC end unit.
I changed my secondary LPC end unit's last letter of the last string
"DEADCODE" to "DEADCODF".
Now I get my desired results.
Both units are assigned by Windows a different serial channel but this channel is the same even when moving the units to different USB ports.

Since we never need to have right now more than one unit of the same type connected to a single PC, this is just great.
If we would need multiple units of the same type, I will just put 0 in the iSerialNumber and then they will be USB port dependant.

Thanks
David

Original Code:

    // string descriptors
    0x04,
    DESC_STRING,
    LE_WORD(0x0409),

    0x0E,
    DESC_STRING,
    'L', 0, 'P', 0, 'C', 0, 'U', 0, 'S', 0, 'B', 0,

    0x14,
    DESC_STRING,
    'U', 0, 'S', 0, 'B', 0, 'S', 0, 'e', 0, 'r', 0, 'i', 0, 'a', 0, 'l', 0,

    0x12,
    DESC_STRING,
    'D', 0, 'E', 0, 'A', 0, 'D', 0, 'C', 0, '0', 0, 'D', 0, 'E', 0,

    // terminating zero
    0
};
0 Kudos
Reply

1,545 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Wed Dec 14 03:25:37 MST 2011
It helps when you know what you are doing ...

I don't :eek: ...
But I still managed to get my HID/Keyboard device configured with a little help from the USB spec.
I have not done this myself so I hope I'm telling it right...

The iSerialNumber is, according to the USB 2.0 spec, an index of string descriptor. So the 3 tells me the serial number is the third string descriptor, meaning that instead of changing the 3 itself you need to change the string descriptor.

Please let me know if this information was helpful (I do need this also but I am currently not able to try this myself).

Regards,[INDENT]Rob
[/INDENT]
0 Kudos
Reply

1,545 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kiryat8 on Wed Dec 14 00:10:42 MST 2011
Thank you.
I set the iSerialNumber to zero on both LPC end unit devices and Windows 7 sets a different com port for each USB port. It does not matter which end device is connected to an USB port, it always gets the same serial port number.
This is OK. When I set one LPC device's iSerialNumber to 0x3 and the other to 0x4 and connected both, I got both connected to the same serial port.
I would have rather had that each LPC device would have its own specific serial port no matter which USB it is connected. This is what happens when I connect a single LPC device with the iSerialNumber set to 0x03.

Thanks
0 Kudos
Reply

1,545 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by stalisman on Thu Dec 08 09:05:01 MST 2011
This could be due to both your devices having the same serial number.  In the Device Descriptor there is a field 'iSerialNumber' (offset 16).  During development it is safest to keep this as 0x00, then Windows will itself determine that you have multiple units on different ports.

If the value != 0x00 then the values must be unique to each unit else windows will get into an unknown state trying to figure how the same unit can be on two different ports at the same time.
0 Kudos
Reply