Is there some way to get the device number via serial I/O

While chaining is an option, I’d prefer to use a separate USB line to each SMC that I have. That being the case, each has a unique serial port (the easy part), but I don’t see a way to get the device number to identify the board for a given virtual COM port.

I am doing this on Windows 10 on a Raspberry Pi. It sees the serial port without issue or effort. I don’t want to port libusb to the Raspberry Pi to use your USB samples. (I only see Wintel builds which makes me seriously wonder whether I wouldn’t have to do a full rewrite to use the new APIs.)

If there is a way to query the device number via a command/variable (command A1), I cannot find it. (Note that I have been known to be blind as a bat.)

Thanks in advance,
Ed

Hello, Ed.

I have not tried Windows 10 IoT Core for the Raspberry Pi, but normally Windows assigns a unique COM port number to each Simple Motor Controller. The assigned COM port number is associated with the device’s serial number, so the same controller will always be assigned to the same COM port no matter which USB port you plug it into. You should be able to use that to know which device you are talking to based on its COM port name. For example, your program could be configured to know that “COM4” always corresponds to controller number 1, and “COM5” always corresponds to controller number 2. Would that be good enough for your application?

Another option is to use the Pololu Protocol to send a serial command requesting data from the Simple Motor Controller. If you get a response, you know that the device number you used in the serial command was correct. If you don’t get a response after some amount of time, you know that the device number was wrong and you can try a different one.

–David

It might assign a COM port number, but the API is really setup to use a ‘selector id’ (basically the PnP address. I haven’t really tried to see if the address is a PnP address (which would preclude same address all the time) or some ‘other’ scheme which might be stable.

Second option is possible. I’ll have to figure out how to implement a timeout so I know when I’ve got the wrong controller. Should be possible though.

I’ll chew on this a while (and see what I have to implement tonight).

Thanks,
Ed