2
\$\begingroup\$

Say I have several microcontrollers connected serially over several COM ports. I want to identify which microcontroller is on which port. Say, μC1 is on COM1 and μC2 is on COM2.

Is there any industry-standard, or at least widely accepted, method for sending an ID request and receiving an ID response? Something like:

CPU: "IDENT" --> COM1
GPU: "IDENT" --> COM2
COM1: μC1 --> "1"
COM2: μC2 --> "2"

And we now know μC1 is on COM1 and μC2 is on COM2.

Thank you!

\$\endgroup\$
4
  • 1
    \$\begingroup\$ This is why we invented USB. \$\endgroup\$
    – Jeroen3
    Jun 10, 2020 at 6:58
  • \$\begingroup\$ Popular protocol in my field is SCPI (Standard Commands For Programmable Instruments), not sure if it applies to your field. \$\endgroup\$
    – Rokta
    Jun 10, 2020 at 7:38
  • \$\begingroup\$ How about you connect to each of them, send identify command and disconnect (if you don't need an active connection). Like you send command "00" and MCU replies as "01" it means it's Atmega328p, "02" means it's STM32F103C8T6 and so on. You just need to implement this little function on MCUs and keep signatures on PC. Or you could even reply with a self-identifying string if you can afford it RAM-wise \$\endgroup\$
    – Ilya
    Jun 10, 2020 at 8:07
  • \$\begingroup\$ One of many reasons why UART is regarded as obsolete technology is the lack of protocol standards. There's only big and bloated ones like HDLC and Profibus DP, but I'd stay clear of those. \$\endgroup\$
    – Lundin
    Jun 10, 2020 at 9:19

2 Answers 2

2
\$\begingroup\$

Not as part of RS232 per se.

But there are standards for protocol layers that you may impose on top of RS232. Any device understanding/obeying that protocol will respond as you expect; any other arbitrary device will not (and may malfunction, or make your system malfunction, according to how it responds).

So in short, if you have control over the devices plugged into the system, you can accomplish what you wish. (You can enforce this control by using non-standard connectors for example, even if what's underneath is just RS232).

A standard protocol will already have a lot of thought put into its design, and following it will save work and probably mistakes over developing your own.

An example of a widely used protocol (aimed at RS485 not RS432, but both are UART based) would be MODBUS which permits you to use ASCII format messages making life simpler while developing and debugging the system. You'll find quite a lot of development resources (libraries etc) for MODBUS interfaces.

Some adaptation may be necessary for RS232 instead of RS485 but I used a simple subset of it over TTL level RS432 for an experiment some years ago.

Another more specialised one is NMEA-0183 which is RS232-compatible. It's commonly used on boats, to communicate between GPS, DSC radios, navigation equipment like compass, depth sounder, autohelm. And it's an example of a custom connector to enforce cmpatibility. Again, lots of libraries and software tools, with a slightly salty flavour.

\$\endgroup\$
1
\$\begingroup\$

Is there any industry-standard, or at least widely accepted, method for sending an ID request and receiving an ID response?

Not available for COM ports - and I personally had software installed at one point that tried to do this (old mobile fon stuff), which was VERY annoying.

But most devices are actually connected via USB. USB has both VID:PID to identify the device type (and select a driver) and an (optional) serial number. That sould be enough to id those µC, right? Sadly, it is rather difficult to go from USB id to COM port and vice versa in software.

My recommendation for new designs: Ditch the COM port and use USB directly with an USB-enabled µC and WinUSB as the driver. No need for custom drivers or inf files, see Microsoft OS Descriptors.

\$\endgroup\$
3
  • \$\begingroup\$ Unfortunately it isn't my choice. My microcontroller use FTDI serial plugs for programming and comms. Both use the exact same make and model plug, so the hardware id's are identical. \$\endgroup\$ Jun 10, 2020 at 7:23
  • \$\begingroup\$ Check serial numbers. If the "plugs" don't have the EEPROM and thus no serial number, the assigned COM port won't even be stable across reboots. \$\endgroup\$
    – Turbo J
    Jun 10, 2020 at 8:51
  • \$\begingroup\$ I apologize, I should have mentioned that I'm looking for a hardware-agnostic solution that is independent of the serial loaders. I should be able to identify my microncontrollers with my own plugs, and if I shipped the microcontrollers to a friend with their own plugs, then they should be able to identify the same microcontrollers with their plugs. \$\endgroup\$ Jun 11, 2020 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.