What would be nice is if usb 3.0 (or some other upcoming
standard), could support a "serial port mode".
This is since so many industrial and low cost devices
already have uart baked in.
To make life easier, you could have autodetect of the
serial setting, by an I2C eeprom chip that stores
the
"baudrate", "parity"
and "stop bit" settings of the line. Something like this?
[USB 5V] --> [5V]
[USB Data+] --> [ Host TX ]
[USB Data-] --> [ Host RX ]
[USB Gnd] --> [GND]
[USB SSTX+] --> [DTR]
[USB SSTX-] --> [RTS]
[USB SSRX+] --> [I2C SDIO/SDA]
[USB SSRX-] --> [I2C SCLK/SCK]
----
For the settings I2C eeprom. The eeprom's i2c address
will
be 0xAh (typical bog standard i2c address for eeproms.
Binary 1010.)
There is two approaches to storing the settings in the
eeprom. You could either keep it all binary ( e.g. 8bits to
select between
"75, 110, 300, 1200, 2400, 4800, 9600, 19200, 38400,
57600
and 115200 bit/s"), allowing for smaller cheaper
eeproms.
Or you
could just store it all in as a json/YAML string (thus is
user
readable).
I would recommend just encoding it as a human readable
string, since most i2c eeproms at least are 1kbits in size
(125 8bit
ASCII characters), since most computers are powerful
enough.
In general you want these settings in the settings
eeprom:
[Serial settings: e.g."9600/8-N-1" ]
[UUID Device]
[Device Class]
[optional serial number]
e.g.
{
"serial":"9600/8-N-1",
"DeviceUUID":"de305d54-75b4-431b
-adb2-eb6b9e546013",
"DeviceClass":"Generic:BlinkyLED"
}
----
The I2C line doesn't have to only contain an I2C eeprom.
You could perhaps place other I2C peripherals on the
same line as
well. Might make for a very versatile I2C port as well.
----
I know in general, this is kind of a pipe dream. But
maybe one day someone dealing with USB spec (or a
rival) could implement this. Not like this could cut in to
licencing profits by too much hopefully, since this is too
slow for most things like flash drives. But it sure will
make the usb port much more "universal" for embedded
devices.