The Binho Multi-Protocol USB Host Adapter also supports UART communication. This is slightly different than how other supported protocols are implemented as in UART mode, the Binho host adapter is just a pass-through bridge. However, this basic mode of operation affords several advantages versus using a separate USB to UART bridge IC. In particular, it's possible to use the DAC and the I2C bus along with UART since they are all on separate signals not overlapping with UART TX and UART RX signals, or use those 3 available IO pins as some combination of ADC inputs, PWM outputs, or GPIO.
Again for easy reference, here's the connector pinout with the UART signals shown in green:
Gets/sets the UART configuration by passing a configuration string.
Gets/sets the baudrate of the UART connection.
Gets/sets the number of databits for the UART connection
Gets/sets the parity bit configuration for the UART connection.
Gets/sets the number of stop bits for the UART connection.
Gets/sets the escape sequence that can be used to break out of the UART bridge mode.
Starts the UART bridge. The adapter will remain in UART bridge mode until the escape sequence is sent from the host computer.
Feel free to jump ahead to the ASCII Command Set reference to learn the specifics of each command, or continue below to see an example of how to use these commands to achieve communication using the UART bridge.
The first step in using the Binho Multi-Protocol USB Host Adapter as a UART bridge is to put the adapter into UART mode using the Device Operating Mode command.
+MODE 0 UART-OK
Now let's configure the desired parameters of the UART bridge to match the downstream UART device. Here are the default settings:
9600 Baud rate
No Parity bit
1 Stop bit
Escape sequence =
Let's change the baudrate to match our desired communication speed:
UART0 BAUD 115200-OK
The other settings are quite commonplace, so we'll leave those unchanged in this example. However, there is one important thing to discuss before starting the UART bridge: how to stop the UART bridge.
Let's do a quick exercise to solidify our understanding. The ESC command can be queried so that nothing needs to be memorized:
UART0 ESC ?-UART0 ESC +++UART0
Okay, here we can see that the escape sequence is currently set to
+++UART0, which is the default setting.
But wait, what if I actually need to send the same string over the UART bridge and I don't want it to stop the bridge. Glad you asked! The escape sequence can be user defined to something even more unique:
UART0 ESC +!+!RQZ86!-OKUART0 ESC ?-UART0 ESC +!+!RQZ86!
It's certainly a best practice to always read back the ESC value after writing to it to confirm that it's been set to the expected value.
Now that we know the escape sequence, we can safely open up the UART bridge.
Once the -OK response is received, the UART bridge is open and all data will pass through the host adapter. The Binho Multi-Protocol USB Host Adapter will not respond to any commands until the UART bridge is closed.
Data can be simply passed through the host adapter as if it were a direct serial connection to the downstream device. Taking full advantage of the features available, one can easily jump out of the UART bridge to toggle pins, change the output voltage of the DAC, or otherwise stimulate the device, and then re-open the bridge.
Now let's close the UART bridge and go back to command mode. Simply send the escape sequence that was defined before starting the bridge:
Feel free to take a look in the examples section to see how to use the python library to use this in an automated way:
That's it for guides through the various supported protocols. Congratulations on making it this far through the User Guide. The next and final chapter will show you how to perform a device firmware update so that you always have the latest and greatest features on your Binho Multi-Protocol USB Host Adapter.