Serial number for each USB ACM device

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there,

 

I just finised up with a program that can control a dynamixel motor and read out a tempsensor on two different virtual serial ports (LUFA: Dual Virtual Serial).

Now to start the dynamixel you have to say in the roslauch file which com/acm port it is connected. And because this can change from time to time, you need to change the com/acm port en build the code over and over again.

With the help of the Serial number of the device, the pc/ros-side can find the com/acm port automatically. 

 

The problem is that the Serialnumber doesnt split up in a serail number for each USB ACM device. So what I have is one Serial Number and two devices.

Is there a way to give each interface/device a Serial number?

 

Thanks in regards!

This topic has a solution.
Last Edited: Fri. Jul 27, 2018 - 10:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JPdeRie wrote:
you need to change the com/acm port en build the code over and over again

Eh?!

 

Why on earth would you do an entire rebuilt just to change serial ports?!

 

surprise

 

Surely, you would just provide this as a command-line option, or in a configuration file, or somesuch??

 

JPdeRie wrote:
Is there a way to give each interface/device a Serial number?

There must be a way - that's how FTDI devices manage to always show up on the same COM number under Windows.

 

But is there any way to query it ... ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many of the microcontrollers with HW USB support also contain a unique serial number off in the signature memory or similar.  (16u2 has it, 32u4 apparently doesn't.)

This is frequently inconveniently formatted for many applications (like trying to get the 24 non-vendor bits of an ethernet MAC Address), but the USB Serial Number is a text string and can be almost anything...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So if i understand this correctly from my coworker, when you use the command

udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0)

you can see all the information thats given over the com/acm port.

With that you can use one of the ATTRS stings to identify the device. But this only works for KERNEL: 6-1 and not for KERNEL: 6-1:1.0

The only thing I need is that ACM0 and ACM1 can give something like

ATTRS{serial}=="123456789"

 

but I dont see anything in descriptors or the interface-config to set this 

 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So in descriptors.h you have and enumstruct that look lie this if you have 2 interfacese

 

enum InterfaceDescriptors_t

{

INTERFACE_ID_CDC1_CCI = 0, /**< CDC1 CCI interface descriptor ID */

INTERFACE_ID_CDC1_DCI = 1, /**< CDC1 DCI interface descriptor ID */

INTERFACE_ID_CDC2_CCI = 2, /**< CDC2 CCI interface descriptor ID */

INTERFACE_ID_CDC2_DCI = 3, /**< CDC2 DCI interface descriptor ID */

};

 

The CCI ID is something that you can change to whatever you liek for each com/acm port.

With this I can connect the roslaunch to the com/acm port

 

Thank you all!