Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Welcome to our Getting Started Guide. The Binho Nova was designed for ultimate flexibility, as such, there are multiple ways to control and interact with it. First, follow the Hardware Setup Guide to quickly get your device connected to the host computer and your electronics:
Hardware SetupOnce everything is connected, follow the guides below to learn how to interact with the Binho Nova using our GUI Software, Python Libraries and a Serial Console.
The easiest way to get familiar with your Binho Nova is by taking it for a test drive with our cross-platform desktop GUI software. Even if you intend to use it in automated environments and applications, the GUI is a great starting point before diving in to writing scripts.
QuickStart with GUIWhen you're ready to start writing your own automated scripts, take a look at our guide for using our open-source python libraries.
And when you're ready to go to the deepest level of device interaction to learn how to control it from any language/platform capable of opening a serial port and sending ASCII text, have a look at the guide below. This guide is presented using CoolTerm due to it's elegant GUI and relatively identical performance across all the platforms supported by the Binho Nova.
If you're looking for the full in-depth explanation of all the features of the Binho Nova, then skip right ahead to the .
Welcome to our customer support site! You can browse the articles from the content links on the left, or locate specific information using the search bar in the upper-right corner of the page.
The best way to get familiar with the Binho Nova Multi-Protocol USB Host Adapter, whether you own one or not, is to have a read through our Getting Started guide:
Getting StartedThere's also the complete product User Guide here which provides in-dept explanations on all of the devices functionality:
User GuideYou may have noticed that our documentation is using some unfamiliar terms when discussing the roles and signals for a given protocol. We've dropped the use of legacy terms which may initially cause confusion, so we've put together a helpful resource here:
Dropping Legacy TerminologyFinally, this portal contains a full set of documentation for the ASCII command set as well as the documentation of the Python library. This section includes a number of examples that demonstrate how to use the Binho Nova Multi-Protocol USB Host Adapter in many common use-cases such as reading/writing EEPROM, FLASH, and FRAM devices, interfacing I2C/SPI/1-WIRE sensors directly to your computer, and communicating with common CryptoAuth chips from Microchip (formerly Atmel).
ASCII Command SetPython LibrariesIf you're ready to purchase your own device and/or have some questions regarding doing business with Binho LLC, please check out the following pages:
Thanks again for visiting our support portal! If you have any unanswered questions, please reach out to [email protected] and we'll get right back to you as soon as possible.
The diagram below shows the pin assignments (in yellow) for the SCK, SDI, and SDO pins on the Binho Nova Multi-Protocol USB Host Adapter when it is in SPI mode.
Once the SPI mode of operation has been activated by clicking the "Activate SPI Mode" button on the SPI tab, the SPI settings will be unlocked and ready for configuration.
The Binho Nova supports SPI bus clock frequencies from 500kHz to 12MHz, and all four SPI modes are supported. Data can be configured for MSB or LSB first bit orders and for 8 or 16 bits per transfer.
The diagram below shows the pin assignments (in green) for the TX and RX pins on the Binho Nova Multi-Protocol USB Host Adapter when it is in UART mode.
Once the UART mode of operation has been activated by clicking the "Activate UART Mode" button on the UART tab, the UART settings will be unlocked and ready for configuration.
The Binho Nova supports UART baud rates from 300bps up to 1000000bps. The UART bus can be configured for 5, 6, 7, or 8 bit data packets; Even, Odd, or no Parity bit; and to use 1 or 2 stopbits.
Since SPI is a full-duplex communication protocol, the process of sending and receiving data is identical, and is simply referred to as "transfer" from within our software. To transfer data from the host adapter to a SPI peripheral device, simply enter in the data into the textbox and click the "Transfer" button. Data can be typed in binary, decimal, or hex formats. In the case of binary, the 8bit value should be preceded by a prefix of "0b", likewise a hex value should be preceded by "0x". Numbers without a prefix will be evaluated as a decimal number.
For clarity, here is an example of a valid data transfer displayed in each of the three supported bases:
Decimal: 222 173 190 239
Binary: 0b11011110 0b10101101 0b10111110 0b11101111
Hex: 0xDE 0xAD 0xBE 0xEF
You can find the results of the transfer displayed in the transaction list at the bottom of the window.
Note that reading data from a SPI peripheral device can be achieved by transfer bytes of value 0 for the desired number of bytes to be read back. This is how the SPI controller clocks out data from the SPI peripheral device.
Once the settings for the UART bus have been configured, click the "Start UART Bridge" button to begin transacting on the bus. Note that when the UART Bridge is started, the caption of the button will change to "Stop UART Bridge". The UART Bridge must be stopped before performing any other interactions with the Binho Nova.
Data can be transmitted on the UART bus by typing it into the text box and clicking the Send button. By default, no line endings are used when sending the entered text. However, it's very common for lines to be terminated by \n, \r, or \r\n so any of these options can be configured using the radio buttons below the Send button.
Data received on the UART bus will be displayed in the console as it arrives.
Great News! Most modern operating systems already have the device drivers needed for your Binho Nova Multi-Protocol USB Host Adapter to work properly installed. The Binho Nova utilizes the standardized USB Communications Device Class driver in order to achieve maximum compatibility with as many systems as possible. As such, there's no driver to download and install.
Windows 7 does not have the standard USB CDC driver mentioned above. Please see the troubleshooting article below.
Windows 7 Driver InstallationIf this is the first time connecting to a hardware device from your account on your Mac, you'll need to grant permission to your user account. Please see the following support article for instructions to perform this task:
If you're on Ubuntu or another Linux distribution and running into issues with your device, please perform the procedure in the following troubleshooting article:
Use the provided USB Type-C (male) to USB Type-A (male) cable to connect the Binho Nova Multi-Protocol USB Host Adapter to your host PC. The device can be plugged into any available USB port - there is no requirement to plug it into a USB 3.0 port.
Upon power up, the Status LED on the Binho Nova will shine yellow while it is waiting for the COM port to be opened. When connected properly, the device should immediately enumerate and become available for use as a new COM port. Once a serial connection has been established between the device and the host computer, the Status LED will shine blue.
The Binho Nova Multi-Protocol USB Host Adapter features an integrated wire harness terminated with a 1.27mm pitch 2x5 IDC Connector. This harness contains the 5 signal pins, 1 x 3V3 power signal, 1 x VBUS power signal, and 3 x GND signals.
The figure below shows the connector pinout and channel functions:
Now you're ready to begin interacting with the device. See the QuickStart Guides in this section to learn how to interact with the device via your preferred interface:
The diagram below shows the pin assignments (in purple) for the SCL and SDA pins on the Binho Nova Multi-Protocol USB Host Adapter when it is in I2C mode.
Once the I2C mode of operation has been activated by clicking the "Activate I2C Mode" button on the I2C tab, the I2C settings will be unlocked and ready for configuration.
The Binho Nova supports I2C bus clock frequencies from 100kHz up to 3.4MHz, which covers all common operating modes (standard, full, fast, and high speed modes). Clock stretching and repeated starts are also supported. There are internal pull-up resistors which can be engaged or disabled as necessary.
If you already know the address of your target I2C peripheral device, you can type it directly into the Address textbox (in either decimal or hex, preceded by "0x"). However, Binho makes it easy to discover devices on the I2C bus -- simply leave the "Address" textbox empty and click the "Scan Entire Bus..." button and the host adapter will check for devices on the bus. Any devices that are found will then be displayed in a listbox. Simply select the address of the device that you'd like to interact with from the list.
The remainder of the commands in this guide require that the "Target Address" has already been set, either by scanning the bus or via directly typing the peripheral I2C device address.
It's now possible to use both 7bit or 8bit formatted I2C addresses by selecting the preferred address formatting in the Target Device section.
Reading data from the peripheral device is as simple as providing the number of bytes to read (in either decimal or hex, preceded by "0x") and clicking the "Read [n] Byte(s)" button.
Note that the results of this action are displayed in the transaction list at the bottom of the window.
Writing data to a peripheral device on the I2C bus can be done by entering the data into the "Write" textbox and clicking the "Write [n] Byte(s)" button. An option checkbox can be selected to immediately send a repeated start bit after writing the data. Data can be typed in binary, decimal, or hex formats. In the case of binary, the 8bit value should be preceded by a prefix of "0b", likewise a hex value should be preceded by "0x". Numbers without a prefix will be evaluated as a decimal number.
For clarity, here is an example of a valid data transfer displayed in each of the three supported bases:
Decimal: 222 173 190 239
Binary: 0b11011110 0b10101101 0b10111110 0b11101111
Hex: 0xDE 0xAD 0xBE 0xEF
Note that the results of this action are displayed in the transaction list at the bottom of the window.
While not an official part of the I2C specification, a very common implementation across various I2C devices makes it convenient to have a Read Register function. Read Register is effectively a 1-byte Write command which contains the desired register address, followed immediately by a read command.
The Read Register command supports both 8bit and 16bit register addresses. When targeting a 16bit register on an I2C peripheral device, simply use the hex address padded with leading zeros as necessary.
For example, to address register 32 on a device which is expecting a 16-bit address, enter 0x0020 in the Register Address textbox.
Note that the results of this action are displayed in the transaction list at the bottom of the window.
CoolTerm is a very popular cross-platform serial console application developed by Roger Meier. It's got all the necessary features for communicating with hardware devices and an elegant user interface.
You can download the latest release directly from his website. Installation simply entails extracting the folder from it's compressed .zip archive and placing in a known location on your drive.
Connect the Binho Nova to your PC using the provided USB cable. The status LED on the host adapter will shine yellow when it is powered and waiting for the host PC to open the connection to the device.
Configure the serial connection by clicking the "Options" button on the toolbar.
The connection parameters should be configured to the following:
Baudrate: 1000000
Databits: 8
Parity: None
Stop Bits: 1
Now let's adjust some CoolTerm settings to make it even easier to use.
Click the "Options" button again and select the "Terminal" Category from the list on the left.
Change the "Terminal Mode" setting from "Raw Mode" to "Line Mode"
Select the checkbox to enable "Local Echo" functionality.
Now that the connection parameters have been configured correctly, it's time to connect to the Binho Nova. Click the "Connect" button on the toolbar to open the serial connection.
Once the serial connection has been established, the Status LED on the Binho Nova will shine blue. You can now begin sending commands to the host adapter.
Sending commands to the device is as simple as typing a command and pressing Enter. Let's get the unique device ID of this host adapter by sending the device command +ID.
Note that the host adapter will respond to every command. If you do not receive a response from the command, then the serial connection may not be configured properly.
You're ready to hit the ground running. Check out the full User Guide to learn how to take advantage of the full set of supported protocols and features of your host adapter:
Our friends over at Sparkfun introduced us to Qwiic Connect System and we're loving it. This board makes it easy for you to interface your Binho host adapter with up to 4 strings of Qwiic devices, as well as breaking out all of the pins to a series of headers that make it very convenient to jump to other circuits, as well as hook up your Logic Analyzer to monitor everything while you develop and debug. This board is 25mm x 35mm and comes with the connectors pre-soldered. The headers are included but not installed.
This accessory is available for purchase in our online store here.
This board features a male 2x5 1.27mm connector and breaks it out to breadboard-friendly 2.54mm / 0.1in pitch headers. It's a quite easy way to interface your Binho host adapter with other circuits using standard jumper wires as well. The board measures 14mm x 18mm x 7mm and is black with white silkscreen labels for each of the pins. The SMT connector comes soldered to the board but you'll need to install the headers (included) yourself.
Note that each Binho Multi-Protocol USB Host Adapter includes one of these adapters.
These are available for purchase on our website .
We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The binhoHostAdapter class contains all the necessary functions to programmatically control / automate all of the functionality of your binho Multi-Protocol USB Host Adapter. This class can be included in your code as show below.
This class contains a multitude of functions split into several different categories. The documentation has been split up accordingly.
This board makes it easy for you to interface your Binho Nova host adapter with any form-factor device. I2C, SPI, and UART interfaces are all wired up. By default, the 3V3 and 5V rails are connected so that the Binho Nova can power the sensors, but this can be easily disabled by cutting the exposed traces. Additionally, this interface board features a Qwiic connector to easily bridge the Feather and Qwiic ecosystems. The headers are included but not installed.
Note: We highly recommend the from Adafruit for use with this board.
This accessory is available for purchase in our online store .
We updated our documentation to remove obsolete terminology from our I2C related support pages. You can learn more about this change .
This releases introduces the following enhancements:
Added 1-WIRE WHR (Write Hex \ Read Hex) Command to increase 1-WIRE operational speed.
This release fixes the following bugs:
No known bug fixes.
This section addresses some common issues and how to resolve them. If you find yourself facing an issue not addressed here, please reach out to us at [email protected] and we'll help get to the bottom of it as quickly as possible.
This release introduces the following enhancements:
none
This release fixes the following bugs:
Fixed I2C controller issue that can cause transfers of more than 256 bytes to fail.
This releases introduces the following features:
Added CMD version keyword
Added WHR command for improved I2C/SPI data transfer speed.
On MacOS, you'll need to ensure that your user account is added to the wheel group in order to grant it the permissions needed to access the hardware. This is only necessary once per user.
Simply run the following command:
Added support for I2C SLAVE
This release fixes the following bugs:
Check I2C SCL and SDA lines before scanning to ensure bus is pulled up.
Interested in trying out some of our newest features? This is the place for you! So, what does it mean to be an 'experimental feature'? Well, right now, these are features for which we are implementing proof-of-concept functional support in our products to gather feedback. These features have undergone a fair amount of internal testing already, but may lack strong supporting documentation.
The following features are currently available for public usage:
DAPLink ModeIf you're using any of our experimental features, we want to hear from you! Please write in to [email protected] and let us know your thoughts and feedback so we can continue to improve them. Experimental features may eventually graduate and be assimilated into our standard feature set, or abandoned entirely.
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This section shows the Binho Multi-Protocol USB Host Adapter in use in a number of typical applications:
I2C EEPROM Reading And WritingI2C Peripheral ModeSPI FRAM Reading And WritingI2C FRAM Reading And Writing1-Wire CommunicationSWI with Atmel Crypto ICsUART Bridge with I2CUsing Binho with PytestLooking for an example in a particular use case or test environment? Reach out to us at [email protected] and we'll do our best to create and publish a relevant example.
Have you done something new, interesting, and/or clever with your Binho Multi-Protocol USB Host Adapter and want to gain some street cred by sharing it with others? Send a link to your example to us at [email protected] and we'll include it here!
This library is still supported, but is not recommended for new designs.
sudo dscl . -append /groups/wheel GroupMembership <username>from binhoHostAdapter import binhoHostAdapterNo Flow Control
Support for SPI @ 12MHz max clock
Support for I2C @ 3.4MHz max clock
Support for UART @ 1000000 max baud
Support for Dallas 1-Wire
Support for Atmel Single-Wire Interface
Provides 3v3 and VUSB power rails
1 x DAC Output, 5 x ADC Inputs
GPIO / Interrupt / PWM Support
Programmable RGB Status LED
Field-Upgradeable Device Firmware
Cross-platform Support for Windows, Mac, Linux
Robust, low-profile Aluminum Enclosure
USB Type-C Connector
Firmware Development
Proof of Concept Development
System Debugging
Automated Hardware Testing
The Binho Nova Multi-Protocol USB Host Adapter allows one to interface their computer directly to hardware circuits. This device is powered by the USB connection to the host PC and is also able to provide downstream power to test circuits.
The Binho Nova Multi-Protocol USB Host Adapter features 5 signal pins, 1 x 3v3 pin, 1 x VUSB pin, and 3 x GND pins on its 10pin wire harness. The wire harness terminates with a female 1.27mm 2x5 IDC connector. In IO Mode, the 5 signal pins can be used for varying functions such as Digital Input, Digital Output, PWM Output, Digital Interrupt (on rising edge, falling edge, or change), Analog Input, or Analog Output.
Additionally, the host adapter is able to utilize these pins to communicate on several digital buses: I2C, SPI, UART, (Dallas)1-Wire, and (Atmel) Single-Wire Interface. While in these modes of operation, remaining available pins can be assigned to other related or unrelated purposes such as gpio, interrupts, chip selects, PWM signals, or analog input or outputs.
The Binho Nova Multi-Protocol USB Host Adapter is ideal for manual testing during firmware development and debugging as well as a perfect way to automate hardware testing and validation. A common use-case of this product in production environments is for EEPROM/Flash Memory programming along with functional testing activities.
The Binho Nova Multi-Protocol USB Host Adapter comes along with a helpful and with a 1 foot USB type C (male) to type A (male) cable in a soft-shell zippered case.
THIS PRODUCT CONTAINS CHEMICALS KNOWN TO THE STATE OF CALIFORNIA TO CAUSE CANCER AND BIRTH DEFECTS OR OTHER REPRODUCTIVE HARM.
Please see our International Shipping page for information regarding ECCN and HS Codes for Binho products:
Our cross-platform software is available for Windows, Mac, and Linux and provides an easy-to-use GUI interface for your Binho Nova Multi-Protocol USB Host Adapter.
Mission Control features support for SPI, I2C, and UART protocols, as well as IO functions.
You can download the latest version for your operating system here:
ReleasesTake a look at the Getting Started section of our support portal for an introduction to using our GUI software:
QuickStart with GUIWe provide 32-bit and 64-bit builds of our application for Windows. The following versions are supported:
Windows 10
Windows 8.1
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The Binho Multi-Protocol USB Host Adapter paired with a Saleae Logic is the perfect combination for making hardware testing as simple as possible. Furthermore, Logic captures of UART, SPI, and I2C transactions can be exported and then replayed by Binho. This makes it very easy to recreate a test case or repeat a given stimuli that you've captured with Logic. Please see the samples below for each of the protocols.


We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The example below provides a basic demonstration of how to use the Binho Nova Multi-Protocol USB Host Adapter as both a UART bridge and an I2C controller to interact with the same DUT with both protocols.
In rare situations, there might be problems with the drivers on Windows 8 which require manual intervention in order to get the device working the first time that it's connected to the PC. These issues manifest themselves with the following 2 error codes displayed in Windows Device Manager.
Great News! Most modern operating systems already have the device drivers needed for your Binho Nova Multi-Protocol USB Host Adapter to work properly installed. The Binho Nova Mult-Protocol USB Host Adapter utilizes the standardized USB Communications Device Class driver in order to achieve maximum compatibility with as many systems as possible. As such, there's no driver to download and install.
Mission Control automatically detects the firmware version of a connected Binho Nova and checks if there's a newer version available. If a newer version of firmware is found, a prompt will be displayed asking if you'd like the device firmware to be updated. This process is shown below:
Disk Drive Encryption Software (such as BitLocker) will likely prevent the firmware update process of completing successfully. An upcoming release of Mission Control will include the necessary functionality to resolve this issue.
The five IO pins of the Binho Nova Multi-Protocol USB Host Adapter can be used in a variety of modes, and unassigned pins can be used for their IO functions even when other pins are used for SPI or I2C operation. The image below shows the pinout and functionality of each of the pins:
All 5 of the IO pins can be used as digital inputs. This can be achieved by selecting "DIN" from the pin assignment dropdown box. In this mode, the value of the input signal can be read by clicking the "Update" button. The value is displayed as either a logical 0 or 1.
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
OS X Yosemite 10.10.5
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
OS X Yosemite 10.10.5
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
OS X Yosemite 10.10.5
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
If this is the first time connecting to a hardware device from your account on your Mac, you'll need to grant permission to your user account. Please see the following support article for instructions to perform this task:
If you're on Ubuntu or another Linux distro and running into issues with your device, please perform the procedure in the following troubleshooting article:
The easiest way to get familiar with your Binho Nova Multi-Protocol USB Host Adapter is by taking it for a test drive with our cross-platform desktop GUI software called Mission Control. Even if you intend to use it in automated environments and applications, Mission Control is a great starting point before diving in to writing scripts. Check out the QuickStart guide here to learn how to install and use it:
Chances are that you already have a serial console application installed on your system. Go ahead and use the one you prefer. This documentation is written for CoolTerm, but there's nothing particular about the serial connection, so any serial console application should be just fine. You can see the specifics of the device connection properties on the following page:
If you don't already have a serial terminal application installed, or you'd like to try out something new/different from what you've been using, feel free to download one of these popular serial consoles:
More than likely you'll want to start writing scripts to employ the Binho Nova Multi-Protocol USB Host Adapter in automated testing. You'll need Python 3 to use the provided libraries. If you don't already have Python 3 installed, you can download it here.
Our Python Libraries do not work with Python 2.7. Python 2.7 was retired on January 1, 2020, so it's a great time to make the switch.
All of the documentation for the Python libraries can be found on the following page:
We recommend spending a few moments sending manual commands to get familiar with the command structure of the Binho Nova Multi-Protocol USB Host Adapter as it will then make it easier to understand the structure of the Python Libraries and function names.
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
binhoTesterCommPort = 'COM22'
# create the binhoHostAdapter object
binhoTester = binhoHostAdapter.binhoHostAdapter(binhoTesterCommPort)
print("Connecting to binho host adapter tester...")
print
print(binhoTester.setLEDColor('YELLOW'))
print(binhoTester.setOperationMode(0, 'UART'))
print(binhoTester.setBaudRateUART(0, 115200))
print(binhoTester.setDataBitsUART(0, 8))
print(binhoTester.setParityUART(0, 'NONE'))
print(binhoTester.setStopBitsUART(0, 1))
print(binhoTester.beginBridgeUART(0))
binhoTester.writeBridgeUART("Testing...")
binhoTester.writeBridgeUART("more more")
print(binhoTester.stopBridgeUART("+++UART0"))
print(binhoTester.ping())
binhoTester.setOperationMode(0, 'I2C')
binhoTester.setPullUpStateI2C(0, "EN")
binhoTester.setClockI2C(0, 400000)
print(binhoTester.startI2C(0, 100))
print(binhoTester.writeByteI2C(0, 15))
print(binhoTester.writeByteI2C(0, 25))
print(binhoTester.endI2C(0))
binhoTester.setOperationMode(0, 'UART')
print(binhoTester.beginBridgeUART(0))
binhoTester.writeBridgeUART("Second Burst")
binhoTester.writeBridgeUART("Same as the first")
binhoTester.writeBridgeUART("A whole lot louder")
binhoTester.writeBridgeUART("And a whole lot wurst")
print(binhoTester.stopBridgeUART("+++UART0"))
print(binhoTester.ping())We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This example is a very brief demonstration of using SPI to read from and write to a SPI FRAM device. This particular examples uses the 64Kbit FRAM Breakout Board from Adafruit.
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
# Change this to match your COMPort
default_commport = "COM11"
print("SPI FRAM Example using Binho Host Adapter")
print("v1.0 -- Jonathan Georgino <[email protected]>")
print
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
if len(devices) == 1:
COMPORT = devices[0]
print("Found 1 attached adapter @ " + devices[0])
print
else:
COMPORT = default_commport
print("Found more than 1 attached adapter, using default port " + COMPORT)
print
print("Opening " + COMPORT + "...")
print
# create the binhoHostAdapter object
hostAdapter = binhoHostAdapter.binhoHostAdapter(COMPORT)
print(hostAdapter.setOperationMode(0, 'SPI'))
print(hostAdapter.setClockSPI(0, 1000000))
print(hostAdapter.setModeSPI(0, 0))
print(hostAdapter.setIOpinMode(0, 'DOUT'))
print(hostAdapter.setIOpinValue(0, 'HIGH'))
print(hostAdapter.beginSPI(0))
print(hostAdapter.setIOpinValue(0, 'LOW'))
print(hostAdapter.transferSPI(0, 0x9f))
print(hostAdapter.transferSPI(0, 0))
print(hostAdapter.transferSPI(0, 0))
print(hostAdapter.transferSPI(0, 0))
print(hostAdapter.transferSPI(0, 0))
print(hostAdapter.setIOpinValue(0, 'HIGH'))
print(hostAdapter.endSPI(0))
print(hostAdapter.clearBuffer(0))
print(hostAdapter.addByteToBuffer(0, 0x9f))
print(hostAdapter.beginSPI(0))
print(hostAdapter.setIOpinValue(0, 'LOW'))
print(hostAdapter.transferBufferSPI(0, 5))
print(hostAdapter.setIOpinValue(0, 'HIGH'))
print(hostAdapter.endSPI(0))
print(hostAdapter.readBuffer(0, 5))We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The python script below demonstrates how to communicate with a DS2413, a dual-channel addressable switch IC. You can get one on an easy-to-use breakout board from our friends at Adafruit.
An ACK response from the host adapter indicates that the received command has been executed successfully. An ACK response is represented by -OK
For example, the PING command always elicits an ACK response from the device:
A NAK response from the host adapter indicates that the received command failed to execute. This could be indicative of a spelling error/typo, invalid command name or parameter values, or the failure to successfully execute the called function. A NAK response is represented by -NG
For example, a keyboard error caused +PING to be misspelled as +PONG, which is a non-existent command:
Many of the commands sent to the host adapter result in the host adapter responding with data. In these cases, the format of the response is specific to the executed command. Typically the response contains the name of the command followed by the response data.
For example, sending the +FWVER command causes the device to respond as such:
The ASCII Command Set Reference Guide provides detailed example responses for of the host adapter commands. You can jump to that section of the guide here:
We thought you'd never ask. Interrupts aren't actually a response to a command - they are somewhat unsolicited transmissions. As such, they are worthy of their own page in this guide.
from binhoHostAdapter import binhoHostAdapter
from time import sleep
# change this to your COM port
binhoTesterCommPort = 'COM22'
print("Opening " + binhoTesterCommPort + "...")
print()
for i in range(3):
# create the binhoHostAdapter object
binhoTester = binhoHostAdapter.binhoHostAdapter(binhoTesterCommPort)
print("Connecting to binho host adapter tester...")
print()
oneWireIndex = 0
binhoTester.setLEDColor('CYAN')
binhoTester.setOperationMode(0, '1WIRE')
print(binhoTester.begin1WIRE(oneWireIndex, 0, True))
print(binhoTester.reset1WIRE(oneWireIndex))
print("Looking for a DS2413 on the bus")
print(binhoTester.resetSearch1WIRE(oneWireIndex))
print(binhoTester.search1WIRE(oneWireIndex))
print(binhoTester.getAddress1WIRE(oneWireIndex))
def write2413(state):
print('state orig: ' + str(state))
state |= 0xfc
print('state now: ' + str(state))
print('state inv: ' + str(~state + 256))
print('write2413 func begin')
print(binhoTester.reset1WIRE(oneWireIndex))
print(binhoTester.select1WIRE(oneWireIndex))
print(binhoTester.writeByte1WIRE(oneWireIndex, 90))
print(binhoTester.writeByte1WIRE(oneWireIndex, state))
print(binhoTester.writeByte1WIRE(oneWireIndex, ~state +256))
print(binhoTester.readByte1WIRE(oneWireIndex))
print(binhoTester.readByte1WIRE(oneWireIndex))
print(binhoTester.reset1WIRE(oneWireIndex))
write2413(3)
print('Sleeping for a hot sec ... ')
sleep(1.0)
print('doing it again...')
write2413(0)
print('Finished!')
binhoTester.close()+PING
-OK+PONG
-NG+FWVER
-FWVER 0.1.5Automated Firmware Testing
EEPROM Programming
FLASH Programming
FRAM Programming
Both of these error messages indicate an issue with the device driver that's been associated with the Binho Nova host adapter. Thankfully this can be resolved by manually updating the device driver.
Our device drivers are not digitally signed, therefore should you need to manually install the drivers on Windows 8, you'll need to first temporarily disable the digital signature enforcement and then peform the installation. Our friends at SparkFun have produced a pretty clear guide to disabling Windows 8 Driver Signature Enforcement. Please follow the steps on the page linked below:
Once the driver signature enforcement has been disabled, please follow the same steps presented on the Windows 7 Driver Installation page to manually install the driver:
Note that if you do not following the steps to properly disable device driver signature enforcement, you will likely encounter the following error message when trying to update the device driver:
This process is described in more detail, along with a brief video demonstration of this process on the following support page:
All 5 of the IO pins can be used as digital outputs. This can be achieved by selecting "DOUT" from the pin assignment dropdown box. In this mode, the value of the output signal can be set by clicking either the "Set Low" or "Set High" buttons.
All 5 of the IO pins can be used as analog inputs. This can be achieved by selecting "AIN" from the pin assignment dropdown box. In this mode, the value of the input signal can be read by clicking the "Update" button. Note that the voltage reference is 3.3 Volts. The measured value is displayed in Volts.
Only IO1 is capable of functioning as an analog output. This pin can be configured to use the 10-bit DAC to output a voltage between 0 and 3.3 Volts. IO1 can be set as an analog output by setting "AOUT" from the pin assignment dropdown box. In this mode, the value of the output signal can be set by dragging the slider from 0 to 1024. Note that the output signal is updated only after releasing the slider.
IO0, IO2, IO3, and IO4 pins have PWM output capabilities. The duty cycle and frequency are both controllable from the software. This can be achieved by selecting "PWM" from the pin assignment dropdown box. In this mode of operation, the frequency can be set from 750Hz to 80kHz by dragging the top slider, and the duty cycle can be set by dragging the bottom slider from 0 to 1024. Please note that IO0 and IO2 share a frequency, and IO3 and IO4 share a separate frequency. As such, updating the frequency slider for one of these channels will also update the corresponding channel's frequency setting.

Bugfix that was impacting the transmission of line endings in UART bridge mode
Implements the new SPI CS pin control command, available in firmware version 0.2.7 and up, to have tighter timings on CS pin edges.
Fixed crash on old Nova FW on SPI tab when sending more than 256 bytes of data to old FW.
Improved device discovery and connection management on Win, MacOS, and Linux.
Improved I2C & SPI Data Transfer Performance
Added checking for Mission Control updates on application startup
Added firmware version detection & update prompt on device connection
Numerous Bug Fixes
Improved I2C Addressing support with option for 7bit or 8bit addresses
Added support for UART Bridge mode of operation
Added device firmware update support
Added software check for update feature
Fixed bug in Reset and Reset to Bootloader functions
Fixed a variety of UI layout issues
Fixed errant unit labels
Enabled LiveScroll on PWM Frequency and Duty cycle sliders
Initial Release
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The binhoUtilities class contains several functions which help with managing serial ports, discovering devices, and connecting to specific devices. This class can be included in your code as show below.
One of the key benefits of using these helper functions is that care has been taken to ensure they work well across the various operating systems, particularly in regards to how serial ports are named and accessed.
This function returns an array of currently available serial ports. The serial ports returned may or may not be a binho Multi-Protocol USB Host Adapter or some other device. See listAvailableDevices function below to get a list of serial ports related only to binho Multi-Protocol Host Adapters. Note that any serial ports which are currently opened will not be shown in the list.
Inputs:
This function takes no parameters.
Outputs:
This function returns an array of available serial ports as strings.
Example Usage:
This function returns an array of currently available serial ports that are associated with a binho Multi-Protocol USB Host Adapter. See listAvailablePorts function above to get a list of all available serial ports. Note that any serial ports which are currently opened will not be shown in the list.
Inputs:
This function takes no parameters.
Outputs:
This function returns an array of available serial ports as strings.
Example Usage:
This function returns an array which will either be either of length 0 (empty) or of length one, where the element will be a string containing the name of the serial port of the binho Multi-Protocol USB Host Adapter with the desired deviceID. This function is very useful when multiple host adapters are connected to the same computer.
Inputs:
This function takes 1 parameter, deviceID, as a string. It can either include or omit the "0x" prefix on the deviceID.
Outputs:
This function returns an array of serial ports as strings. Note that since the deviceIDs are globally unique, the returned array will have either zero or one element.
Example Usage:
Use the provided USB Type-C (male) to USB Type-A (male) cable to connect the Binho Nova Multi-Protocol USB Host Adapter to your host PC. The device can be plugged into any available USB port - there is no requirement to plug it into a USB 3.0 port.
Upon power up, the Status LED on the Binho Nova Multi-Protocol USB Host adapter will shine yellow while it is waiting for the COM port to be opened. When connected properly, the device should immediately enumerate and become available for use as a new COM port. Once a serial connection has been established between the device and the host computer, the Status LED will shine blue.
The Binho Nova Multi-Protocol USB Host Adapter features an integrated wire harness terminated with a 1.27mm pitch 2x5 IDC Connector. This harness contains the 5 signal pins, 1 x 3V3 power signal, 1 x VBUS power signal, and 3 x GND signals.
The figure below shows the connector pinout and channel functions:
Use the link below to download a printable PDF version of this image for easy reference:
Dallas 1-WIRE and Atmel SWI (Single-Wire Interface) protocol can be configured to work with any of the five IO pins. It is especially convenient to use with IO0 or IO2 as it’s possible to engage a suitable internal pull up resistor on these channels.
Clearly the most convenient method to connect the signals is by including a footprint for the 2x5 IDC connector on your circuit board, but this isn't always an option. As such, you can use the included Breadboard Adapter board to breakout the signals to 0.1in/2.54mm pitch headers which can easily be connected with jumper wires.
Furthermore, there are several accessories available that make it easy to connect directly to your test circuitry. You can learn all about them here:
Our initial python library was actually what would best be described as a 'wrapper'. It simply wrapped our ASCII commands into a set of equivalent Python functions. This served as well, but was a temporary solution to buy us time to produce a much more powerful library. We highly encourage everyone to use our new Python package which is packed with features:
This page and the others in this section are left for historical purposes. This 'wrapper' library remains available and we'll continue to support customers using it, however all future improvements will be implemented only in our new library.
We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
This example demonstrates how to use Binho Nova as an I2C Peripheral device, with a device address of 0xA0 and operating in USEPTR mode of emulation.
Mac, Linux, and Windows 8+ do not require any driver installation. Only users of Windows 7 and below may need to install device drivers.
We're in the process of creating a streamlined way to install the device drivers. In the meantime, please follow the manual steps shown below to install the driver for your Binho Nova Multi-Protocol USB Host Adapter. Thank you very much for your patience while we work on improving the driver installation experience, and please feel free to reach out to us at [email protected] for any assistance related to driver installation issues.
from binhoHostAdapter import binhoUtilitiesCaution should be taken when using the host adapter in the presence of a ground loop. Ground loops can easily occur in test bench setups when the host adapter is not the only ground path between your test circuit and the host computer. This is not necessarily bad, but requires an additional awareness.
Common Ways a Ground Loop Can Exist:
Other USB devices (such as programmers) are connected to the test circuit, or the test circuit itself is plugged into the USB port on your computer. In addition to the host adapter's ground connection, the test circuit's ground is also connected to the PC's ground through another USB port.
Non-isolated power supplies. Most AC power supplies with 3-prong plugs will short the MAINS earth ground pin to the power supply ground output. That includes your PC's ground. If your test circuit is powered from a 3-prong wall power supply and your PC is also plugged in, that will form another ground path. Keep in mind that if you're using a laptop that's not plugged in, even an attached external monitor or printer will create a ground loop.
Common Ways Damage Can Occur:
When connecting or disconnecting wires, one of the ground signals from the host adapter is accidentally brushed against a power supply pin on the test circuit, such as +5V. If there are no other ground paths between the test circuit and the computer, nothing will happen. However, if there is a ground path, then current will flow from that voltage supply through the host adapter's ground pin, through the USB cable and the host PC, and then through the secondary ground connection—either MAIN earth ground or another USB port, back to the ground on the test circuit. Basically, that is the same as shorting out the voltage supply on your test circuit, but it uses the host adapter and your host PC as the short circuit, which could damage all components in the loop.
What if the test circuit's ground reference isn't at the same voltage as the ground loop connection? For instance, if your circuit is powered by a bipolar power supply used to produce +10 volts and -10 volts, and then your circuit uses the -10 volt rail as its ground voltage, but there exists a ground loop through MAINS earth ground to the power supply's 0 volt output, then effectively the ground on your test circuit is actually -10 volts relative to the host PC. Connecting your Binho Multi-Protocol USB Host Adapter will immediately short out the test circuit's power supply and potentially damage all devices present in the loop.
To identify a potential ground loop between the host adapter and the test circuit, you could check the resistance between the test circuit ground and the Binho host adapter ground. While the host adapter is connected to the PC, if the resistance reads infinite on a multi-meter, then the grounds are isolated. Otherwise, they are connected, and a ground loop exists.
If you believe there is a ground loop between the test circuit and the host PC but you are uncertain if the grounds on both sides you plan to use are at the same potential, there is a quick test you can perform with a multi-meter. If you happen to have a large resistor (> 10K ohm), there is an additional test you can perform.
Connect the host adapter to the PC but not the test circuit.
Measure the voltage between the ground pin on the host adapter and the ground pin on the test circuit.
If there is a ground loop and you measure a voltage greater than about +/- 100mV, then a common mode ground current may occur when they are connected, damaging your equipment.
If there is a ground loop and you measure a voltage smaller than about +/- 100mV, then it is safe to connect the ground pins.
If there is not a ground loop or you are not sure there is a ground loop, then the voltage may drift significantly. If you are SURE there is no ground loop, then it is safe to connect the grounds.
If you are not sure there is a ground loop or would like to perform another test anyway, connect the resistor (~10K) between the two grounds and then measure the voltage across the resistor.
If you see a voltage that indicates a noticeable current, then there is a ground loop between devices and you should not connect the grounds together.
If you see an insignificant voltage across the resistor, then either there is no ground loop or there is a ground loop, but both grounds are at the same reference. It is safe to connect the host adapter.
The test circuit's local ground is isolated from the host PC when one of the following is true:
The test circuit is battery-powered and has no other electrical connections to the host PC or devices powered from MAINS power.
The test circuit is powered from an isolated power supply that does NOT short MAINS earth ground to the output ground. Bench top supplies with a separate green earth ground terminal do this. USB wall adapters also do this. Common AC power adapters (chargers, "wall warts") with 2-prong plugs are also isolated. Most power supplies do have transformers that can provide isolation if implemented properly.
The Host PC is a laptop running from a battery or is plugged into an instrumentation isolation transformer. Note that normal isolation transformers connect earth ground for human safety reasons.
Warning: When working in an electrically isolated state, keep in mind that floating grounds can be dangerous to the operator. When operating equipment with a floating ground, please review and follow appropriate safety measures.
Using isolated wall adapters such as USB wall adapters to power the test circuit will isolate its ground from MAINS ground, although that does not always eliminate ground loops. For example, if the test circuit was connected to the same computer that the host adapter is connected to, then a ground loop is formed.
Yes, it is completely safe to use the Binho Nova Multi-Protocol USB Host Adapter as long as both grounds are at the same voltage level and as long as you only connect the host adapter ground to the ground of the test circuit.
Stability Improvements
Improved UI (Splash Screen, Device List, etc.)
Added release for 32-bit Linux



from binhoHostAdapter import binhoUtilities
utilities = binhoUtilities.binhoUtilities()
availableCommPorts = utilities.listAvailablePorts()
print(availableCommPorts)
# Console Output (on Win10 PC):
# ['COM22', 'COM23']from binhoHostAdapter import binhoUtilities
utilities = binhoUtilities.binhoUtilities()
availableDevices = utilities.listAvailableDevices()
print(availableDevices)
# Console Output (on Win10 PC):
# ['COM22']from binhoHostAdapter import binhoUtilities
utilities = binhoUtilities.binhoUtilities()
targetDeviceCommPort = utilities.getPortByDeviceID('0xc59bb495504e5336362e3120ff032d2c')
print(targetDeviceCommPort)
# Console Output (on Win10 PC):
# ['COM22']
targetDeviceCommPort = utilities.getPortByDeviceID('c59bb495504e5336362e3120ff032d2c')
print(targetDeviceCommPort)
# Console Output (on Win10 PC):
# ['COM22']import os
import subprocess
import shutil
import psutil
import sys
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
from time import sleep
# enter the deviceID of target test device
binhoID = '0x1c4780b050515950362e3120ff141c2a'
utilities = binhoUtilities.binhoUtilities()
binhoComPorts = utilities.getPortByDeviceID(binhoID)
binhoComPort = 0
if len(binhoComPorts) == 0:
print("ERROR: No Binho Slave Device found!")
exit(1)
elif len(binhoComPorts) > 1:
print("ERROR: More than one Binho Slave Device found!")
exit(1)
else:
binhoComPort = binhoComPorts[0]
print("Found Binho Slave Device on " + binhoComPort)
print("Opening " + binhoComPort + "...")
print()
# create the binhoHostAdapter object
binhoNova = binhoHostAdapter.binhoHostAdapter(binhoComPort)
print("Configuring Binho Nova I2C Slave with address of 0xA0")
binhoNova.setLEDColor('RED')
binhoNova.setOperationMode(0, 'I2C')
binhoNova.setPullUpStateI2C(0, "EN")
# assign the address of 0xA0
binhoNova.setSlaveAddressI2C(0, 0xA0)
# set the mode to USEPTR mode
binhoNova.setSlaveModeI2C(0, "USEPTR")
# load some initial values into registers 0x06 - 0x11
binhoNova.setSlaveRegisterI2C(0,0x06,0x00)
binhoNova.setSlaveRegisterI2C(0,0x07,0x06)
binhoNova.setSlaveRegisterI2C(0,0x08,0x05)
binhoNova.setSlaveRegisterI2C(0,0x09,0x00)
binhoNova.setSlaveRegisterI2C(0,0x0A,0x04)
binhoNova.setSlaveRegisterI2C(0,0x0B,0x00)
binhoNova.setSlaveRegisterI2C(0,0x0C,0x00)
binhoNova.setSlaveRegisterI2C(0,0x0D,0x00)
binhoNova.setSlaveRegisterI2C(0,0x0E,0x00)
binhoNova.setSlaveRegisterI2C(0,0x0F,0x00)
binhoNova.setSlaveRegisterI2C(0,0x10,0x00)
binhoNova.setSlaveRegisterI2C(0,0x11,0xFF)
# make all the registers readonly by setting WriteMasks to 0x00
binhoNova.setSlaveWriteMaskI2C(0, 0x06, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x07, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x08, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x09, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0A, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0B, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0C, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0D, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0E, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x0F, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x10, 0x00)
binhoNova.setSlaveWriteMaskI2C(0, 0x11, 0x00)
# set the Pointer register to 0x00
binhoNova.setSlaveWriteMaskI2C(0, 'PTR', 0x00)
print(binhoNova.getSlaveWriteMaskI2C(0, 'PTR'))
# read back the configuration and print it out
for i in range(12):
print(binhoNova.getSlaveRegisterI2C(0,6+i))
print(binhoNova.getSlaveWriteMaskI2C(0,6+i))
print()
print()
print("It's Over!")
binhoNova.close()The packaged releases contains two libraries:
This library is essentially a wrapper for all of the commands presented in the ASCII Command Set documentation. The library is written in such a way to support multiple devices as well as properly handling INTERRUPTS by making use of threads.
This library provides a handful of functions which aid in device management, as in identifying COM ports and Binho devices attached to the host computer.
Here's where the releases live on PyPi:
The officially-supported Python library can easily be installed using pip:
This library is cross-platform and is intended for use with Python 3.x.
There are also many examples of the python libraries in action in the examples section of the support portal:
The library contains two classes, each with a distinct purpose. Please see the following pages for the documentation on each of these classes.
Functions to connect to a host adapter and interact with it:
Utility functions for device discovery and management:
If Step 5 above fails, please try the alternate installation process detailed below.
At this time, our Windows 7 driver regrettably does not support communicating with the Binho Nova while it's in Bootloader mode. You will need to connect the device to a computer running Windows 8+, MacOS, or Ubuntu in order to update the device firmware.
If you are unable to install the driver following the method above by "Browsing", please try the manual process below, beginning after completing Step 4 above.


We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The Binho Nova Multi-Protocol USB Host Adapter pairs elegantly with pytest to implement an incredibly robust and efficient hardware and firmware testing platform.
We'll leave discussion of the features of pytest for their own very-thorough documentation, and just hit on a few tips to make it fast and easy to get started using it with your host adatper.
In order for the serial connection with your Binho Nova to persist through the entire test plan, you'll want to use a fixture. This is as easy as creating a conftest.py file in the test directory. Additionally, allow it accept command line parameters for device IDs, as this makes it easy to use multiple adapters on the same host computer.
Here's an example of a conftest.py file which creates two fixtures, one for each Binho Nova used in the testing:
In this fashion, the serial connections with the devices will be opened up at the beginning of the testing. Then, using these devices from within the test cases is simple, just pass them into each function that uses them as a parameter. Here's an example function to demonstrate this:
Writing automated hardware and firmware tests has never been easier!






We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The example below demonstrates how to read from and write to an I2C EEPROM. This particular demo uses the from Sparkfun.
DAPLink mode allows a Binho Nova to be utilized as a programmer / debugger for ARM microcontrollers. By entering DAPLink mode, the Nova will enumerate as a CMSIS-DAP interface that can be discovered by OpenOCD, pyOCD, and even your favorite IDEs. As such, the Nova becomes a robust device which bridges the gap between expensive & powerful debuggers such as and cheap bare board tools or illegal knock-off devices.
Binho Nova's DAPLink mode supports the SWD interface (SWDIO, SWCLK, and RESET signals) as well as a UART bridge to a virtual COM port (using the same TX, RX signals as in normal Nova operation).
DAPLink is an open-source software project that is developed and maintained by ARM that enables programming and debugging of ARM Cortex CPUs. Please check out the official DAPLink website for more specific details:
The Binho Nova Multi-Protocol USB Host Adapter is designed for ease of use in every aspect, and that's especially true when it comes to updating the device firmware. In an effort to provide the greatest flexibility in accommodating our different customers' development and testing environments, we offer a variety of ways to update the Nova device firmware. Below we detail how to update the firmware through three main methods: using Mission Control, using our python library, and manually using a Serial Terminal.
Please note that disk drive encryption software (such as BitLocker) will likely prevent the firmware update process of completing successfully. An upcoming release of Mission Control will include the necessary functionality to resolve this issue.
We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The following script can be used to repeat UART streams captured and exported from Saleae Logic. After the capture is completed, export the Async Serial analyzer results as a csv file. You can follow to export the file. The exported data should be in HEX-- Note that the base/radix of the exported data will match the current setting for display in the software.
Simply modify the parameters in lines 9-18 in the script below and then everything is ready to play back the file from the Binho Multi-Protocol USB Host Adapter.
pip install binho-host-adapterfrom binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
print("Demo Script with Binho Host Adapter Python Libraries")
print
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
if len(devices) == 0:
print("No Devices Found!")
exit()
elif len(devices) == 1:
COMPORT = devices[0]
print("Found 1 attached adapter @ " + devices[0])
print
else:
COMPORT = devices[0]
print("Found more than 1 attached adapter, using first device found on " + COMPORT)
print
print("Opening " + COMPORT + "...")
print
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(COMPORT)
print("Connecting to host adapter...")
print(binho.getDeviceID())
print
There are a number of accessories available that can make using a Binho Multi-Protocol USB Host Adapter even more convenient.
First in line is the breadboard breakout, making it easy to interface with 0.1" headers. This is such a common need that one of these is included with the host adapter, but it's good to know where to get more:
Breadboard BreakoutQwiic is a fairly new open standard when it comes to hooking up I2C devices, brought to the world by Sparkfun Electronics and gaining adoption across the open-source hardware industry. We've made a board which makes it easy to interface the Binho Multi-Protocol USB Host Adapter with qwiic devices. This board is also a great way to breakout the header to a number of pins which can easily be jumped to other circuits or observed with your logic analyzer.
Qwiic Interface BoardIf you're working with a fixture or board that was designed for use with another common host adapter, but you'd like to find an easy way to get it hooked up to your Binho Multi-Protocol USB Host Adapter, then perhaps the Total Retrofitter is exactly what you're looking for:
Total RetrofitterIf you have an idea for an accessory that would make your job easier, please feel to let us know at [email protected] and we'll see what we can do to help.




def test_TestDevicesCommCheck(self, dut, testFixture):
response = dut.ping()
assert response == '-OK'
response = testFixture.ping()
assert response == '-OK'
response = dut.setLEDColor('YELLOW')
assert response == '-OK'
response = testFixture.setLEDColor('YELLOW')
assert response == '-OK'We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The following python script demonstrates how to use the SWI host Nova functionality of the Binho Multi-Protocol USB Host Adapter with the Atmel (now Microchip) ATSHA204A CryptoAuthentication IC. Communication with other devices from this family will be strikingly similar.
A special shout out to our friends at Sparkfun who produced a similar example above for their ATSHA204 Arduino Library many, many moons ago. This demo is built to match their example.
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
import pytest
def pytest_addoption(parser):
parser.addoption(
"--dutID", action="store", default="0xc59bb495504e5336362e3120ff032d2c", help="dutID: the GUID of the device to perform the test on"
)
parser.addoption(
"--fixtureID", action="store", default="0xa917ec725150464a39202020ff172123", help="fixtureID: the GUID of the test fixture device"
)
@pytest.fixture(scope="session")
def dut(request):
# enter the deviceID of target test device
binho_test_deviceID = request.config.getoption('--dutID')
utilities = binhoUtilities.binhoUtilities()
binhoTesterCommPorts = utilities.getPortByDeviceID(binho_test_deviceID)
binhoTesterCommPort = 0
if len(binhoTesterCommPorts) == 0:
print("ERROR: No Binho Tester Device found!")
exit(1)
elif len(binhoTesterCommPorts) > 1:
print("ERROR: More than one Binho Tester Device found!")
exit(1)
else:
binhoTesterCommPort = binhoTesterCommPorts[0]
print("Found Binho Tester Device on " + binhoTesterCommPort)
print("Opening " + binhoTesterCommPort + "...")
print
# create the binhoHostAdapter object
testDevice = binhoHostAdapter.binhoHostAdapter(binhoTesterCommPort)
print("Connecting to binho host adapter tester...")
print
def teardown():
#print('--test device teardown')
testDevice.close()
request.addfinalizer(teardown)
return testDevice
@pytest.fixture(scope="session")
def testFixture(request):
# enter the deviceID of target test device
binho_test_deviceID = request.config.getoption('--fixtureID')
utilities = binhoUtilities.binhoUtilities()
binhoTesterCommPorts = utilities.getPortByDeviceID(binho_test_deviceID)
binhoTesterCommPort = 0
if len(binhoTesterCommPorts) == 0:
print("ERROR: No Binho Tester Device found!")
exit(1)
elif len(binhoTesterCommPorts) > 1:
print("ERROR: More than one Binho Tester Device found!")
exit(1)
else:
binhoTesterCommPort = binhoTesterCommPorts[0]
print("Found Binho Tester Device on " + binhoTesterCommPort)
print("Opening " + binhoTesterCommPort + "...")
print
# create the binhoHostAdapter object
testDevice = binhoHostAdapter.binhoHostAdapter(binhoTesterCommPort)
print("Connecting to binho host adapter tester...")
print
def teardown():
#print('--test device teardown')
testDevice.close()
request.addfinalizer(teardown)
return testDevice
from binhoHostAdapter import binhoHostAdapter
from time import sleep
class Sparkfun_QwiicEEPROM:
def __init__(self, addr, pageWriteMs):
self.eeprom_address = addr;
self.eeprom_pageWriteTime_ms = pageWriteMs
def begin(self, adapter):
self.hostAdapter = adapter
def writePage(self, memAddress, pageData):
memAddressHigh = (memAddress >> 8)
memAddressLow = memAddress & 0xFF
fullAddress = [memAddressHigh, memAddressLow]
## load the address into the buffer
self.hostAdapter.writeToBuffer(0, 0, fullAddress)
## load the data into the buffer
self.hostAdapter.writeToBuffer(0, 2, pageData)
## I2C Start Transmission
self.hostAdapter.startI2C(0, self.eeprom_address)
## I2C Write Buffer
self.hostAdapter.writeFromBufferI2C(0, 34)
## I2C End Transmission
self.hostAdapter.endI2C(0)
## Clear the Buffer
self.hostAdapter.clearBuffer(0)
def readPage(self, memAddress):
memAddressHigh = (memAddress >> 8)
memAddressLow = memAddress & 0xFF
## Clear the Buffer
self.hostAdapter.clearBuffer(0)
## I2C Start Transmission
print(self.hostAdapter.startI2C(0, self.eeprom_address))
print(self.hostAdapter.writeByteI2C(0, memAddressHigh))
print(self.hostAdapter.writeByteI2C(0, memAddressLow))
## I2C End Transmission
print(self.hostAdapter.endI2C(0))
## Request the data
self.hostAdapter.readToBufferI2C(0, self.eeprom_address, 32)
print(self.hostAdapter.readBuffer(0, 32))
def pageWriteDelay(self):
return self.eeprom_pageWriteTime_ms / 1000.0
# Change this to match your COMPort
COMPORT = "COM27"
print("EEPROM Example using Binho Host Adapter")
print("v1.0 -- Jonathan Georgino <[email protected]>")
print()
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(COMPORT)
eeprom = Sparkfun_QwiicEEPROM(0xA0, 1)
print("Connecting to host adapter...")
print(binho.getDeviceID())
print()
print("Configuring I2C settings...")
binho.setOperationMode(0, "I2C")
binho.setPullUpStateI2C(0, "EN")
binho.setClockI2C(0, 400000)
print("Ready!")
print()
eeprom.begin(binho)
currentMemoryAddress = 0x0000
print("Starting to write to the EEPROM ...")
for i in range(4):
print("Writing Page #" + str(i))
pageData = [0xAA+i, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0]
pageData += [0xAB+i, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1]
print("PageData=")
print(pageData)
eeprom.writePage(currentMemoryAddress, pageData)
currentMemoryAddress += 32
sleep(eeprom.pageWriteDelay())
print()
print()
currentMemoryAddress = 0
print("Starting to read to the EEPROM ...")
for i in range(4):
print("Reading Page #" + str(i))
eeprom.readPage(currentMemoryAddress)
currentMemoryAddress += 32
print()
print()
binho.close()from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
# change this to your COM port
binhoTesterCommPort = 'COM22'
# create the binhoHostAdapter object
binhoTester = binhoHostAdapter.binhoHostAdapter(binhoTesterCommPort)
print("Connecting to binho host adapter tester...")
print()
swiIndex = 0
binhoTester.setLEDColor('CYAN')
binhoTester.setOperationMode(0, 'SWI')
binhoTester.beginSWI(swiIndex, 0, True)
# Begin Wake/ID Example
binhoTester.sendTokenSWI(swiIndex, "WAKE")
print(binhoTester.receiveBytesSWI(swiIndex, 4))
# Begin Serial Number Example
binhoTester.setPacketOpCodeSWI(swiIndex, 0x02)
binhoTester.setPacketParam1SWI(swiIndex, 0x00)
binhoTester.setPacketParam2SWI(swiIndex, 0x0000)
binhoTester.sendPacketSWI(swiIndex)
print(binhoTester.receiveBytesSWI(swiIndex, 7))
binhoTester.setPacketOpCodeSWI(swiIndex, 0x02)
binhoTester.setPacketParam1SWI(swiIndex, 0x00)
binhoTester.setPacketParam2SWI(swiIndex, 0x0002)
binhoTester.sendPacketSWI(swiIndex)
print(binhoTester.receiveBytesSWI(swiIndex, 7))
binhoTester.setPacketOpCodeSWI(swiIndex, 0x02)
binhoTester.setPacketParam1SWI(swiIndex, 0x00)
binhoTester.setPacketParam2SWI(swiIndex, 0x0003)
binhoTester.sendPacketSWI(swiIndex)
print(binhoTester.receiveBytesSWI(swiIndex, 7))
# Begin MAC Challenge Example
print('clearing buffer')
print(binhoTester.clearPacketSWI(0))
data = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]
print(binhoTester.writeToBuffer(0, 0, data))
print(binhoTester.setPacketOpCodeSWI(swiIndex, 0x08))
print(binhoTester.setPacketParam1SWI(swiIndex, 0x00))
print(binhoTester.setPacketParam2SWI(swiIndex, 0x0000))
print(binhoTester.setPacketDataFromBufferSWI(swiIndex, 32, "BUF0"))
print(binhoTester.sendPacketSWI(swiIndex))
#these first two will return NG because not enough time passed for the execution of the above command
binhoTester.receiveBytesSWI(swiIndex, 0x23)
binhoTester.receiveBytesSWI(swiIndex, 0x23)
# this one will actually return the response we are looking for
print(binhoTester.receiveBytesSWI(swiIndex, 0x23))
print(binhoTester.setPacketOpCodeSWI(swiIndex, 0x08))
print(binhoTester.setPacketParam1SWI(swiIndex, 0x00))
print(binhoTester.setPacketParam2SWI(swiIndex, 0x0000))
binhoTester.setPacketDataSWI(swiIndex, 0, 0x00)
binhoTester.setPacketDataSWI(swiIndex, 1, 0x11)
binhoTester.setPacketDataSWI(swiIndex, 2, 0x22)
binhoTester.setPacketDataSWI(swiIndex, 3, 0x33)
binhoTester.setPacketDataSWI(swiIndex, 4, 0x44)
binhoTester.setPacketDataSWI(swiIndex, 5, 0x55)
binhoTester.setPacketDataSWI(swiIndex, 6, 0x66)
binhoTester.setPacketDataSWI(swiIndex, 7, 0x77)
binhoTester.setPacketDataSWI(swiIndex, 8, 0x88)
binhoTester.setPacketDataSWI(swiIndex, 9, 0x99)
binhoTester.setPacketDataSWI(swiIndex, 10, 0xAA)
binhoTester.setPacketDataSWI(swiIndex, 11, 0xBB)
binhoTester.setPacketDataSWI(swiIndex, 12, 0xCC)
binhoTester.setPacketDataSWI(swiIndex, 13, 0xDD)
binhoTester.setPacketDataSWI(swiIndex, 14, 0xEE)
binhoTester.setPacketDataSWI(swiIndex, 15, 0xFF)
binhoTester.setPacketDataSWI(swiIndex, 16, 0x00)
binhoTester.setPacketDataSWI(swiIndex, 17, 0x11)
binhoTester.setPacketDataSWI(swiIndex, 18, 0x22)
binhoTester.setPacketDataSWI(swiIndex, 19, 0x33)
binhoTester.setPacketDataSWI(swiIndex, 20, 0x44)
binhoTester.setPacketDataSWI(swiIndex, 21, 0x55)
binhoTester.setPacketDataSWI(swiIndex, 22, 0x66)
binhoTester.setPacketDataSWI(swiIndex, 23, 0x77)
binhoTester.setPacketDataSWI(swiIndex, 24, 0x88)
binhoTester.setPacketDataSWI(swiIndex, 25, 0x99)
binhoTester.setPacketDataSWI(swiIndex, 26, 0xAA)
binhoTester.setPacketDataSWI(swiIndex, 27, 0xBB)
binhoTester.setPacketDataSWI(swiIndex, 28, 0xCC)
binhoTester.setPacketDataSWI(swiIndex, 29, 0xDD)
binhoTester.setPacketDataSWI(swiIndex, 30, 0xEE)
binhoTester.setPacketDataSWI(swiIndex, 31, 0xFF)
print(binhoTester.sendPacketSWI(swiIndex))
#these first two will return NG because not enough time passed for the execution of the above command
binhoTester.receiveBytesSWI(swiIndex, 0x23)
binhoTester.receiveBytesSWI(swiIndex, 0x23)
# this one will actually return the response we are looking for
print(binhoTester.receiveBytesSWI(swiIndex, 0x23))
binhoTester.close()from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
from datetime import datetime, timedelta, time
import math
import csv
uartIndex = 0
uartBaudRate = 9600
uartDataBits = 8
uartParity = 'NONE'
uartStopBits = 1
uartEscapeString = "+++UART0"
captureExportFile = 'C:\\Users\\Batman\\Desktop\\LogicExports\\uart_9600.csv'
binhoCommPort = 'COM27'
# ---- No Need to Change Anything Below Here ----
print("Opening " + binhoCommPort + "...")
print()
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(binhoCommPort)
print("Connecting to binho host adapter...")
print()
print("Connected!")
print()
binho.setLEDColor('YELLOW')
print("Setting UART bus parameters:")
print()
binho.setOperationMode(0, 'UART')
print('BaudRate: ' + str(uartBaudRate))
binho.setBaudRateUART(uartIndex, uartBaudRate)
print('Databits: ' + str(uartDataBits))
binho.setDataBitsUART(uartIndex, uartDataBits)
print('Parity Bit: ' + str(uartParity))
binho.setParityUART(uartIndex, uartParity)
print('Stop Bits: ' + str(uartStopBits))
binho.setStopBitsUART(uartIndex, uartStopBits)
binho.setEscapeSequenceUART(uartIndex, uartEscapeString)
print()
print("Computing USB Transit time...")
t0 = datetime.now()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
t1 = datetime.now()
avgUSBTxTime = (t1 - t0)/5
print('Average USB Tx Time = ' + str(avgUSBTxTime) + 's')
print()
print("Beginning Replay...")
print()
binho.beginBridgeUART(uartIndex)
with open(captureExportFile) as captureExport:
capture_reader = csv.reader(captureExport, delimiter=',')
rowCount = 0
startTime = datetime.now()
prevTimestamp = startTime
prevRowTime = 0
for row in capture_reader:
if rowCount == 0:
# These are the column headers, just advance to the next row
rowCount += 1
print('Row#\tTimestamp\t\t\t\tData')
else:
currRowTime = float(row[0])
payload = int(row[1], 16)
deltaTimems = (currRowTime - prevRowTime) * 1000
#deltaTimems = 0.125 * 1000
#print('DeltaT: ' + str(deltaTimems))
#print('computed delta: ' + str(timedelta(0,0,0,math.floor(deltaTimems))))
while (datetime.now() - prevTimestamp) < timedelta(0,0,0,math.floor(deltaTimems)):
#nothing, sleep does not have high enough resolution
# print('WAITING ' + str(datetime.now() - prevTimestamp))
pass
binho.writeBridgeUART(chr(payload))
prevTimestamp = datetime.now()
prevRowTime = currRowTime
print(str(rowCount) + '\t' + str(prevTimestamp) + '\t\t' + str(payload))
rowCount += 1
binho.stopBridgeUART(uartEscapeString)
binho.ping()
print('Finished Replaying...')
print()
binho.setLEDColor('BLUE')
binho.close()
print('Goodbye!')You can put your Nova into DAPLink mode using our python library CLI with the following command:
This will then download our DAPLink-capable firmware to the device. Note that the device cannot be used as a host adapter while in DAPLink mode. (One of the big limitations is that the pins for the SWD interface are the same as other protocols). Note that you can confirm that your device is in DAPLink mode by using the binho info command:
The pinout of the wire harness for Nova when in DAPLink mode is as shown in the table below:
Pin Number
Function
IO0
SWDIO
IO1
nRESET
IO2
SWCLK
IO3
UART RX (same as normal mode)
IO4
UART TX (same as normal mode)
It's only necessary to connect the SWDIO and SWCLK signals to the target MCU, most can be reset without the reset signal through various commands. At Binho, we've tested this on ARM-M0 devices from Atmel, Nordic Semiconductor, and Nuvoton.
These common tools have no problem discovering the device and using it as if it were a 'CMSIS-DAP' device (the predecessor of the DAPLink project).
You can verify it's working with pyOCD by sending the 'pyocd list' command:
You can verify it's working with OpenOCD with this command:
Two quick notes:
1) You'll need to add the binho-nova.cfg file to the scripts/interfaces directory of your OpenOCD installation. The file can be downloaded here:
2) The last line 'Error' is what will be displayed if the MCU isn't connected or powered on. When an MCU is connected, it will display some information about the target MCU instead of the error message.
Hey! Wouldn't it be great if I could simply issue a single command line statement to flash a .hex or .bin file to my microcontroller? We put together a demo script that uses our Python library + the pyOCD scripting interface to show how that can be done.
It's implemented in python library as the binho flasher command, and takes a few parameters. You can see the various arguments by passing the -h / --help flag to the command to display them on the console:
Or you can just take a look at the code for the script in our repository.
Seeed produced a great guide demonstrating how to use a DAPLink device with OpenOCD, Eclipse, Keil, and IAR Embedded Workbench. The configuration for Nova DAPLink mode should be extremely similar to their guide: Debug and Flash Example for IDEs [Seeed]
When you're finished using the device in DAPLink mode, issue the following command to return Binho Nova back to normal operation:
You can verify that your device is back in normal mode using the binho info command, just as we did above:
If you've made it this far, please reach out and let us know your thoughts about this feature. We'd love to hear from you!
The easiest way to update your Nova device is through our Mission Control GUI software, which allows you to both automatically and manually update the device firmware. Watch the video below where we show how to automatically and manually update the device firmware through our Mission Control software.
From the drop down menu in the Device tab of Mission Control select the connect device you want to update and click the "Connect" button.
If your Nova device does not have the latest firmware already installed, a prompt will automatically appear when the device is successfully connected. To update your Nova device, simply click "Continue"
After reconnecting to the newly updated device, you can verify the firmware version in the Device tab of Mission Control.
From the drop down menu in the Device tab of Mission Control select the connect device you want to update and click the "Connect" button.
Clicking the "Bootloader" button in the Device tab of Mission Control resets the Binho Nova device into the bootloader. The device will then show up as a Mass Storage Device (similar to a USB drive or SD card) with a Volume Name of "BINHOBTLDR".
Download the firmware version that you want to load on to your Nova device from the Binho Support portal here. The firmware file is downloaded as a .fig file.
Now that the Binho Nova Multi-Protocol USB Host Adapter looks like a storage device and you have downloaded the .fig file of the desired firmware, all one needs to do is save the firmware file (.FIG extension) to the drive. This is as simple as copy/paste or drag and drop. When a valid firmware file has been written to the drive, it will automatically restart in a few seconds.
After reconnecting to the newly updated device, you can verify the firmware version in the Device tab of Mission Control.
The Python command line interface shown below is part of our new library. Details here.
With the Nova connected to your computer, simply issue the following command in a terminal/shell:
This command will starts by querying our servers to see if there's a newer firmware version available. If the latest firmware is already installed, the command returns with a message confirming that the latest firmware is already on the device. Otherwise, it will downloaded the latest firmware file, reboot Nova into it's bootloader, and then load the new firmware onto the device automatically.
Note 1: This command can also be used to load a specific firmware version onto the device by removing the --latest flag and providing a version number using the -r parameter as shown below:
Note 2: Depending on your OS / configuration, you may see a file explorer pop up when Nova enters bootloader mode. This is because Nova's bootloader implements a mass storage device which looks like a removable drive was connected to the OS temporarily.
The firmware version can be verified with the binho info command:
This will return the firmware version currently running on the device, as show below:
The first step is reboot the device into the bootloader. This is achieved simply by sending the +BTLDR ASCII Command to the device while it's connected to your host PC. This will immediately terminate the virtual comport connection. After a few seconds, the device will show up as new Mass Storage Device (similar to a USB drive or SD Card) with a Volume Name of "BINHOBTLDR".
Now that the Binho Multi-Protocol USB Host Adapter looks like a storage device, all one needs to do is save the firmware file (.FIG extension) to the drive. This is as simple as copy/paste or drag and drop. When a valid firmware file has been written to the drive, it will automatically restart in a few seconds.
Once the device has restarted, simply open up the serial connection and verify the new firmware version by sending the +FWVER ASCII Command.
That's all there is to it! We'll be releasing new functionality via firmware updates frequently, so be sure to check for new releases and update often. The firmware releases can be found here:




The Binho Nova Multi-Protocol USB Host Adapter can serve as a SPI bus controller device which can be configured to meet the needs of nearly any SPI bus implementation. The SPI Clock can be set to a frequency between 500kHz and 12MHz, and all 4 SPI modes are supported. Transfers can be in 8-bit or 16-bit packets. The pin assignments for the SPI protocol are show in the graphic below, indicated in yellow:
The following table gives a brief overview of the available SPI commands.
Commands
Description
Link
CLK
Gets/sets the SPI clock frequency.
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 on the SPI bus.
The first step in using the Binho Nova Multi-Protocol USB Host adapter as a SPI Controller is to put the adapter into SPI mode using the command.
Now the host adapter is in SPI communication mode. The next step is to configure the SPI bus. Here are the default settings:
SPI Clock Frequency = 2MHz
SPI Mode = 0 (CPOL = 0, CPHA = 0)
8 Bit Packet Size (TXBITS)
MSB-First bit ordering.
Let's change the bus configuration to a 5MHz clock:
And let's setup the IO0 pin to use as our chip-select signal. For this device, the chip-select signal is active low, so IO0 should be a digital output that is idle high.
The bus is now all setup and ready to go.
Begin by putting the SPI signals (SCK, SDI, SDO) in their initial state simply by using the BEGIN command.
In order to begin transferring data over the SPI bus, one must first assert the chip-enable/chip-select signal of the peripheral device.
Now the chip-select signal is asserted and our target SPI peripheral device is ready to communicate.
Let's do a 5 byte transfer, which consists of sending a 1-byte command and then clocking out a 4-byte response.
Well that sure was tedious... and something seems strange. Looks like the peripheral device didn't return any data because we were too slow. It's fairly common for devices to have timing requirements regarding the duration of a transfer. Thankfully, for situations like this, we can use the buffer! Let's load up the buffer with our data:
Now let's perform the SPI transaction using BUF0 and send 5 bytes from BUF0, using IO0 as the ChipSelect pin (active-low):
Since we are using the buffer, the received data is also placed into the buffer. Let's read it out and see if the device responded as expected:
Awesome! The expected response was received. That's pretty much all it takes to use the Binho Nova Multi-Protocol USB Host Adapter to speak with SPI devices. Simply clear out the buffer and repeat the process to start another transfer.
Note that this example didn't cover using IO1, but it's not hard to imagine how this could be used as an interrupt pin, or to control the chip-select pin of a second peripheral device on the SPI bus.
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:
For use cases where a lot of data is being read/written and speed is important, the WHR command should be utilized to minimize the amount of communication between the Nova and the host PC. You can learn all the details about this .
Otherwise, stick around here and move to the next page to see a similar tutorial on an I2C bus.
The Binho Nova Multi-Protocol USB Host Adapter can function as a Dallas 1-WIRE host device. This protocol can be configured to operate on any of the IO pins on the device, however it is especially convenient to use it on IO0 and IO2 as the internal pull-up resistor can be used thus eliminating the need for an external pull-up resistor.
The following table gives a brief overview of the available 1WIRE commands.
Command
Description
Link
BEGIN
Starts the 1-Wire host on the given IO pin.
RESET
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 on the 1-WIRE bus.
The first step in using the Binho Nova Multi-Protocol USB Host Adapter as a 1-Wire host is to put the adapter into 1-WIRE mode using the command.
Now the host adapter is in 1-WIRE communication mode. The 1-Wire bus has no configurable settings, so all we need to do is decide which IO pin we want to use. Let's take advantage of the internal pull-up resistor on IO0:
And just like that, we're ready to start communicating with 1-Wire devices on the bus.
Let's get things started off right by first resetting all the devices on the bus:
With all the devices reset, it's now possible to begin the process of selecting the device that will be communicated with. Let's start a search for devices on the bus -- but before doing the search, let's make sure we start at the beginning of searching through the devices by reseting the search.
Alright, now let's begin the search:
Let's see what the search found. We'll query the address to see what device was found:
That's great - the exact device we were looking for! Now that we know the address of desired device is in the ADDR field, we can move ahead with sending and receiving data.
Now let's get the device's attention and ready to interact with us. This is done by sending another RESET command:
Now let's select the device we'll be communicating with -- recall that it's address is already in memory from the result of our SEARCH command.
Finally let's do some reading and writing:
That's all there is to it! Of course getting the transaction complete before any timeouts occur can be challenging when manually interacting with the devices on the bus using these commands, however this isn't an issue when scripting the interactions. When it comes to manually interacting with 1-Wire devices, we highly recommend using the command. You can see how to do this in our video tutorial embedded below:
Check out the examples section to see how to use 1-Wire in an automated way:
1-Wire is just one of the common protocols which utilizes just one signal for bi-directional communication. On the next page we'll look at Atmel's Single-Wire Interface which is another similar protocol.
Gets/sets the current mode of a specific IO signal. Note that not all modes of operation are available on all pins. Please see the pin out diagram on the Using IO page for reference.
Set current mode value: IO[n] MODE [mode]
Get current mode value: IO[n] MODE ?
Parameters:
This function takes on parameter, mode:
To set IO pin mode to Digital Input, use DIN
To set IO pin mode to Digital Output, use DOUT
To set IO pin mode to Analog Input, use AIN
Response:
Set: This function returns an if the command succeeds in setting the supplied mode of operation to the specified IO pin. If the command fails, the function will return a .
Get: This function returns -IO[n] followed by MODE followed by the current mode.
Example Usage:
Gets/sets the interrupt configuration of a specific IO signal. Note that not all IO signals are capable of supporting hardware interrupts. Please see the pin out diagram on the page for reference.
Set Interrupt configuration: IO[n] INT [trigger]
Get Interrupt configuration: IO[n] INT ?
Parameters:
This function takes on parameter, trigger:
To configure interrupt on rising edge, use RISE
To configure interrupt on falling edge, use FALL
To configure interrupt on either edge, use CHANGE
Response:
Set: This function returns an if the command succeeds in configuring the interrupt on the specified IO pin. If the command fails, the function will return a .
Get: This function returns -IO[n] followed by INT followed by the current interrupt configuration.
Example Usage:
Gets/sets the current value of a specific IO signal. The meaning of the value is dependent on the current mode setting of the signal. The acceptable units for value depends on the current pin mode of operation.
Set value: IO[n] VALUE [val]
Get value: IO[n] VALUE ?
Parameters:
This function takes on parameter, val:
When the pin is configured as a digital output:
val can be 0 or LOW to set the output low
val can be 1 or HIGH to set the output high
When the pin is configured as an analog output:
Response:
Set: This function returns an if the command succeeds in configuring the output on the specified IO pin. If the command fails, the function will return a .
Get: This function returns -IO[n] followed by VALUE followed by the current value of the IO pin, which depends on the current operating mode of the pin.
When the pin is configured as a digital input or output, returned value will be either 0 or 1
Example: IO[n] VALUE 0
When the pin is configured as an analog input or output, returned value will be in counts and volts
Example Usage:
Gets/sets the current value of the PWM frequency of a specific IO signal. This is only applicable when in PWM Mode. Note that IO0 and IO2 share a PWM Frequency, and IO3 and IO4 share a PWM Frequency. The default PWM frequency is 10kHz.
Set Frequency: IO[n] PWMFREQ [frequency]
Get Frequency: IO[n] PWMFREQ ?
Parameters:
This function takes on parameter, frequency, which can be from 750Hz to 80000Hz.
Response:
Set: This function returns an if the command succeeds in configuring the PWM frequency on the specified IO pin. If the command fails, the function will return a .
Get: This function returns -IO[n] followed by PWMFREQ followed by the currently configured PWM frequency.
Example Usage:
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:
Command
Description
Link
CFG
Gets/sets the UART configuration by passing a configuration string.
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 command.
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
8 Databits
No Parity bit
1 Stop bit
Let's change the baudrate to match our desired communication speed:
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.
Once opened, the UART bridge will pass on every character received to it. The only graceful way to close the bridge and get back to the command interface of the Binho Multi-Protocol USB Host Adapter is to transmit the escape sequence from the computer to the host adapter.
Let's do a quick exercise to solidify our understanding. The ESC command can be queried so that nothing needs to be memorized:
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:
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.
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The host adapter includes a 256-byte buffer which can be used to optimize multi-byte read and writes using any of the supported communication protocols.
This function clears the entire buffer, setting all bytes to 0.
Inputs:
This function one parameter, index. There is only one buffer, so this will always be 0.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command.
Example Usage:
This function adds a single byte to the buffer. Note that the buffer automatically keeps track of / auto-increments the index as data is loaded.
Inputs:
This function takes two parameters:
index, the index of the buffer. There is only one buffer, so this will always be zero.
val, as 8-bit integer value.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command.
Example Usage:
This function reads out a given number of bytes from the buffer. Note that the bytes are not cleared out of the buffer after the read. They will remain in the buffer until they are overwritten or when the buffer is cleared.
Inputs:
This function takes two parameters:
index, the index of the buffer. There is only one buffer, so this will always be zero.
numBytes, an 8-bit integer value of the number of bytes to read from the buffer.
Outputs:
The host adapter will respond with 'BUF0' followed by numBytes of bytes read from the buffer separated by spaces.
Example Usage:
This function writes up to 32 bytes into the buffer in a single transaction, beginning at the startIndex index in the buffer. This provides for a faster way to fill the buffer when the data is predetermined, such as when programming memory devices.
Inputs:
This function takes three parameters:
index -- the index of the buffer. There is only one buffer, so this will always be zero.
startIndex -- the position in the buffer that the first byte should be stored. The index will be incremented for each of the following bytes.
values -- an array of up to 32 bytes of data to be loaded into the buffer beginning at the startIndex position.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
The Binho Socket Station provides the most convenient way to combine devices from your favorite form-factors and ecosystems in an elegant way. The board features sockets for a mikroBUS click and a Feather, as well as a Qwiic / StemmaQT connector to interface your favorite I2C devices. There are two ground loops soldered at the corners for easy signal probing with your scope or DMM. And of course, there's connectors to connect your Binho Nova to the SPI, I2C, and UART buses that interconnect these devices. The 3V3 and 5V power rails can be sourced by the attached Binho Nova, or can be isolated from the Nova via jumpers.
The silkscreen on the back of the PCB clearly shows the wiring between the Feather and mikroBUS click sockets for easy reference, and the board sits on 4 x bump-on feet to protect your desk. This board comes fully soldered and ready for action.
This accessory is available for purchase in our online store here.

The first set of commands covered in this guide are the "Device" commands. These commands are not related to any particular protocol or feature, rather they configure general functionality of the host adapter.
Functions related to the communication, setting the host adapter mode of operation, identifying the device, and resting the device can all be accomplished using the Device commands.
We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The example below demonstrates how to read from and write to an I2C FRAM. Beyond that, it's also an excellent example of how to port an open-source Arduino library into a python script that can utilize the Binho Multi-Protocol USB Host Adapter.
This example is uses a 256Kbit I2C FRAM (MB85RC256V / Fujitsu) breakout board from our friends over at Adafruit. You can purchase it .
For comparison's sake, you can see the Adafruit Arduino library that this example was ported from
We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The following script can be used to repeat I2C transactions captured and exported from Saleae Logic. After the capture is completed, export the I2C analyzer results as a csv file. You can follow to export the file. The exported data should be in HEX-- Note that the base/radix of the exported data will match the current setting for display in the software.
Simply modify the parameters in lines 9-15 in the script below and then everything is ready to play back the file from the Binho Nova Multi-Protocol USB Host Adapter.
This release introduces the following enhancements:
no new features or enhancements
This release fixes the following bugs:
Fixed ADC pin mappings for IO0, IO1, and IO2 that could be swapped in some cases
The ASCII Command Set provides an easy means to open up a serial port connection and interact with the device via a human-readable protocol. This is ideal for tasks such as debugging device drivers / performance issues, as well as device evaluation and proof of concept development.
The ASCII Commands are broken down into several categories.
This release introduces the following enhancements:
I2C Peripheral mode of operation now supports BANK commands. Now the entire register bank can be read/written to with a single command to Nova. See the python library example .
IO pins now have a Toggle() command which can instruct Nova to perform a toggle of a precise time duration (from 5microseconds to 265milliseconds). See the python library example .
binho daplinkPS C:\Users\Jonathan> binho info
Found a Binho Nova [in DAPLink Mode]
Port: COM3
Device ID: 0X1C4780B050515950362E3120FF141C2A
Note: This device is in DAPlink Mode! It can be returned to host adapter (normal) mode
by issuing 'binho daplink -q' command.PS C:\Users\Jonathan> pyocd list
# Probe Unique ID
----------------------------------------------------------
0 Binho CMSIS-DAP 1C4780B050515950362E3120FF141C2Aopenocd.exe -f interface/binho-nova.cfgPS C:\Program Files\openocd-0.10.0\bin-x64> .\openocd.exe -f interface/binho-nova.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 500 kHz
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.10
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Error: BUG: current_target out of boundsbinho flasher -hbinho daplink -qPS C:\Users\Jonathan> binho info
Found a Binho Nova
Port: COM3
Device ID: 0X1C4780B050515950362E3120FF141C2A
Firmware Version: 0.2.5 [Up To Date]binho dfu -v --latestbinho dfu -v -r 0.2.2binho infoFound a Binho Nova
Port: COM3
Device ID: 0X1C4780B050515950362E3120FF141C2A
Firmware Version: 0.2.5 [Up To Date]Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
OS X Yosemite 10.10.5
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
Removed debug code that was errantly included in the last release that could cause unexpected transitions on IO pins.
This release fixes the following bugs:
None








The Binho Nova Multi-Protocol USB Host Adapter has been designed so that it can be compatible with as many systems as possible. By utilizing the USB Communications Device Class standard driver, it's possible to use your host adapter with any operating system which includes support for this type of USB device. This includes all modern versions of Windows (beginning with Windows Vista), Mac OS X, and Ubuntu. Additionally, it even works on Android-based mobile devices.
The only hardware-specific requirements is that your host PC has one available USB 2.0 port. The supplied USB cable features a Type-A male connector due to it's popularity, however another USB cable can be used to match the mating connector of the host device.
Given the above, it's easy to see that the Binho Nova Multi-Protocol USB Host Adapter can also be used with a variety of single-board computers such as the Raspberry Pi and others.
The device category includes functions which get device information, control the LED, and set the mode of operation among other things.
The buffer category includes the functions necessary to read/write the internal buffer. Using the buffer is especially useful when sending predetermined multi-byte transfers, such as when reading and writing FRAM, EEPROM, and FLASH memories.
The IO category includes the functions necessary to control the pins when not being used for digital communications. Each of the available IO pins can be assigned a variety of functions such as digital input, digital output, analog input, analog output, PWM output, and other specialized functions.

To set IO pin mode to Analog Output, use AOUT
To set IO pin mode to PWM Output, use PWM
To turn off interrupts on this pin, use NONE
val can be 0 to 1024 to set the DAC output in counts
val can be 0V to 3.3V to set the DAC output in voltage
When the pin is configured as PWM output:
val can be 0 to 1024 to set the duty cycle in counts
val can be 0% to 100% to set the duty cycle by percentage
When the pin is configured as an Analog or Digital Input:
Setting is disabled, Query VALUE to read the input state
Example: IO[n] VALUE 2512 2.02V
When the pin is configured as a PWM output, the returned value will be in counts and percentage
Example: IO[n] VALUE 512 50%
INT0 MODE DOUT
-OK
IO0 MODE ?
-IO0 MODE DOUT
IO1 MODE PWM
-NGIO1 INT FALL
-OK
IO1 INT RISE
-OK
IO1 INT CHANGE
-OK
IO1 INT NONE
-OKIO0 MODE DIN
-OK
IO0 VALUE ?
-IO0 VALUE 0
IO1 MODE AOUT
-OK
IO1 VALUE 2.5V
-OK
IO1 VALUE ?
-IO1 VALUE 775 2.50V
IO0 MODE PWM
-OK
IO0 VALUE 50%
-OK
IO0 VALUE ?
-IO0 VALUE 512 50%IO3 MODE PWM
-OK
IO3 PWMFREQ ?
-IO3 PWMFREQ 10000
IO3 PWMFREQ 33000
-OK
IO3 PWMFREQ 99000
-NG
IO3 PWMFREQ ?
-IO3 PWMFREQ 33000from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.clearBuffer(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.addByteToBuffer(0, 12)
binhoDevice.addByteToBuffer(0, 136)
binhoDevice.addByteToBuffer(0, 0)
binhoDevice.addByteToBuffer(0, 255)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.addByteToBuffer(0, 12)
binhoDevice.addByteToBuffer(0, 136)
binhoDevice.addByteToBuffer(0, 0)
binhoDevice.addByteToBuffer(0, 255)
print(binhoDevice.readBuffer(0, 4))
#BUF0 12 136 0 255from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
# Fill the entire buffer as quickly as possible
for y in range(8):
data = []
for x in range(32):
data += [x + (y*32)]
binhoDevice.writeToBuffer(0, y*32, data)from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
MB85RC_DEFAULT_ADDRESS = 0xA0
MB85RC_SLAVE_ID = 0xF8
class Adafruit_FRAM_I2C:
# CONSTRUCTOR
def __init__(self, addr):
self.framInitialised = False
self.i2c_addr = addr
# PUBLIC FUNCTIONS
# initializes I2C and configures the chip
# call this function before doing anything else
def begin(self, adapter):
self.hostAdapter = adapter
# Make sure we're actually connected
manufacturerID = 0
productID = 0
deviceInfo = [manufacturerID, productID]
self.getDeviceID(deviceInfo)
manufacturerID = deviceInfo[0]
productID = deviceInfo[1]
deviceFound = True
if manufacturerID != 0x00A:
print("Unexpected Manufacturer ID: " + str(deviceInfo[0]))
deviceFound = False
if productID != 0x510:
print("Unexpected Product ID: " + str(productID))
deviceFound = False
# Everything seems to be properly initialized and connected
self._framInitialised = True;
return deviceFound
# Writes a byte at the specific FRAM address
def write8(self, framAddr, value):
self.hostAdapter.startI2C(0, self.i2c_addr)
self.hostAdapter.writeByteI2C(0, framAddr >> 8)
self.hostAdapter.writeByteI2C(0, framAddr & 0xFF)
self.hostAdapter.writeByteI2C(0, value)
self.hostAdapter.endI2C(0)
# Reads an 8 bit value from the specified FRAM address
def read8(self, framAddr):
self.hostAdapter.startI2C(0, self.i2c_addr)
self.hostAdapter.writeByteI2C(0, framAddr >> 8)
self.hostAdapter.writeByteI2C(0, framAddr & 0xFF)
self.hostAdapter.endI2C(0)
response = self.hostAdapter.readByteI2C(0, self.i2c_addr)
data = response.split()
if len(data) == 3:
return int(data[2])
else:
return 0
# Reads the Manufacturer ID and the Product ID frm the IC
def getDeviceID(self, deviceInfo):
self.hostAdapter.startI2C(0, MB85RC_SLAVE_ID)
self.hostAdapter.writeByteI2C(0, 0xA0)
self.hostAdapter.endI2C(0, True)
response = self.hostAdapter.readBytesI2C(0, MB85RC_SLAVE_ID, 3)
data =response.split()
if len(data) == 5:
deviceInfo[0] = (int(data[2]) << 4) + (int(data[3]) >> 4)
deviceInfo[1] = ((int(data[3]) & 0x0F) << 8) + int(data[4])
# Change this to match your COMPort
default_commport = "COM27"
print("I2C FRAM Example using Binho Host Adapter")
print("v1.0 -- Jonathan Georgino <[email protected]>")
print
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
if len(devices) == 1:
COMPORT = devices[0]
print("Found 1 attached adapter @ " + devices[0])
print
else:
COMPORT = default_commport
print("Found more than 1 attached adapter, using default port " + COMPORT)
print
print("Opening " + COMPORT + "...")
print
# create the binhoHostAdapter object
binhoDevice = binhoHostAdapter.binhoHostAdapter(COMPORT)
binhoDevice.setNumericalBase('10')
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, '1')
binhoDevice.setClockI2C(0, 1000000)
framMemory = Adafruit_FRAM_I2C(MB85RC_DEFAULT_ADDRESS)
if framMemory.begin(binhoDevice) == True:
# found the I2C FRAM
memData = [0 for x in range(32)]
for i in range(32):
memData[i] = framMemory.read8(i)
print(memData)
for i in range(32):
framMemory.write8(i, i*2)
for i in range(32):
memData[i] = framMemory.read8(i)
print(memData)
binhoDevice.close()
else:
# couldn't read the FRAM manufacturer and product ID bits
print("I2C FRAM not identified... check your connections?")
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
from datetime import datetime, timedelta, time
import math
import csv
i2cIndex = 0
i2cClockFreq = 400000
i2cPullEn = 'EN'
captureExportFile = 'C:\\Users\\Batman\\Desktop\\LogicExports\\i2c_eeprom.csv'
binhoCommPort = 'COM27'
# ---- No Need to Change Anything Below Here ----
print("Opening " + binhoCommPort + "...")
print()
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(binhoCommPort)
print("Connecting to binho host adapter...")
print()
print("Connected!")
print()
binho.setLEDColor('YELLOW')
print("Setting I2C bus parameters:")
print()
binho.setOperationMode(0, 'I2C')
print('Clock Frequency: ' + str(i2cClockFreq))
binho.setClockI2C(i2cIndex, i2cClockFreq)
print('PullUps: ' + str(i2cPullEn))
binho.setPullUpStateI2C(i2cIndex, i2cPullEn)
print()
print("Computing USB Transit time...")
t0 = datetime.now()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
t1 = datetime.now()
avgUSBTxTime = (t1 - t0)/5
print('Average USB Tx Time = ' + str(avgUSBTxTime) + 's')
print()
print("Beginning Replay...")
print()
with open(captureExportFile) as captureExport:
capture_reader = csv.reader(captureExport, delimiter=',')
rowCount = 0
startTime = datetime.now()
prevTimestamp = startTime
prevRowTime = 0
currentPacketID = 0
deviceAddress = 0
payload = []
isReadPacket = True
for row in capture_reader:
if rowCount == 0:
# These are the column headers, just advance to the next row
rowCount += 1
print('PacketID#\tTimestamp\t\t\tAddress\tType\tLen(Bytes)')
else:
rowPacketID = row[1]
#check if packetID is empty
if rowPacketID == "":
#this is a single write command with no data to follow it, skip it
rowCount +=1
elif int(row[1]) == currentPacketID:
currRowTime = float(row[0])
deviceAddress = int(row[2],16)
payload.append(int(row[3], 16))
if row[4] == 'Write':
isReadPacket = False
else:
isReadPacket = True
rowCount += 1
else:
# starts a new packet, so do the transaction we loaded
deltaTimems = (currRowTime - prevRowTime) * 1000
#deltaTimems = 0.125 * 1000
#print('DeltaT: ' + str(deltaTimems))
print('Waiting ' + str(timedelta(0,0,0,math.floor(deltaTimems))) + ' until next packet transmission', end='\r')
while (datetime.now() - prevTimestamp) < timedelta(0,0,0,math.floor(deltaTimems)):
#nothing, sleep does not have high enough resolution
#print('WAITING ' + str(datetime.now() - prevTimestamp))
pass
if isReadPacket:
print(str(currentPacketID) + '\t\t' + str(datetime.now()) + '\t' + format(deviceAddress, '#02x') + '\tREAD\t' + str(len(payload)))
binho.readBytesI2C(i2cIndex, deviceAddress, len(payload))
else:
print(str(currentPacketID) + '\t\t' + str(datetime.now()) + '\t' + format(deviceAddress, '#02x') + '\tWRITE\t' + str(len(payload)))
binho.startI2C(i2cIndex, deviceAddress)
for dataByte in payload:
binho.writeByteI2C(i2cIndex, dataByte)
binho.endI2C(i2cIndex)
payload = []
prevTimestamp = datetime.now()
prevRowTime = currRowTime
currentPacketID = int(row[1])
currRowTime = float(row[0])
deviceAddress = int(row[2],16)
payload.append(int(row[3], 16))
if row[4] == 'Write':
isReadPacket = False
else:
isReadPacket = True
rowCount += 1
print('Finished Replaying...')
print()
binho.setLEDColor('BLUE')
binho.close()
print('Goodbye!')Escape sequence = +++UART0
BAUD
Gets/sets the baudrate of the UART connection.
DATABITS
Gets/sets the number of databits for the UART connection
PARITY
Gets/sets the parity bit configuration for the UART connection.
STOPBITS
Gets/sets the number of stop bits for the UART connection.
ESC
Gets/sets the escape sequence that can be used to break out of the UART bridge mode.
BEGIN
Starts the UART bridge. The adapter will remain in UART bridge mode until the escape sequence is sent from the host computer.
There are a few commands that aid in the communication between the host adapter and the computer and can improve the clarity of the user experience by tailoring it to the current test session needs.
Command
Description
Link
+ECHO
Toggles the status of the host adapter's echoing back of received characters. This is useful for manual control when the serial console application does not provide local echo functionality.
+PING
Returns an ACK response, useful in testing the status of the serial connection.
+BASE
Gets/Sets the display base. The host adapter is able to use binary, decimal, or hex numeric bases for displaying values.
+LED
One of the most important Device commands is the +MODE command, which is used to configure the operating mode of the host adapter. The supported operating modes are IO, SPI, I2C, 1-WIRE, SWI, and UART.
Command
Description
Link
+MODE
Gets/Sets the mode of operation (protocol).
There are three commands which aid in device management. These are particularly useful when working with multiple host adapters and when performing device firmware updates.
Command
Description
Link
+ID
Gets the globally-unique identifier of the host adapter. This identifier is very useful when working with multiple host adapters.
+FWVER
Gets the version of the firmware running on the host adapter. This can be used to determine if the latest firmware version is installed or if the host adapter should be updated.
+HWVER
Gets the version of the host adapter hardware. This is useful to programmatically determine which host adapter product hardware is connected.
It's possible to programmatically reset the device, similar to unplugging/plugging the device from the USB port. This returns all settings to their defaults and also causes the USB connection to drop and enumerate again. Note that the serial port on the host computer will need to be re-opened after the reset events.
Command
Description
Link
+RESET
Resets the host adapter, all settings return to defaults.
+BTLDR
Resets the host adapter and restart in bootloader mode.
The technical details of each of the commands, their parameters, and responses can be found in the ASCII Command Set Reference Guide:
ORDER
Gets/sets the SPI bus bit order MSB-first/LSB-first.
MODE
Gets/sets the SPI mode. Modes 0, 1, 2, or 3 are determined by CPOL and CPHA
CPOL
Gets/sets the SPI Clock Polarity. This is related to the SPI mode.
CPHA
Gets/sets the SPI Clock Phase. This is related to the SPI mode.
TXBITS
Gets/sets the number of bits per transmission.
BEGIN
Starts the SPI Controller.
TXRX
Sends/Receives data on the SPI bus.
END
Stops the SPI Controller.
WHR
Transfer 0 to 1024 bytes in a single SPI transaction
Resets the 1-Wire devices on the bus and prepares them to receive commands.
WRITE
Writes a byte to the selected 1-WIRE device.
READ
Reads a byte from the selected 1-WIRE device.
SELECT
Select the target 1-Wire device on the bus.
SKIP
Skip the device selection process.
SEARCH
Search for the next 1-Wire device on the bus.
DEPOWER
Power down the 1-Wire bus.
ADDR
Get the address of the device found using the SEARCH command.
WHR
Writes 0 to 1024 bytes and then Reads 0 to 1024 bytes


Thanks to incredible feedback and support from our customers, we've released an entirely rebuilt python library for Binho Nova. While we'll continue to support our previous library, active development will only take place on this one.
Aside from taking a more pythonic approach to implementing the library, we've also introduced a lot of structure and abstraction to make it even easier to use your Nova, including a command line interface and interactive shell. We've also baked numerous example scripts right into the library for easy reference.
The easiest way to get started is to install this library using pip:
Using Nova in your scripts is as simple as importing the library:
Then initialize a connection to the binho device as such:
When working on setups with multiple devices, you can specify the device to connect to in the following 3 ways:
grab the device with a specific index
binho = binhoHostAdapter(index=0)
or get the device using the COM port
binho = binhoHostAdapter(port=targetComport)
or get the device using the deviceID number
binho = binhoHostAdapter(deviceID = targetDeviceID)
At this point it's possible to control the device as desired. Examples of common use cases are included in this library and are briefly discussed below. When you're done with the device, be sure to close out the connection with the following:
That's all there is to it. The example scripts are introduced below, but it may also make sense to review the new Command line interface as well, as it may be possible to achieve your goals without writing any code at all.
Take a look in the folder of the codebase (hosted on github) to see example scripts which demonstrate how to use this library in your own scripts to automate Nova. These example scripts feature a lot of commentary and serve as a tutorial for using this library.
Basic Examples:
This example shows the basics of establishing a connection with device and setting it's LED to BLUE. It's a boring example, but introduces the typical script structure and basics of working with this library.
This example shows how to use IO pins for digital input and output, as well as configuring hardware PWM.
This example shows how to use IO pins for analog input (using the ADC) and output (using the DAC).
Advanced Examples:
- Reading and Writing common EEPROM devices has never been easier. Also shows how to read to / write from, and verify against .bin and .hex files.
- Reading and Writing common FLASH devices has never been easier using our SPI
- Discover the parameters of a SPI Flash device without any prior knowledge by reading the JEDEC ID and SPI Flash Discoverable Parameters.
he installation of this library also includes the new command line interface which makes it possible to perform a lot of common functions without needing to write any code. The format of the commands is as follows:
Each command has their own unique arguments, but all commands except 'info' support the following:
-h, --help: prints the list of arguments
-v, --verbose: display more details on the console during execution
-d, --device <deviceID>: connect to the device with the provided deviceID number
Note that only one of -d, -p, or -i arguments can be supplied to any command.
Device Management Subcommands
binho info This command can be used to find all Novas connected to the PC and get their associated information such as serial number, COM port, and firmware version. It will also indicate if a device is in DAPLink or Bootloader mode as well.
binho dfu This command can be used to automatically update device firmware or just enter Bootloader mode.
IO Subcommands
binho gpio
This command can be used to take digital readings or drive IO pins as digital outputs. Note that the device does not retain it's state between consecutive runs of this command. As such, a subsequent run will overwrite any previous pin configurations.
binho dac This command can be used to set the DAC output to a given voltage or raw 10bit value.
Protocol Subcommands
binho i2c
This command can be used to perform I2C Scans, Reads, and Writes.
binho eeprom
This command can be used to read from and write to common I2C EEPROM devices.
binho spi
This command can be used to perform SPI transfers.
DAPLink Subcommands
Binho Nova can be used to program and debug microcontrollers by operating in DAPLink mode.
binho daplink
Use this command to switch Nova into and out of DAPLink mode.
binho flasher
While in DAPLink mode, this command can be used to program bin/hex files into microcontrollers.
Misc. Subcommands
binho shell
This command can be used to open up a connection to the device and begin an interactive shell.
binho custom
Adding custom commands is very easy! This command is just meant as a template which can be used to create your own commands to extend the command line functionality for any specific tasks. You can see the implementation .
We welcome contributions to our library, and we've made it easy. Here's some brief guidance to get started developing with the library.
We're planning to use ReadTheDocs to host detailed library documentation in the near future. You can build the documentation with the following command.
We're looking forward to adding support for various common UART use-cases. Additionally, we'll be adding in support for Atmel SWI if we find enough folks interested in that protocol. Our development roadmap is highly determined by customer requests and feedback, so please feel free to reach out if there's a particular feature you'd like to see added into this library.
The release can be viewed on PyPi here:
And here's another direct link to the our public repo on Github:
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The following script can be used to repeat SPI transactions captured and exported from Saleae Logic. After the capture is completed, export the SPI analyzer results as a csv file. You can follow this guide to export the file. The exported data should be in HEX-- Note that the base/radix of the exported data will match the current setting for display in the software.
Simply modify the parameters in lines 9-17 in the script below and then everything is ready to play back the file from the Binho Multi-Protocol USB Host Adapter.
For easy testing, here's an example export file from Saleae Logic that works with this script:
We provide 32-bit and 64-bit builds of our application for Windows. The following versions are supported:
Windows 10
Windows 8.1
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
We provide 32-bit and 64-bit builds of our application for Windows. The following versions are supported:
Windows 10
Windows 8.1
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
Our Linux build is a 64-bit application which runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
To use Binho Multi-Protocol USB Host Adapters with most modern Linux distributions, you'll want to ensure a few udev rules are applied. These rules apply special configuration for USB devices like this to workaround or fix common issues. The rules also fix an issue with ModemManager hanging on to /dev/ttyACM devices.
To install the rules you;ll want to download them and copy to the location of udev rules on your system. For most Linux systems like Ubuntu, etc. udev rules are stored in the /etc/udev/rules.d/ (check your distribution's documentation / help forums if you don't see this folder existing in your file system). Run the following commands:
wget 'https://bitbucket.org/!api/2.0/snippets/binho-llc/eanz95/ae0b3f04efccb0ec3b3de11fd068d7af6d6e12dd/files/binhoHostAdapter.rules'
sudo cp binhoHostAdapter.rules /etc/udev/rules.d/Note that you might need to change the rule if you're using a distribution other than Ubuntu/Debian. In particular, the first rule in the file applies the 'dialout' group to the binho Host Adapter. Some distributions use a different group for this instead of 'dialout'. Check your distribution docs or help forums to see what group should apply to devices that can be accessed by non-root users.
Next you'll need to reload udev's rules so that they are properly applied. You can restart your machine, or run a command like the following:
sudo udevadm control --reload-rules
sudo udevadm triggerAnd if that fails, reboot your system as it will ensure udev picks up the new configuration.
You can also add yourself to the 'dialout' group with
sudo usermod -a -G dialout $USERor
Finally, I'd to send out a special thank you to the team at for putting together a similar set of instructions for their boards which really reduced the burden in figuring this out.
We provide 32-bit and 64-bit builds of our application for Windows. The following versions are supported:
Windows 10
Windows 8.1
Windows 7 SP1
Our MacOS build is a 64-bit application which runs on Apple computers with the following operating systems:
macOS Mojave 10.14.x
macOS High Sierra 10.13.x
macOS Sierra 10.12.x
OS X El Capitan 10.11.x
We provide Linux builds for 32-bit and 64-bit system architectures. Our application runs on the following operating systems:
Linux Mint 16 or later
CentOS 7.0 or later
Ubuntu 14.04 LTS or later
Debian 6.0 or later
In an effort to ensure that the full functionality of the Binho Nova Multi-Protocol USB Host Adapter can be easily accessed from as many platforms and environments as possible, it's been deliberately chosen to implement interrupts without using any of the flow control signals which are not always be available and often difficult to use.
As such, interrupts are actually injected into the serial connection as ASCII text strings. Like every engineering decision, there are always some trade-offs. In this case, it means that some additional parsing of received data must be performed so that an Interrupt Packet won't be mistaken for a Response Packet when automating the device. We'll address how to handle this in a moment, but first, some good news:
All interrupts are disabled by default when the host adapter powers on. You'll only need to implement parsing for interrupts if you plan on using them in your scripts.
And some even better news:
The binho-host-adapter python libraries already take care of this behind the scenes!
At this time, the firmware supports 4 configurable hardware interrupts from the interrupt-enabled IO pins on the Binho Nova Multi-Protocol USB Host Adapter:
!IO1
!IO2
!IO3
These strings will start to appear in the stream of data from the host adapter when interrupts are enabled and the interrupt condition occurs. When manually interacting with the host adapter from a serial console, this is trivial to deal with. However, automated control will require a bit of extra code.
There are a number of ways to deal with this, and it will depend on the language and environment used for automation. If the language is event driven, then checking the received data from the serial connection to match with the interrupt strings above is quite easy. But languages which do not support the firing of events on serial data arrival become tricky, as one must constantly poll for the arrival of an interrupt.
Thankfully, our python library is an excellent reference for how to implement a separate thread which manages reading the serial port and checking for interrupts. It then determines if the received packet is a response packet or an interrupt packet, and places it into a queue accordingly. The items in the Queues are then consumed by the main program thread.
Anyways, let's come out of this rabbit hole for now -- there will be more discussion on this topic in the "Using IO" section coming up.
The next pages in this section of the guide will provide instructions to utilize the full set of supported protocols and features of your host adapter.




The Binho Nova Multi-Protocol USB Host Adapter can serve as an I2C bus controller device which can be configured to meet the needs of nearly any I2C bus implementation. The I2C controller supports clock frequencies from 100kHz up to 3.4MHz, which covers all common operating modes (standard, full speed, fast, and high speed modes). The Binho Nova Multi-Protocol USB Host Adapter also features support for clock-stretching and repeated starts. There are internal pull-up resistors which can be programmatically engaged or disabled as necessary.
The I2C pins are fixed - SDA is assigned to IO0 and SCL is assigned to IO2. IO1, IO3, and IO4 are available for use when the host adapter is configured for I2C controller mode.
The following table gives a brief overview of the available I2C controller commands.
Toggles the status of the host adapter's echoing back of received characters. This is useful for manual control when the serial console application does not provide local echo functionality. Echo is turned off by default on device power-on.
Parameters:
This function takes no parameters.
Response:
This function returns an after toggling the status of the echo setting.
Our cross-platform software, called Mission Control, is available for Windows, Mac, and Linux and provides an easy-to-use GUI interface for your Binho Nova. Download the appropriate release for your operating system here:
Once the download completes, unzip the directory. The Windows 32bit and Windows 64bit releases are distributed with .exe installers, whereas Mac and Linux distributions can simply be unzipped and run.
This releases introduces the following enhancements to I2C Peripheral:
The following use of Master/Slave terminology is considered obsolete. Controller/Peripheral is now used. These firmware commands will be deprecated in an upcoming firmware release.
Added I2C SLAVE MODE command to select between USEPTR (Use-Pointer Mode) and STARTZERO (All R/W operations start at register index 0).
+MODE 0 UART
-OKUART0 BAUD 115200
-OKUART0 ESC ?
-UART0 ESC +++UART0UART0 ESC +!+!RQZ86!
-OK
UART0 ESC ?
-UART0 ESC +!+!RQZ86!UART0 BEGIN
-OK+!+!RQZ86!
-OK+MODE 0 SPI
-OKSPI0 CLK 5000000
-OKIO0 MODE DOUT
-OK
IO0 VALUE HIGH
-OKSPI0 BEGIN
-OKIO0 VALUE LOW
-OKSPI0 TXRX 0x9F
-SPI0 RXD 0x00
SPI0 TXRX 0x00
-SPI0 RXD 0x00
SPI0 TXRX 0x00
-SPI0 RXD 0x00
SPI0 TXRX 0x00
-SPI0 RXD 0x00
SPI0 TXRX 0x00
-SPI0 RXD 0x00
IO0 VALUE HIGH
-OK
SPI0 END
-OKBUF0 CLEAR
-OK
BUF0 ADD 0x9F
-OKSPI0 BEGIN
-OK
IO0 VALUE LOW
-OK
SPI0 TXRX BUF0 5
-OK
IO0 VALUE HIGH
-OK
SPI0 END
-OKBUF0 READ 5
-BUF0 0x00 0x04 0x7F 0x03 0x02+MODE 0 1WIRE
-OK1WIRE0 BEGIN 0 PULL
-OK1WIRE0 RESET
-OK1WIRE SEARCH RESET
-OK1WIRE SEARCH
-OK1WIRE0 ADDR ?
-1WIRE0 ADDR 0x3A 0xE3 0x2B 0x46 0x00 0x00 0x00 0x8E1WIRE0 RESET
-OK1WIRE0 SELECT
-OK1WIRE0 WRITE 90
-OK
1WIRE0 WRITE 255
-OK
1WIRE0 WRITE 0
-OK
1WIRE0 READ
-1WIRE READ 0xAA
1WIRE0 READ
-1WIRE READ 0x0Fpip install binho!IO4Exposed the Pointer for set/get operations using I2C SLAVE REG PTR commands
Added bit-level register access permissions using I2C SLAVE READMASK and I2C SLAVE WRITEMASK commands
Added ability to configure the number of registers from 1 to 256 via the I2C SLAVE REGCOUNT command.
This release fixes the following bugs:
No known bug fixes.
OS X Yosemite 10.10.5
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
OS X Yosemite 10.10.5
OpenSUSE 11.3 or later
Fedora 13 Desktop or later
OS X Yosemite 10.10.5
OpenSUSE 11.3 or later
Fedora 13 Desktop or later



sudo usermod -a -G plugdev $USERReturns an ACK response, useful in testing the status of the serial connection.
Parameters:
This function takes no parameters.
Response:
This function returns an ACK Response.
Example Usage:
Gets/Sets the display base. The host adapter is able to use binary, decimal, or hex numeric bases for displaying values. The default value is HEX (Base-16).
Set display base value: +BASE [base]
Get display base value: +BASE ?
Parameters:
For Binary (Base-2) display, set base to BIN or 2
For Decimal (Base-10) display, set base toDEC or 10
For Hexadecimal (Base-16) display, set base to HEX or 16
To query the current setting value, set base to ?
Response:
Set: This function returns an ACK Response if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Get: This function returns -BASE followed by either BIN, DEC, or HEX
Example Usage:
Gets/Sets the color of the status LED. The RGB Status LED is user-programmable and can be especially helpful for indicating status during testing or identifying host adapters when multiple devices are being used simultaneously.
Set the LED color to preset color: +LED [color]
Set the LED color to RGB values: +LED [red] [green] [blue]
Parameters:
The following are valid values for color:
OFF
WHITE
RED
GREEN or LIME
BLUE
YELLOW
CYAN or AQUA
MAGENTA or FUCHSIA or PURPLE
The values for red, green, and blue parameters are unsigned 8-bit integers from 0 to 256. Values outside of this range will be truncated to 8-bits.
Response:
This function returns an ACK Response if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
Gets/Sets the mode of operation (protocol) for a given "core" of the Binho Multi-Protocol USB Host Adapter. The default value is IO.
Set display base value: +MODE [coreIndex] [opMode]
Get display base value: +MODE [coreIndex] ?
Parameters:
For IO operating mode, set opMode to IO
For SPI operating mode, set opMode to SPI
For I2C operating mode, set opMode to I2C or IIC
For 1-WIRE operating mode, set opMode to 1WIRE or 1-WIRE or ONEWIRE
For SWI operating mode, set opMode to SWI or SINGLEWIRE
For UART operating mode, set opMode to UART or USART or SERIAL
To query the current operating mode, set opMode to ?
Response:
Set: This function returns an ACK Response if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Get: This function returns -MODE followed by [coreIndex] followed by either IO, SPI, I2C, UART, 1WIRE, or SWI.
Example Usage:
Gets the globally-unique identifier of the host adapter. This identifier is very useful when working with multiple host adapters.
Parameters:
This function takes no parameters.
Response:
This function returns -ID followed by the 256-bit globally-unique device identifier. Note that the response is always displayed in base-16 (hexadecimal) regardless of the base setting.
Example Usage:
Gets the version of the firmware running on the host adapter. This can be used to determine if the latest firmware version is installed or if the host adapter should be updated.
Parameters:
This function takes no parameters.
Response:
This function returns -FWVER followed by the [major].[minor].[build] number of the firmware . Note that the response is always displayed in base-10 (decimal) regardless of the base setting.
Example Usage:
Gets the version of the host adapter hardware. This is useful to programmatically determine which host adapter product hardware is connected.
Parameters:
This function takes no parameters.
Response:
This function returns -HWVER followed by the [major].[minor] identifier of the hardware . Note that the response is always displayed in base-10 (decimal) regardless of the base setting.
Example Usage:
Resets the host adapter, all settings return to defaults.
Parameters:
This function takes no parameters.
Response:
This function returns -OK. Note that immediately following the transmission of the response, the host adapter will reset, which will cause the serial connection with the computer to be lost.
Depending on the implementation of the serial console application, an Error may be raised due to the lost connection before the response to this command has been received/displayed.
Example Usage:
Resets the host adapter and restart in bootloader mode. The host adapter must be in bootloader mode in order to update the device firmware. While in the bootloader, the device is not available over the serial / Virtual COM port. Instead, it will enumerate as a USB Mass Storage Device. More details about firmware update can be found in the Updating Firmware section of this guide.
Parameters:
This function takes no parameters.
Response:
This function returns -OK . Note that immediately following the transmission of the response, the host adapter will reset, which will cause the serial connection with the computer to be lost. The device will then enumerate as a mass storage device.
Depending on the implementation of the serial console application, an Error may be raised due to the lost connection before the response to this command has been received/displayed.
Example Usage:
Clears the contents of the entire 256-byte buffer.
Parameters:
This function takes no parameters.
Response:
This function returns an ACK Response after clearing the buffer.
Example Usage:
Adds a single byte of data into the buffer and increments the pointer index by +1.
Add value to buffer: BUF[n] ADD [data]
Parameters:
This function takes one parameter, data. This is the 8-bit unsigned integer (byte) value that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after adding the byte the buffer if the command succeeds. If an invalid parameter is provided, the function will return a NAK Response.
Example Usage:
Writes n bytes of data into the buffer, up to a maximum of 32 bytes at a time.
Add n bytes into the buffer beginning at startIndex: BUF[n] WRITE [startIndex] [data_0] [data_1] ... [data_n]
Parameters:
startIndex is the 8-bit integer index of the location that the first byte should be written to the buffer.
data_n is the 8-bit integer (byte) that will be written to the buffer. Values outside of this range will be truncated to 8 bits.
Response:
This function returns an ACK Response after writing the data into the buffer if the command succeeds. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
Reads n bytes of data from the buffer beginning at the start of the buffer, up to a maximum of 256 bytes at a time (the entire buffer).
BUF[n] READ [byteCount]
Parameters:
byteCount is the 8-bit integer number of bytes to read from the buffer. Valid range is from 1 to 256 bytes.
Response:
This function returns a Data Response if the read command was successful. If an invalid value is provided, the function will return a NAK Response.
Example Usage:
from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
from datetime import datetime, timedelta, time
import math
import csv
spiIndex = 0
spiClockFreq = 1000000
spiMode = 0
spiCSPinIONumber = 0
spiCSActiveLow = True
captureExportFile = 'C:\\Users\\Jonathan\\Desktop\\capture exports\\spi_example.csv'
binhoCommPort = 'COM27'
# ---- No Need to Change Anything Below Here ----
print("Opening " + binhoCommPort + "...")
print()
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(binhoCommPort)
print("Connecting to binho host adapter...")
print()
print("Connected!")
print()
binho.setLEDColor('YELLOW')
print("Setting SPI bus parameters:")
print()
binho.setOperationMode(0, 'SPI')
print('Clock Frequency: ' + str(spiClockFreq))
binho.setClockSPI(spiIndex, spiClockFreq)
print('Mode: ' + str(spiMode))
binho.setModeSPI(spiIndex, spiMode)
print('CS Pin: IO' + str(spiCSPinIONumber))
binho.setIOpinMode(spiCSPinIONumber, 'DOUT')
if spiCSActiveLow:
binho.setIOpinValue(spiCSPinIONumber, 'HIGH')
else:
binho.setIOpinValue(spiCSPinIONumber, 'LOW')
print()
print("Computing USB Transit time...")
t0 = datetime.now()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
binho.ping()
t1 = datetime.now()
avgUSBTxTime = (t1 - t0)/5
print('Average USB Tx Time = ' + str(avgUSBTxTime) + 's')
print()
print("Beginning Replay...")
print()
with open(captureExportFile) as captureExport:
capture_reader = csv.reader(captureExport, delimiter=',')
rowCount = 0
startTime = datetime.now()
prevTimestamp = startTime
prevRowTime = 0
currentPacketID = 0
payload = []
for row in capture_reader:
if rowCount == 0:
# These are the column headers, just advance to the next row
rowCount += 1
print('PacketID#\tTimestamp\t\t\tLen(Bytes)')
else:
#print('A: ' + row[0] + '\tB: ' + row[1] + '\tC: ' + row[2] + '\tD:' + row[3])
rowPacketID = row[1]
#check if packetID is empty
if rowPacketID == "":
#this is a single write command with no data to follow it, skip it
rowCount +=1
elif int(rowPacketID) == currentPacketID:
currRowTime = float(row[0])
payload.append(int(row[2], 16))
#print('Appening: ' + str(int(row[2], 16)) + ' row:' + str(rowCount))
rowCount += 1
else:
# starts a new packet, so do the transaction we loaded
deltaTimems = (currRowTime - prevRowTime) * 1000
#deltaTimems = 0.125 * 1000
#print('DeltaT: ' + str(deltaTimems))
print('Waiting ' + str(timedelta(0,0,0,math.floor(deltaTimems))) + ' until next packet transmission', end='\r')
while (datetime.now() - prevTimestamp) < timedelta(0,0,0,math.floor(deltaTimems)):
#nothing, sleep does not have high enough resolution
#print('WAITING ' + str(datetime.now() - prevTimestamp))
pass
print(str(currentPacketID) + '\t\t' + str(datetime.now()) + '\t' + '\t' + str(len(payload)))
binho.clearBuffer(0)
for dataByte in payload:
binho.addByteToBuffer(0, dataByte)
binho.beginSPI(spiIndex)
if spiCSActiveLow:
binho.setIOpinValue(spiCSPinIONumber, 'LOW')
else:
binho.setIOpinValue(spiCSPinIONumber, 'HIGH')
binho.transferBufferSPI(spiIndex, len(payload))
if spiCSActiveLow:
binho.setIOpinValue(spiCSPinIONumber, 'HIGH')
else:
binho.setIOpinValue(spiCSPinIONumber, 'LOW')
binho.endSPI(spiIndex)
currentPacketID += 1
payload = []
prevTimestamp = datetime.now()
prevRowTime = currRowTime
currRowTime = float(row[0])
payload.append(int(row[2], 16))
rowCount += 1
print('Finished Replaying...')
print()
binho.setLEDColor('BLUE')
binho.close()
print('Goodbye!')+ECHO
-OK+PING
-OK+BASE BIN
-OK
+BASE DEC
-OK
+BASE HEX
-OK
+BASE 2
-OK
+BASE 10
-OK
+BASE 16
-OK
+BASE OCT
-NG
+BASE ?
-BASE HEX+LED RED
-OK
+LED BLUE
-OK
+LED OFF
-OK
+LED 255 128 128
-OK
+LED 255 0
-NG
+LED ORANGE
-NG
+LED 333 128 128
-OK+MODE 0 IO
-OK
+MODE 0 SPI
-OK
+MODE 1 SPI
-NG
+MODE 0 I2C
-OK
+MODE 0 ?
-MODE 0 I2C
+MODE 0 MODBUS
-NG+ID
-ID 0xc59bb495504e5336362e3120ff042d2a+FWVER
-FWVER 1.0.0+HWVER
-HWVER 1.0+RESET
-OK+BTLDR
-OKBUF0 CLEAR
-OKBUF0 ADD 0xAA
-OK
BUF0 READ 1
-BUF0 0xAABUF0 WRITE 0 10 15 20
-OK
BUF0 READ 4
-BUF0 10 15 20 0BUF0 READ 16
-BUF0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00SPI Communication This example shows how to configure the device for SPI communication and transfer data. This example can be run by connecting SDI and SDO signals to loopback the data.
I2C Communication This example demonstrates how to configure the device for I2C communication and perform reads and writes. It also shows how to scan the bus, and perform read register and write register commands. This example is easily adaptable to work with any I2C device you have available.
1Wire Communication This example demonstrates how to configure the device for (Dallas / Maxim) 1Wire communication by writing to and reading from a DS24B33+ 1Wire EEPROM. Note that the command set for most 1Wire EEPROMs is very similar so this example may work with other devices too.
-p, --port <commport>: connect to the device on the provided COM port
-i, --index <i>: connect to the device at index i
binho pwm
This command can be used to configure the IO pins to be used as PWM outputs.
binho spiflash [Coming Soon!]
This command can be used to read from and write to common SPI Flash devices.
binho 1wire This command can be used to communicate with 1Wire devices.
CLK
Gets/sets the I2C clock frequency.
ADDR
Gets/sets the display format of I2C addresses.
PULL
Gets/sets the current state of the on-board pull-up resistors.
SCAN
Scans for devices on the I2C bus.
WRITE
Writes n bytes to a given I2C device.
REQ
Requests n bytes from a given I2C device.
START
Starts an I2C transmission to a given device.
END
Ends an I2C transmission. It can be used to send a stop bit or a repeated start bit.
WHR
Writes 0 to 1024 bytes followed by reading 0 to 1024 bytes in one transaction.
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 on the I2C bus.
The first step in using the Binho Nova Multi-Protocol USB Host Adapter as an I2C controller is to put the adapter into I2C mode using the Device Operating Mode command.
Now the host adapter is in I2C communication mode. The next step is to configure the I2C bus. Here are the default settings:
I2C clock frequency = 400kHz
I2C pull-up resistors disabled.
I2C addresses displayed as 8-bit addresses.
Let's change the address display setting to 7-bit so that it matches the manufacturer's datasheet for the device on the bus.
And let's also engage the internal pull-up resistors to eliminate the need for wiring up external resistors.
Before even attempting communication with the peripheral device, let's make sure everything checks out. The address of the target device is 0x50.
Great! The Binho Nova Multi-Protocol USB Host Adapter found the target device on the I2C bus as indicated by the OK response when scanning it's address. If the addresses of the devices on the I2C bus are unknown, it's possible to scan the entire bus for devices simply by omitting the address from the scan command.
Now it's time to start communicating with the devices on the bus!
Let's begin to define an I2C transaction that will be carried out by the host adapter. Every I2C transaction must begin with a start bit followed by the address of the target device. When performing an I2C Write operation, the START command must be issued manually:
Now let's queue up a couple of bytes of data to write:
Unlike SPI controller mode, the I2C transactions are only sent out on the bus after sending the END command. This is great because it means there's no rush to enter data in the serial console when manually interacting with I2C devices.
Requesting data from the I2C peripheral device is also quite simple. When requesting data from the peripheral device, there's no need to manually issue the START command, it's handled automatically:
Sometimes reading data requires writing a value to a particular location and then sending a repeated start bit to read out the desired value. Here's an example of such a transaction:
It's also possible to write and request data on the I2C bus using the buffer. This can be helpful when writing/requesting more than just a few bytes at a time. Let's use BUF0 to help send 8 bytes on the I2C bus:
The buffer can also be used to receive requested data from the I2C bus as follows:
That's all there is to I2C communication with the Binho Nova Multi-Protocol USB Host Adapter. You can take some time to learn all the details about the I2C commands or skip ahead and look at some of the examples that use I2C in an automated fashion:
For use cases where a lot of data is being read/written and speed is important, the WHR command should be utilized to minimize the amount of communication between the Nova and the host PC. You can learn all the details about this here.
Next up we'll be doing a walk-through using I2C Peripheral.
Command
Description
Details
The Windows Defender SmartScreen prompt is displayed when running the installer. Click "More Info" and then the "Run Anyway" button to continue. Our software releases are no codesigned, however we're still building our reputation within Microsoft SmartScreen so that eventually this warning will go away.
Here's what the process looks like on Mac:
If this is the first time that you're connecting to a virtual COM port on your Mac, you will need ensure your user account has the correct permissions. Please see the following support page if this is your first time:
Here's what the process looks like on Ubuntu:
Note that there are some nuances with permissions when running on Linux systems. Please see the follow support page for more details on setting the required permissions:
Now it's time to launch the software. If you haven't done so already, connect the Binho Nova to you computer using the provided USB Cable. Once you've launched the application, the available devices will be displayed in a drop-down box at the top. Simply click the "Connect" button to connect to the selected host adapter. If no devices are shown in the list, go ahead and click the "Refresh" button to check again, perhaps it was still enumerating after plug-in when the software initially checked for devices.
The device mode of operation is displayed in the bottom left corner of the main application window. The default mode of operation is IO, where all 5 pins can be used for any function from the IO tab of the software. Activating SPI or I2C modes of operation will assign the pins associated with those protocols to their protocol-specific function, and the remaining unused IO pins will still be available for use from the IO tab. Setting SPI or I2C mode of operation is done on the respective protocol tab as shown below.
At this point, you're all set to start interacting with your device. For final step, please take a look at the pages below depending on which mode of operation is most interesting / applicable to your needs:
Gets/Sets the color of the status LED. The RGB Status LED is user-programmable and can be especially helpful for indicating status during testing or identifying host adapters when multiple devices are being used simultaneously.




We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This function sets the operation mode of a specific pin.
This function takes two parameters:
ioNumber, which is the index of the pin to be configured, can be 0 - 4.
mode, which is the desired operation mode for the pin. Valid modes include DIN(Digital Input), DOUT (Digital Output), AIN (Analog Input), AOUT (Analog Output), and PWM.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the operation mode of a specific pin.
This function takes one parameter:
ioNumber, which is the index of the pin for which the mode is being queried.
The host adapter will respond with IO[n] followed by 'MODE' followed by the current mode of the specified IO pin. See the details for the command above for the possible values of MODE.
This function sets the PWM frequency of the provided IO pin. This function is only available on IO pins which support PWM output. Please see the ASCII command for additional info.
This function takes two parameters:
ioNumber, which is the index of the pin for which the PWM frequency shall be applied.
freq, which is the frequency in Hz. Acceptable range is from 750Hz to 80000Hz.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the PWM frequency of the provided IO pin. This function is only available on IO pins which support PWM output. Please see the ASCII command for additional info.
This function takes one parameter:
ioNumber, which is the index of the pin for which the PWM frequency is being queried.
The host adapter will respond with 'IOn' followed by 'PWMFREQ' followed up the configured frequency in Hz upon successful execution of the command.
This function configures the given IO pin to be used as an interrupt source. Interrupts can be on rising edge, falling edge, or any edge. Additional information on which pins can be used as interrupts can be found on the ASCII command documentation.
This function takes two parameters:
ioNumber, which is the index of the pin which will be configured as an interrupt source.
intMode, which can be either RISE, FALL, CHANGE, or NONE.
The host adapter will respond with '-OK' upon successful execution of the command.
This function returns the currently configured interrupt settings for the provided IO pin.
This function takes one parameter:
ioNumber, which is the index of the pin for which the interrupt configuration is being queried.
The host adapter will respond with 'IO[n]' followed by 'INT' followed by the current configured interrupt mode.
This function sets the current value of the provided IO pin. Note that the meaning of value and the acceptable range and units depends on the currently configured MODE of the given IO pin. Please see the documentation of the ASCII command for additional information.
This function takes two parameters:
ioNumber, which is the index of the pin which will be set to the given value.
value, which can be :
0 or 1 when operating as a digital output,
The host adapter will respond with '-OK' upon successful execution of the command.
This function returns the current value of the provided IO pin. Note that the meaning of value and the acceptable range and units depends on the currently configured MODE of the given IO pin. Please see the documentation of the ASCII command for additional information.
This function takes one parameter:
ioNumber, which is the index of the pin for which the value is being queried.
The host adapter will respond with 'IO[n]' followed by 'VALUE' followed by the current value.
This function checks to see if an interrupt has been received from the host adapter. Note that this function does not involve any direct communication with the host adapter, rather it just checks to see if the python library has already received an interrupt from the device. More details about how interrupts are implemented can be found .
This function takes one parameter:
ioNumber, which is the index of the pin which is being checked for the interrupt flag.
This function returns either Trueor False . A value of True indicates that an interrupt event has occurred on the given IO pin.
This function clears the interrupt flag. Note that this function does not involve any direct communication with the host adapter, rather it just clears the interrupt flag in the python library. More details about how interrupts are implemented can be found .
This function takes one parameter:
ioNumber, which is the index of the pin which is being checked for the interrupt flag.
This function does not return any value.
In order to begin interacting with the Binho Nova Multi-Protocol USB Host Adapter, you'll need to open up the connection to the device. As mentioned in the "Connecting the Hardware" section, the host adapter will enumerate as a Virtual COM port. Logically, the first step to connecting with it is to identify which port it is using.
On Windows, this can most easily be determined by checking the device manager.
On Mac,
On Ubuntu,
Now open up your serial console application and configure the connection parameters to the following:
Baudrate: 1000000
Databits: 8
Parity: None
Stop Bits: 1
While this step is totally optional, it is quite the productivity boost to enable a few additional features which are particularly convenient when manually controlling your host adapter. In particular, you'll want to enable "Line Mode" and "Local Echo." Local Echo allows you to see the characters as you type them, and Line Mode tells the console to buffer the entered text until pressing Enter. Here's a quick look at how to configure these settings in CoolTerm:
Now that the connection parameters have been configured correctly, it's time to connect to the Binho Nova Multi-Protocol USB Host Adapter. Click the "Connect" button to open the serial connection with the device.
Once the serial connection has been established, the Status LED on the Binho Nova Multi-Protocol USB Host Adapter will shine blue. You can now begin sending commands to the host adapter.
The Status LED is user-programmable, so after initial power up and establishment of the serial connection, the Status LED color meaning is not correlated with any particular device state unless specifically set from within the test scripts.
With the open connection, Sending commands to the device is as simple as typing a command and pressing Enter. Let's get the unique device ID of this host adapter:
Note that the host adapter will respond to every command. If you do not receive a response from the command, then the serial connection may not be configured properly.
Commands are not case-sensitive.
The next page in this guide will discuss the format of the responses from the Binho Nova Multi-Protocol USB Host Adapter.
import binho# grab the first device found the system finds
binho = binhoHostAdapter()binho.close()binho <<subcommand>> [arguments]python3 setup.py installpip3 install .[dev]
docs\make.bat html+MODE 0 I2C
-OKI2C0 ADDR 7BIT
-OKI2C0 PULL EN
-OKI2C0 SCAN 0x50
-I2C0 SCAN 0x50 OKI2C0 SCAN
-I2C0 SCAN 0x01 NG
-I2C0 SCAN 0x02 NG
-I2C0 SCAN 0x03 NG
[...omitting scan results from 0x04 to 0x4E...]
-I2C0 SCAN 0x4F NG
-I2C0 SCAN 0x50 OK
-I2C0 SCAN 0x51 NG
[...omitting scan results from 0x52 to 0x7C...]
-I2C0 SCAN 0x7D NG
-I2C0 SCAN 0x7E NG
-I2C0 SCAN 0x7F NG
-I2C0 SCAN OK 1 DEVICES
I2C0 START 0x50
-OKI2C0 WRITE 0xAA
-OK
I2C0 WRITE 0xBB
-OKI2C0 END
-OKI2C0 REQ 0x50 2
-I2C0 RXD 0x42 0x36I2C0 ADDR 8BIT
-OK
I2C0 START 0xF8
-OK
I2C0 WRITE 0xA0
-OK
I2C0 END R
-OK
I2C0 REQ 0xF8 3
-I2C0 RXD 0x00 0xA5 0x10BUF0 CLEAR
-OK
BUF0 WRITE 0 0xA0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7
-OK
I2C0 START 0xA0
-OK
I2CO WRITE BUF0 8
-OK
I2C0 END
-OKBUF0 CLEAR
-OK
I2C0 REQ 0xA0 BUF0 4
-OK
BUF0 READ 4
-BUF0 0x0C 0x0E 0x10 0x12



0 to 1024 when operating as an analog output or PWM output
0V to 3.3V when operating as analog output
0% to 100% when operating as a PWM output
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'AIN')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'AIN')
binhoDevice.getIOpinMode(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'PWM')
binhoDevice.setIOpinPWMFreq(0, 55000)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'PWM')
binhoDevice.setIOpinPWMFreq(0, 55000)
binhoDevice.getIOpinPWMFreq(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(3, 'DIN')
binhoDevice.setIOpinInterrupt(3, 'CHANGE')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(3, 'DIN')
binhoDevice.setIOpinInterrupt(3, 'CHANGE')
binhoDevice.getIOpinInterrupt(3)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'DOUT')
binhoDevice.setIOpinValue(0, 1)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(0, 'DIN')
binhoDevice.getIOpinValue(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(3, 'DIN')
binhoDevice.setIOpinInterrupt(3, 'CHANGE')
binhoDevice.getIOpinInterruptFlag(3)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setIOpinMode(3, 'DIN')
binhoDevice.setIOpinInterrupt(3, 'CHANGE')
binhoDevice.getIOpinInterruptFlag(3)
binhoDevice.clearIOpinInterruptFlag(3)No Flow Control







We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This function starts the 1-WIRE host on the given IO pin. The 1-Wire protocol can be used on any of the IO pins, however it is especially convenient to use it on IO0 and IO2 as the internal pull-up resistor can be used thus eliminating the need for an external pull-up resistor.
This function takes three parameters:
oneWireIndex, which is always 0 on the Binho Nova host adapter.
pin, which can be any of the IO pins 0 through 4.
pullup, which can be either True or
The host adapter will respond with '-OK' upon successful execution of the command.
This function instructions the 1-Wire host to send the reset command. Sending the reset command is the first step of selecting a target device to communicate with.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' if the device on the 1-Wire bus asserted a presence pulse as a result of the result on the 1-WIRE bus. If the command fails or no device asserts a pulse after the reset, the function will return '-NG'.
This function sends one byte of data on the 1-WIRE bus.
This function takes two parameters:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
powered, [optional], which will continue to leave the bus powered upon completion of the write if set to True.
The host adapter will respond with '-OK' upon successful execution of the command.
This function reads one byte of data from the 1-WIRE bus.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '1WIRE0' followed by 'READ' followed by one byte of data read from the bus.
This function selects the device whose address is currently in the internal address buffer to be the target for communication. The address in the internal address buffer is set by discovering the device via the search process.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function allows one to skip the search process and enables communication with the device right away. This can only be used when there is only one 1-Wire device on the bus.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function is used to power down the 1-WIRE bus.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function returns the address that was found by performing a search.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '1WIRE0' followed by 'ADDR' followed by the 8-byte long address of the device discovered by the search.
This function begins the process of searching for devices on the 1-WIRE bus. The address of the found device will be stored in internal address buffer.
This function takes up to two parameters:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
normalSearch, [optional], which can be True or False. In the case of False, an Alarm / Conditional search will be performed, which only returns devices in some sort of alarm state. See this for additional information on this topic.
The host adapter will respond with '-OK' upon successful execution of the command.
This function resets the search so that a new search can be started from the beginning.
This function takes one parameter:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function searches the 1-WIRE bus for devices belonging to the same family code as the target.
This function takes two parameters:
oneWireIndexIndex, which is always 0 on Binho Nova host adapter.
target, which is a 1-byte long device family code for which to search.
The host adapter will respond with '-OK' upon successful execution of the command.
Starts the 1-Wire Host on the given IO pin. The 1-Wire protocol can be used on any of the IO pins, however it is especially convenient to use it on IO0 and IO2 as the internal pull-up resistor can be used thus eliminating the need for an external pull-up resistor.
Start the 1-WIRE Host: 1WIRE0 BEGIN [pin] [pull]
Parameters:
The pin parameter can be set to any of the IO pins 0, 1, 2, 3, or 4.
The pull parameter can be omitted if not using the internal pull-up resistors or set to PULL to enable the pull-up resistor (available on channels 0 and 2).
Response:
This function returns an if the command succeeds in starting the 1-Wire host on the desired IO pin. If the command fails, the function will return a .
Example Usage:
Resets the 1-Wire devices on the bus and prepares them to receive commands. This is needed before communicating with any device on the bus.
Reset: 1WIRE0 RESET
Parameters:
This command has no parameters.
Response:
This function returns an if the device on the 1-Wire bus asserted a presence pulse as a result of the result on the 1-WIRE bus. If the command fails or no device asserts a pulse after the reset, the function will return a .
Example Usage:
This command writes a byte to the selected 1-WIRE device.
Write byte: 1WIRE0 WRITE [data] [power]
Parameters:
The data parameter is the 8-bit integer (byte) to write on the bus.
The power parameter indicates whether or not to leave the power applied to the device after the write has completed. This parameter is optional and will turn off power by default. To leave power on after the write, set power equal to PWR.
Response:
This function returns an if the command succeeds in writing the data. If the command fails, the function will return a .
Example Usage:
This command reads a byte from the selected 1-WIRE device.
Read byte: 1WIRE0 READ
Parameters:
This command has no parameters.
Response:
This function returns a Data Response containing the received byte in the format of 1WIRE0 READ [data]
Example Usage:
This command is used to select the device that was found as a result of the most recent SEARCH command.
Reset: 1WIRE0 SELECT
Parameters:
This command has no parameters.
Response:
This function returns an if the command succeeds in sending the SELECT command. If the command fails, the function will return a .
Example Usage:
This command is used to skip the device selection process.
Reset: 1WIRE0 SKIP
Parameters:
This command has no parameters.
Response:
This function returns an if the command succeeds in sending the SKIP command. If the command fails, the function will return a .
Example Usage:
Searches the 1-WIRE bus for the next device.
Search: 1WIRE0 SEARCH [searchMode]
Parameters:
This command has one parameter, searchmode:
Set searchmode to RESET to restart the search from the first device.
Set searchmode to COND to begin a conditional search.
Set searchmode
Response:
This function returns an if the command succeeds in searching for a device on the bus. If the command fails, the function will return a .
Example Usage:
Power down the 1-WIRE bus.
Depower: 1WIRE0 DEPOWER
Parameters:
This command has no parameters.
Response:
This function returns an if the command succeeds in depowering the bus. If the command fails, the function will return a .
Example Usage:
Gets the address of the device found using the SEARCH command.
Get address: 1WIRE0 ADDR ?
Parameters:
This command has no parameters.
Response:
This function returns a Data Response containing the address of the device found using the SEARCH command.
Example Usage:
Performs an optional SKIP or SELECT command, followed by writing 0 to 1024 bytes, and then reading 0 to 1024 bytes.
Syntax: 1WIRE0 WHR [cmd] [bytesToRead] [bytesToWrite] [hexPayload]
Parameters:
The cmd parameter instructs Nova to optionally begin the transaction with a SKIP or SELECT command. The possible values for this parameter are SKIP, SELECT, or NONE.
The bytesToRead parameter indicates the number of bytes to read after writing the hexPayload to the 1-Wire bus. This value can be from 0 to 1024.
The bytesToWrite parameter indicates the number of bytes to read to the 1-Wire bus. This value can be from 0 to 1024 and must match the length of the hexPayload parameter.
The hexPayload parameter is the data that will be written to the 1-Wire bus. This parameter should be entered as a string of hex values without a leading "0x" and no spaces. The length must match the bytesToWrite parameter.
Response:
This function returns either OK or NG when the WHR command is used only to write data (bytesToRead = 0) to the 1-Wire bus. When the WHR command is used to perform a read operation, the response will contain the requested number of data bytes read from the bus, or NG indicating that command failed to execute successfully.
Example Usage:
We've produced a video tutorial demonstrating how to use this command .


The Binho Multi-Protocol USB Host Adapter can function as an Atmel Single-Wire Interface(SWI) host device. This protocol can be configured to operate on any of the IO pins on the device, however it is especially convenient to use it on IO0 and IO2 as the internal pull-up resistor can be used thus eliminating the need for an external pull-up resistor.
The following table gives a brief overview of the available SWI commands. Of particular importance is the PACKET command and it's various sub-commands. There is much additional information in the details section of this command, but please stick around for the example on this page before jumping to the ASCII Command Set reference page.






Falsepinfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.search1WIRE(0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.select1WIRE(0)
binhoDevice.writeByte1WIRE(0, 0xAB)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.search1WIRE(0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.select1WIRE(0)
binhoDevice.readByte1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.search1WIRE(0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.select1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.skip1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.depower1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.search1WIRE(0, True)
binhoDevice.getAddress1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.search1WIRE(0, True)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, '1WIRE')
binhoDevice.begin1WIRE(0, 0, True)
binhoDevice.reset1WIRE(0)
binhoDevice.resetSearch1WIRE(0)
binhoDevice.targetSearch1WIRE(0, 0xAA)1WIRE0 BEGIN 0 PULL
-OK
1WIRE BEGIN 1
-OK1WIRE0 RESET
-OK1WIRE0 WRITE 0xAB
-OK
1WIRE0 WRITE 0xAC PWR
-OK1WIRE0 READ
-1WIRE0 READ 0xAB1WIRE0 SELECT
-OK1WIRE0 SKIP
-OK1WIRE0 SEARCH
-OK
1WIRE0 SEARCH RESET
-OK
1WIRE0 SEARCH COND
-OK
1WIRE0 SEARCH 0xAA
-OK1WIRE0 DEPOWER
-OK1WIRE0 ADDR ?
-1WIRE0 ADDR 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
1WIRE0 WHR SKIP 4 3 F00000
-1WIRE0 RXD DEADBEEFfrequency parameter can be set to any frequency from 500000 Hz to 12000000 Hz in 1000 Hz steps.Response:
This function returns an ACK Response if the command succeeds in setting the updated SPI clock frequency. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the SPI data bit order. The SPI bus bit order can be configured to either LSB first or MSB first. The default bit order setting is MSB first.
Set the SPI bit order: SPI0 ORDER [bitorder]
Get the current SPI bit order: SPI0 ORDER ?
Parameters:
The bitorder parameter shall be set as follows:
to configure the SPI bus for LSB first, set it to LSB or LSBFIRST
to configure the SPI bus for MSB first, set it to MSB or MSBFIRST
Response:
This function returns an ACK Response if the command succeeds in setting the bit order of the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the SPI mode. Modes 0, 1, 2, or 3 are determined by CPOL and CPHA. It's possible to set the mode directly, or to configure CPOL and CPHA independently to determine the mode setting. The default mode is 0.
Set the SPI bus mode: SPI0 MODE [spiMode]
Get the current SPI bus mode setting: SPI0 MODE ?
Parameters:
The spiMode parameter shall be set to 0, 1, 2, or 3 based on the desired clock polarity and phase settings:
SPI Mode
CPOL
CPHA
0
0
0
1
0
1
2
1
0
3
Response:
This function returns an ACK Response if the command succeeds in setting the mode of the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/set the SPI Clock Polarity. Clock polarity indicates the idle condition of the clock signal. This is related to the SPI mode. It's possible to configure the CPOL setting directly by using this command, or indirectly by using the MODE command. The default value of CPOL is 0.
Set the SPI Clock Polarity setting: SPI0 CPOL [polarity]
Get the current SPI Clock Polarity setting: SPI0 CPOL ?
Parameters:
The polarity parameter shall be set as follows:
to configure the SPI clock polarity for idle low, use 0.
to configure the SPI clock polarity for idle high, use 1.
Response:
This function returns an ACK Response if the command succeeds in setting the clock polarity of the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the SPI Clock Phase. Clock Phase indicates when the data is valid in relation to the clock edges. This is related to the SPI mode. It's possible to configure the CPHA setting directly by using this command, or indirectly by using the MODE command. The default value of CPHA is 0.
Set the SPI Clock Phase setting: SPI0 CPHA [phase]
Get the current SPI Clock Phase setting: SPI0 CPHA ?
Parameters:
The phase parameter shall be set as follows:
to configure the SPI clock phase for data changing on the trailing edge, use 0.
to configure the SPI clock phase for data changing on the leading edge, use 1.
Response:
This function returns an ACK Response if the command succeeds in setting the clock phase of the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the number of bits per transmission. The SPI bus can be configured to either 8 or 16 bits per transfer. The default setting is 8 bits per transfer.
Set the SPI bits per transmission setting: SPI0 TXBITS [bitcount]
Get the current SPI bits per transmission setting: SPI0 TXBITS ?
Parameters:
The bitcount parameter shall be set as follows:
to configure the SPI bus transmission for 8-bit transmissions, use 8.
to configure the SPI bus transmission for 16-bit transmissions, use 16
Response:
This function returns an ACK Response if the command succeeds in setting the number of bits per transmission for the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Starts the SPI Controller. This command must be issued before sending/receiving any data on the SPI bus.
Start the SPI transmission: SPI0 BEGIN
Parameters:
This command has no parameters.
Response:
This function returns an ACK Response if the command succeeds in starting the SPI controller. If the command fails, the function will return a NAK Response.
Example Usage:
Sends/Receives data on the SPI bus. This transfer can be done either directly, or by using a buffer.
To transfer data using the buffer: SPI0 TXRX BUF[n] [count]
To transfer data directly: SPI0 TXTX [data]
Before sending the TXRX command, be sure you've selected the target peripheral device on your SPI bus. The CS pin of the target device should be driven to the correct logical value using the IO commands.
Parameters:
When using the buffer method, count is the number of bytes to transfer from 1 to 256.
When using direct transfer, [data] is the 8-bit or 16-bit payload to transfer. The size of data depends on the TXBITS setting.
Response:
This function returns an ACK Response if the command succeeds in transferring the data on the SPI bus. If the command fails, the function will return a NAK Response.
Example Usage:
Stops the SPI controller. This command ends the SPI session until a BEGIN command restarts the SPI controller.
Stop the SPI controller: SPI0 END
Parameters:
This command has no parameters.
Response:
This function returns an ACK Response if the command succeeds in stopping the SPI controller. If the command fails, the function will return a NAK Response.
Example Usage:
This command performs a transfer of 0 to 1024 bytes in a single SPI transaction.
Transfer bytes: SPI0 WHR [writeOnlyFlag] [byteCount] [hexPayload]
Parameters:
This command has 3 parameters:
The writeOnlyFlag parameter indicates if the transfer is a write-only operation. If the writeOnlyFlag is set, Nova will not return any data that may be transferred back from the SPI peripheral device. This value can be either0 or 1.
The byteCount parameter indicates the number of bytes to transfer on the SPI bus. This value can be from 0 to 1024 and must match the length of the hexPayload parameter.
The hexPayload parameter is the data that will be written to the SPI bus. This parameter should be entered as a string of hex values without a leading "0x" and no spaces. The length must match the byteCount parameter.
Response:
This function returns either OK or NG when the WHR command is used only to write data (writeOnlyFlag = 1) to the SPI bus. When the WHR command is used to perform a read operation (writeOnlyFlag = 0), the response will contain the requested number of data bytes read from the bus, or NG indicating that command failed to execute successfully.
Example Usage:
Command
Description
Link
BEGIN
Starts the Atmel SWI host on the given IO pin.
TOKEN
This command is used to send either a WAKE, ONE, or ZERO token.
FLAG
Send a COMMAND, TRANSMIT, IDLE, or SLEEP Flag.
PACKET
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 on the SWI bus.
The first step in using the Binho Multi-Protocol USB Host Adapter as a SWI host is to put the adapter into SWI mode using the Device Operating Mode command.
Now the host adapter is in SWI communication mode. Thankfully SWI has no configurable settings (oh, the simplicity of a tightly defined protocol), so all we need to do is decide which IO pin we want to use. Let's take advantage of the internal pull-up resistor on IO0:
And just like that, we're ready to start communicating.
Let's get started communicating with the SWI device by sending a WAKE token and reading back the device ID:
If you are following along at home, there's a good chance your interaction looked like this:
That's because the timeouts of these devices make it very challenging to interact with them manually. However it's not impossible! This is a perfect time to use the "Send String..." functionality of CoolTerm:
From the "Connection" menu, select "Send String..." or use the Ctrl-T shortcut to open up two Send String windows. Enter each command followed by return into the windows. Then simply click the Send button in each of them. This allows us to ensure our interactions with the SWI device aren't delayed by the time it takes to pluck everything in on the keyboard. Of course, automating these interactions with python or another scripting language avoids the need for these sort of hacks altogether.
Now we'll construct a full packet to transmit using the PACKET command and it's sub-commands. The first step in this process is setting the OPCODE:
The packet also has two parameters, PARAM1 is 8-bits, and PARAM2 is a 16-bit value. They are both zero by default, so no need to configure them for this packet, but for the sake of demonstration they are shown above.
Now let's send the packet:
More than likely, you'll need to use the same "Send String..." trick from above in order to fire off the commands before the timeout. Or perhaps even that is too cumbersome. Rather than play this painful timing game, our recommendation is to script any SWI interactions.
Check out the examples section for a demonstration of how to automate SWI communication with an ATSHA204A device:
Moving on to the next topic, we'll cover UART, which certainly lends itself to manual interaction much more so than SWI.
The Binho Nova Multi-Protocol USB Host Adapter can serve as an I2C bus peripheral device. Due to the nature of peripheral devices needing to promptly respond to the I2C controller on the bus, the Binho Nova employs a novel approach to handling the communication on the device side to eliminate the need for communicating with the host PC during the I2C transaction. This approach entails emulating a peripheral device register bank which can be configured by the host PC. The host PC will also receive interrupts from Binho Nova when it's operating as an I2C peripheral device to inform it of communication events. This will be covered below in further detail.
The I2C peripheral device supports clock frequencies from 100kHz up to 3.4MHz, which covers all common operating modes (standard, full speed, fast, and high speed modes). The Binho Nova Multi-Protocol USB Host Adapter also features support for clock-stretching and repeated starts. There are internal pull-up resistors which can be programmatically engaged or disabled as necessary even when operating as an I2C peripheral device.
The I2C pins are fixed - SDA is assigned to IO0 and SCL is assigned to IO2. IO1, IO3, and IO4 are available for use when the host adapter is configured for I2C peripheral mode. This is particularly useful to implement interrupt or alert signals.
The following table gives a brief overview of the available I2C Peripheral Commands.
The following use of Master/Slave terminology is considered obsolete. Controller/Peripheral is now used. These firmware commands will be deprecated in an upcoming firmware release.
Feel free to jump ahead to the ASCII Command Set reference to learn the specifics of each command, or continue below to see examples of how to use these commands to implement I2C peripheral device behaviors using a Binho Nova.
I2C peripheral functionality was introduced with firmware version 0.2.0. Please ensure your Binho Nova has the latest device firmware in order to use the features on this page. You can learn how to update your device firmware .
The first step in using the Binho Nova Multi-Protocol USB Host Adapter as an I2C peripheral is to put the adapter into I2C mode using the command.
Now the host adapter is in I2C communication mode. The next step is to instruct the Binho Nova to behave as an I2C peripheral device. This is achieved by assigning it a peripheral device address to respond to as shown below, where 0xA0 is assigned as the peripheral address.
At this point, the Binho Nova will begin responding whenever an I2C controller device sends it's address out on the bus.
Typically, the I2C controller on the bus is responsible for supplying pullup resistors on the SCL and SDA signals, however during system development, it's sometimes easier to use the pullup resistors integrated in the Binho Nova. As such, it's still possible to enable the integrated resistors even when the Nova is behaving as an I2C peripheral.
As mentioned above, the Binho Nova emulates a virtual register bank in the device firmware so that it does not need to communicate with the host computer during I2C transactions. This allows the I2C bus communication to take place at normal speeds without delays while the host adapter waits for data or instructions on how to respond from a host PC. This is important so that the behavior of the system being tested does not change between interacting with real I2C devices compared to a Binho Nova operating as a peripheral device.
The Binho Nova I2C peripheral device has two modes of operation which allow it to behave like some of the most common I2C peripheral devices:
In this mode of operation, a "pointer register" is used to keep track of the current register index in the device memory bank. This pointer will auto-increment each time a register is read from or written to. This allows successive reads and writes. This is a common approach for advanced I2C devices with rich configuration settings and multiple data parameters that are interesting to be sampled/read at the same time. In this mode, the I2C controller can set the value in the pointer register by performing a 1-byte Write of the desired register index before performing an I2C read operation. This is typically referred to as a "read register" operation. Note that this is the default mode upon I2C peripheral initialization.
In this mode of operation, all I2C read and write transactions will always begin from the 0th register in the memory bank. This is very common for simple devices which just have a few registers.
The following code snippet demonstrates how to configure and query the I2C peripheral mode using the MODE command:
By default, the Binho Nova I2C peripheral device emulates a memory bank of 256 x 8-bit registers, and all bits of all registers are granted read and write access. The default value of all registers is 0xFF, and the Pointer Register is set to index 0.
The number of registers in the bank can be changed from 1 to 256 using the REGCNT command as show below:
The value of each register can be read or written to using the REG command. The snippet below demonstrates how to read the current value of register 0x00 and then write the value of 0xCD to register 0x0B:
Note that this command can also be used to read and write the Pointer register as demonstrated below:
It's very common that I2C peripheral devices will have some data which is read-only. Additionally some devices implement bits which are write-only, and always read as 0. These are typically referred to as Strobe bits. The Binho Nova allows Read and Write access controls to be applied at the individual bit level in order to achieve these behaviors.
Each register in the peripheral device memory bank has a corresponding READMASK and WRITEMASK, which are used to configure the bit-level access.
For example, a register with a READMASK of 0x3F means that the bits 5 through 0 are readable, and bits 6 and 7 would always be read as 0. The following snippet demonstrates using the READMASK command to configure the read access for the bits of register 0:
Now for a second example, a register with a WRITEMASK of 0xF0 means that the bits 7 through 4 are write-able, and bits 3 through 0 cannot be written to. Any values written to bits 3 through 0 will be discarded. The following snippet demonstrates using the WRITEMASK command to configure the write access for the bits of register 0:
By default, READMASK and WRITEMASK for all registers are 0xFF, meaning that all bits in the registers are both read-able and write-able.
This board makes it easy to interface your Binho host adapter with common 2 x 5 pin 2.54mm pitch connectors used for other common USB host adapters. Beyond changing the connector pitch, it also implements the pinout of TotalPhase(R) Cheetah and Aardvark adapters so that you can readily use any of your existing development boards and fixtures designed for use with those tools.
The small form-factor ensures it will fit perfectly in any place that the previous wire harness could connect. There are also two footprints for configurable solder bridges. One is used to tie the power pins to VUSB, 3V3, or leave disconnected. The other bridge is used to select the protocol (I2C or SPI) being used, so that it can match the pinout of the Cheetah / Aardvark correctly for the given use-case. Please see the Configuration Guide for the details.
This board is 20mm x 9.5 mm and comes with 0Ohm 0402 resistors for convenient configuration and is available for purchase in our online store here.

We highly encourage everyone to use our which is packed with features. This library is still supported, but is not recommended for new design.
The UART functionality is different than the other supported protocols, as it operates as a bridge, rather than transmitting commands only when functions are called. More information about this can be found in the .
SPI0 CLK ?
-SPI0 CLK 2000000
SPI0 CLK 5000000
-OKSPI0 ORDER ?
-SPI0 ORDER MSBFIRST
SPI0 ORDER LSBFIRST
-OKSPI0 MODE ?
-SPI0 MODE 0
SPI0 MODE 3
-OK
SPI0 CPOL ?
-SPI0 CPOL 1
SPI0 CPHA ?
-SPI0 CPHA 1SPI0 CPOL ?
-SPI0 CPOL 0
SPI0 CPOL 1
-OKSPI0 CPHA ?
-SPI0 CPHA 0
SPI0 CPHA 1
-OKSPI0 TXBITS ?
-SPI0 TXBITS 8
SPI0 TXBITS 16
-OKSPI0 BEGIN
-OKIO0 MODE DOUT
-OK
SPI0 BEGIN
-OK
IO0 VALUE LOW
-OK
SPI0 TXRX 0xAB
-SPI0 RXD 0xFF
IO0 VALUE HIGH
-OK
SPI0 END
-OK
BUF0 WRITE 0 0xAA 0xBB 0xCC
-OK
SPI0 BEGIN
-OK
IO0 VALUE LOW
-OK
SPI0 TXRX BUF0 3
-OK
IO0 VALUE HIGH
-OK
SPI0 END
-OKSPI0 END
-OKSPI0 WHR 1 4 DEADBEEF
-OK
SPI0 WHR 0 4 00000000
-SPI0 RXD DEADBEEF+MODE 0 SWI
-OKSWI0 BEGIN 0 PULL
-OKSWI0 TOKEN WAKE
-OK
SWI0 RX 4
-SWI0 RXD 0x04 0x11 0x33 0x43SWI0 TOKEN WAKE
-OK
SWI0 RX 4
-NGSWI0 PACKET OPCODE 0x02
-OK
SWI0 PACKET PARAM1 0x00
-OK
SWI0 PACKET PARAM2 0x0000
-OKSWI0 PACKET SEND
-OK
SWI0 RX 7
-SWI0 RXD 1
1






This function sets the baudrate of the UART bridge. The default baudrate is 9600bps.
This function takes two parameters:
uartIndex, which is always 0 on Binho Nova host adapter.
baud, which can be set from 300 to 1000000bps.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the baudrate of the UART bridge.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'UART0' followed by 'BAUD' followed by the configured baudrate in bps.
This function sets the number of databits for the UART connection. The default databits setting is 8 bits.
This function takes two parameters:
uartIndex, which is always 0 on Binho Nova host adapter.
databits, which can be set from 5 to 8 bits.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the number of databits for the UART connection.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'UART0' followed by 'DATABITS' followed by the configured number of bits.
This function sets the Parity bit configuration for the UART connection. The default setting is None.
This function takes two parameters:
uartIndex, which is always 0 on Binho Nova host adapter.
parity, which can be set to NONE, ODD, or EVEN.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the Parity bit configuration for the UART connection.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'UART0' followed by 'PARITY' followed by the currently configured parity setting.
This function sets the Stop bit configuration for the UART connection. The default number of stop bits is 1.
This function takes two parameters:
uartIndex, which is always 0 on Binho Nova host adapter.
stopbits, which can be set to either 1 or 2.
The host adapter will respond with '-OK' upon successful execution of the command.
This function sets the Stop bit configuration for the UART connection.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'UART0' followed by 'STOPBITS' followed by the current number of stop bits.
This function sets the escape sequence that can be used to break out of the UART bridge mode. The default escape sequence is +++UART0.
This function takes two parameters:
uartIndex, which is always 0 on Binho Nova host adapter.
escape, which must be a string of 6 to 16 characters.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the currently configured escape sequence which can be used to close the UART bridge once it's been opened.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'UART0' followed by 'ESC' followed by the currently configured escape sequence.
This function opens up the UART bridge. Note that once the bridge is open, only reading and writing UART commands can be used until the UART bridge is closed.
This function takes one parameter:
uartIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function closes an opened UART bridge.
This function takes one parameter:
sequence, which is the 6 to 16 character long escape sequence.
The host adapter will respond with '-OK' upon successful execution of the command.
This function is used to transmit data over an open UART bridge. Note that this command does not directly communicate with the Binho Nova host adapter. Instead, it's writing the data to a transmit buffer within the python library. The python library will then transmit the data placed in the buffer.
This function takes one parameter:
data, which is the data to be written to the UART bus.
This function does not return any data.
This function is used to read data over an open UART bridge. Note that this command does not directly communicate with the Binho Nova host adapter. Instead, it's reading from the received data buffer within the python library.
This function takes no parameters.
This function returns any data that has been received over the UART bridge.
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.getBaudRateUART(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.getDataBitsUART(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.getParityUART(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.getStopBitsUART(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.setEscapeSequenceUART(0, '++ESCAPE++')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.setEscapeSequenceUART(0, '++ESCAPE++')
binhoDevice.getEscapeSequenceUART(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.beginBridgeUART(0)
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.beginBridgeUART(0)
binhoDevice.stopBridgeUART('+++UART0')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.beginBridgeUART(0)
binhoDevice.writeBridgeUART('Testing...')
binhoDevice.writeBridgeUART('more testing...')
binhoDevice.stopBridgeUART('+++UART0')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'UART')
binhoDevice.setBaudRateUART(0, 115200)
binhoDevice.setDataBitsUART(0, 8)
binhoDevice.setParityUART(0, 'NONE')
binhoDevice.setStopBitsUART(0, 1)
binhoDevice.beginBridgeUART(0)
binhoDevice.writeBridgeUART('Testing...')
binhoDevice.writeBridgeUART('more testing...')
print(binhoDevice.readBridgeUART())
binhoDevice.stopBridgeUART('+++UART0')SLAVE REG
Gets/sets the value contained in a register in the device register bank
SLAVE READMASK
Gets/sets the read permissions for the bits in a given register
SLAVE WRITEMASK
Gets/sets the write permissions for the bits in a given register
Command
Description
Details
PULL
Gets/sets the current state of the on-board pull-up resistors.
SLAVE
Gets/sets the peripheral device Address
SLAVE MODE
Gets/sets the mode of operation of peripheral device
SLAVE REGCNT
Gets/sets the number of registers in the device register bank
Construct & Transmit a full data packet.
TX
Transmit one byte of data on the SWI bus.
RX
Receive n bytes of data on the SWI bus.
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This function toggles whether or not the device echos back all the commands it receives. This really has no practical use in automation, but was included in the python library for the sake of completion. Turning the echo on is best for manual use in a terminal application which doesn't support local echo. Aside from this use case, it is not recommended to turn on echo. The default state of the device is with echo turned off.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with -OK upon successful execution of the command.
Example Usage:
This function provides for a simple way to solicit a response from the device. This can be useful when verifying the connection status with the device.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with -OK upon successful execution of the command.
Example Usage:
This function sets the mode of operation of the given adapter interface. This determines which protocol is being used, and therefore the pin functions. Any IO pins which are not assigned a function for the set protocol will continue to be available for concurrent use. The default operation mode on power up is IO.
Inputs:
This function takes 2 parameters, index, as an integer, and mode, as a string.
Note that for Binho Multi-Protocol USB Host Adapter, the only valid index is 0. This aspect of the protocol is design to support future products which may have more than one adapter interface.
The following list of values are valid values for mode parameter:
'I2C'
'SPI'
'UART'
'1-WIRE'
Outputs:
The host adapter will respond with -OK upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with -NG indicating the command did not execute successfully.
Example Usage:
This function gets the host adapter operation mode. This determines which protocol is being used, and therefore the pin functions. Any IO pins which are not assigned a function for the set protocol will continue to be available for concurrent use. The default operation mode on power up is IO.
Inputs:
This function takes 1 parameters, index, as an integer. Note that for Binho Multi-Protocol USB Host Adapter, the only valid index is 0. This aspect of the protocol is design to support future products which may have more than one adapter interface.
Outputs:
The host adapter will respond with one of the following responses:
-MODE [index] IO when the host adapter is in IO mode (default).
-MODE [index] I2C when the host adapter is in I2C mode.
-MODE [index] SPI when the host adapter is in SPI mode.
Example Usage:
This function sets the host adapter display base. This determines which radix is being used when data is sent back as ASCII characters. The supported numerical bases are binary, decimal, and hexadecimal. The default numerical base on power up is hex.
Inputs:
This function takes 1 parameter, base, as a string. The following list of values are valid for this parameter:
'BIN' or '2' sets the numerical base to base-2 (binary).
'DEC' or '10' sets the numerical base to base-10 (decimal).
'HEX' or '16' sets the numerical base to base-16 (hexadecimal).
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
This function gets the host adapter display base. This determines which radix is being used when data is sent back as ASCII characters. The supported numerical bases are binary, decimal, and hexadecimal. The default numerical base on power up is hex.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with one of the following responses:
'-BASE BIN' when the host adapter is set to base-2 (binary).
'-BASE DEC' when the host adapter is set to base-10 (decimal).
'-BASE HEX' when the host adapter is set to base-16 (hexadecimal, default).
Example Usage:
This function sets the color of the internal RGB LED by setting the 8-bit red, green, and blue values.
Inputs:
This function takes three parameters, each as integer values:
r - red value expressed as 0 - 255
g - green value expressed as 0 - 255
b - blue value expressed as 0 - 255
Note that any value passed in less than 0 will be rounded up to 0. Conversely, any value passed in greater than 255 will be rounded down to 255.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
This function sets the color of the internal RGB LED by passing the name of a common color.
Inputs:
This function takes a single input parameter, color, as a string. The following list of values are valid inputs for this parameter:
'WHITE'
'RED'
'LIME'
'GREEN'
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
This function returns the firmware version information of the host adapter.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with '-FWVER' followed by a space followed by the version.
Example Usage:
This function returns the hardware version information of the host adapter.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with '-HWVER' followed by a space followed by the version.
Example Usage:
This function performs a reset but will remain in the bootloader upon power-up. This will cause the USB connection to drop and re-enumerate. The host adapter will remain in the bootloader until a new firmware image is loaded, or until it is power cycled by unplugging it from USB and plugging it back in. Note that while the device is in the bootloader, it will act as a USB mass storage device, and will not respond to any of protocol commands.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with '-BTLDR OK' immediately before resetting.
Example Usage:
This function performs a reset. This will cause the USB connection to drop and re-enumerate. This also restores all device settings to their defaults.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with '-RESET OK' immediately before resetting.
Example Usage:
This function returns the globally-unique device identifier. This deviceID can be particularly useful to reference the device when using multiple host adapters on the same computer.
Inputs:
This function takes no parameters.
Outputs:
The host adapter will respond with '-ID 0x' followed by the 16-byte device ID. The ID will be displayed in hex regardless of the current Numerical Base setting.
Example Usage:
We've released python libraries to make it lighting fast to start automating test and development tasks with a Binho Nova Multi-Protocol USB Host Adapter.
The easiest way to get started is to install this library using pip:
The installation of this library also includes the new command line interface which makes it possible to perform a lot of common functions without needing to write any code. The format of the commands is as follows:
The first command we'll try is the 'binho info' command, as it will look for any connected Binho host adapter and display it's COM port, device ID, and firmware version:
This is a great way to ensure everything is setup and working as expected. There are command line tools for nearly every feature of Binho Nova including performing I2C, SPI, and 1-Wire transactions right from the terminal. You can learn all about them .
Take a look in the folder of the codebase (hosted on github) to see example scripts which demonstrate how to use this library in your own scripts to automate Nova. These example scripts feature a lot of commentary and serve as a tutorial for using this library.
The example is a perfect place to start, as it demonstrates how to connect to the device as well as look for exceptions making it very robust.
Using Nova in your scripts is as simple as importing the library:
Then initialize a connection to the binho device as such:
When working on setups with multiple devices, you can specify the device to connect to in the following 3 ways:
grab the device with a specific index
binho = binhoHostAdapter(index=0)
or get the device using the COM port
binho = binhoHostAdapter(port=targetComport)
or get the device using the deviceID number
binho = binhoHostAdapter(deviceID = targetDeviceID)
At this point it's possible to control the device as desired. Examples of common use cases are included in this library and are briefly discussed below. When you're done with the device, be sure to close out the connection with the following:
That's all there is to it. The example scripts are introduced below, but it may also make sense to review the new Command line interface as well, as it may be possible to achieve your goals without writing any code at all.
You can find more in-depth details about our Python library here:
The packaged releases contains two libraries:
This library is essentially a wrapper for all of the commands presented in the documentation. The library is written in such a way to support multiple devices as well as by making use of threads.
This library provides a handful of functions which aid in device management, as in identifying COM ports and Binho devices attached to the host computer.
The officially-supported Python library can easily be installed using pip:
This library is cross-platform and is intended for use with Python 3.x. Source code can be found .
Let's use the class to find devices attached to this computer. Start by creating a new python script, call it binhoDemo.py, and enter the following code:
Make sure your device is plugged in and then run the script. A list of ports where Binho devices have been found will be printed to the screen.
Now that you know how to use the binhoUtilities class to discover devices, let's extend the script to connect with the first device it discovers. We'll leave a comment where we'll implement our desired functionality later in Step #4, and then just immediately close the connection and exit.
Now that we have a basic script which handles device discovery, connection, and disconnection, all that's left to do is implement our desired functionality. The simple example below shows how to generate a PWM signal on IO0.
We've just covered the most basic case of using the Python libraries to automate your Binho Nova. The full documentation of the python libraries can be found here:
And example Python scripts which demonstrate all of the various protocols and features of the Binho Nova can be found here:
The Binho Nova Multi-Protocol USB Host Adapter features a total of 5 x IO pins. Each of the IO pins is capable of multiple functions. The graphic below present the pin out as well as the functions of each of the IO pins.
Discussion regarding the specific protocols will follow this chapter, and for now the focus will be on the general use of the IO pins. These functions include Digital Input, Digital Output, Analog Input, Analog Output, PWM output, as well as interrupt-enabled inputs.
Despite the vast configuration options, this can all be achieved using just three commands.
All 5 of the IO pins are capable of functioning as a digital input pin. A pin can be set as a digital input by setting the MODE to DIN. The value of the input can then be queried. The following example demonstrates how to use IO2 as a digital input and get it's current value.
All 5 of the IO pins are capable of functioning as a digital output pin. A pin can be set as a digital output by setting the MODE to DOUT. The value of the pin can then be set using the VALUE command. The following example demonstrates how to use IO2 as a digital output and set its output to HIGH.
All 5 of the IO pins are capable of functioning as analog inputs. A pin can be set as an analog input by setting the MODE to AIN. The value of the pin can then be queried. The measured value will be returned in both ADC counts (12-bit integer) and in units of volts. Note that the voltage reference is 3.3 Volts. The following example demonstrates how to use IO2 as an analog input and get it's current value.
Only IO1 is capable of functioning as an analog output. This pin can be configured to use the 10-bit DAC to output a voltage between 0 and 3.3 Volts. IO1 can be set as an analog output by setting the MODE to AOUT. The output voltage can then be set using the VALUE command. The output voltage can be set either by passing a voltage or a 10-bit integer value. Note that the voltage reference is 3.3 Volts. The following example demonstrates how to use IO1 as an analog output.
IO0, IO2, IO3, and IO4 pins have PWM output capabilities. The duty cycle and frequency can both be controlled programmatically. The duty cycle can be set either in counts from 0 to 1024, or in percentage from 0% to 100%. Both are implemented with the VALUE command.
The default PWM Frequency is 10kHz, but can be changed from 750Hz up to 80kHz.
IO0 and IO2 PWM peripheral share a timer, so the PWMFREQ setting for these channels will always be the same. IO3 and IO4 PWM peripheral also share another time, so the PWMFREQ setting for these channels will always be the same.
When changing the PWM Frequency, the current duty cycle assigned to that signal will remain unchanged.
IO1, IO2, IO3, and IO4 signals support hardware interrupts. The interrupts can be configured to fire on rising edge, on falling edge, or on any edge. There is much more discussion on how to handle interrupts on
The Binho Nova Multi-Protocol USB Host Adapter features an internal data buffer which can be used with any of the supported protocols, both as an output buffer or an input buffer. The buffer has a maximum size of 256 bytes. While certainly far from the most interesting feature of the host adapter, it's presented in this guide before introducing the various protocol functionality so that you can have a basic understanding of it's existence and usage before diving into how to use the buffer with the different protocols.
See the sections related to each protocol to learn how to use the buffer in each specific use case.
Gets/sets the UART configuration by passing a configuration string. This allows for the configuration of databits, parity, and stopbits using a single command. The default configuration is 8 (databits), N (no parity), 1 (stopbits).
Set the UART configuration: UART0 CFG [databits] [parity] [stopbits]
Get the current UART configuration: UART0 CFG ?
Parameters:
+MODE 0 I2C
-OKI2C0 SLAVE 0xA0
-OKI2C0 SLAVE MODE ?
-I2C0 SLAVE MODE USEPTR
I2C0 SLAVE MODE STARTZERO
-OK
I2C0 SLAVE MODE ?
-I2C0 SLAVE MODE STARTZERO
I2C0 SLAVE MODE USEPTR
-OK
I2C0 SLAVE MODE ?
-I2C0 SLAVE MODE USEPTRI2C0 SLAVE REGCNT ?
-I2C0 SLAVE REGCNT 0x100
I2C0 SLAVE REGCNT 8
-OK
I2C0 SLAVE REGCNT ?
-I2C0 SLAVE REGCNT 8I2C0 SLAVE REG 0x00 ?
-I2C0 SLAVE REG 0x00 0xFF
I2C0 SLAVE REG 0x0B 0xCD
-OK
I2C0 SLAVE REG 0x0B ?
-I2C0 SLAVE REG 0x0B 0xCDI2C0 SLAVE REG PTR ?
-I2C0 SLAVE REG PTR 0x00
I2C0 SLAVE REG PTR 0x05
-OK
I2C0 SLAVE REG PTR ?
-I2C0 SLAVE REG PRT 0x05I2C0 SLAVE READMASK 0x00 0x3F
-OK
I2C0 SLAVE READMASK 0x00 ?
-I2C0 SLAVE READMASK 0x00 0x3FI2C0 SLAVE WRITEMASK 0x00 0xF0
-OK
I2C0 SLAVE WRITEMASK 0x00 ?
-I2C0 SLAVE WRITEMASK 0x00 0xF0pip install binho
'SWI'
'IO'
-MODE [index] 1WIRE when the host adapter is in 1-WIRE mode.
-MODE [index] SWI when the host adapter is in SWI mode.
-MODE [index] UART when the host adapter is in UART mode.
'BLUE'
'YELLOW'
'CYAN'
'AQUA'
'MAGENTA'
'FUCHSIA'
'PURPLE'
frequency parameter can be set to any frequency from 100000 Hz to 3400000 Hz in 1000 Hz steps.Response:
This function returns an ACK Response if the command succeeds in setting the updated I2C clock frequency. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the format of I2C addresses. The I2C clock frequency can be configured for either 7-bit or 8-bit address formats. This does not impact I2C bus perfomance and is only provided for convenience to match the formatting of manufacturer datasheets. The default address setting is 8-bit display.
Set the format of I2C address display: I2C0 ADDR [format]
Get the current format of I2C address display: I2C0 ADDR ?
Parameters:
The format parameter can be set to either 7BIT or 8BIT.
Response:
This function returns an ACK Response if the command succeeds in setting the updated I2C address format. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the current state of the on-board pull-up resistors on the I2C SCL and I2C SDA signals. The internal pull-up resistors are disabled by default.
Set the state of the pull-up resistors: I2C0 PULL [state]
Get the current state of the pull-up resistors: I2C0 PULL ?
Parameters:
The state parameter can be controlled by the following:
to engage the pull-up resistors, send 1, ON, or EN.
to disengage the pull-up resistors, send 0, OFF, or DIS.
Response:
This function returns an ACK Response if the command succeeds in setting the update the state of the pull-up resistors. If the command fails, the function will return a NAK Response.
Example Usage:
Scans for devices on the I2C bus. This command can be used to scan for a particular device address, or for all possible addresses on the bus.
Scan the bus for devices: I2C0 SCAN
Scan the bus for a device on a particular address: I2C0 SCAN [address]
Parameters:
The address parameter can be set to any valid 7-bit I2C device address.
Response:
For each address scanned, the command returns -I2C0 SCAN [address] followed by either OK if a device was found with that address, or NG if no device was found. In the case of scanning the entire bus for device, upon the completion of the scan a summary will be reported: -I2C0 SCAN OK [n] DEVICES where n indicates the number of devices discovered on the bus.
Example Usage:
Writes n bytes to a given I2C device. This command can write a single byte at a time when given the data directly, or up to 256 bytes at a time when using a buffer. This command can be used after starting the I2C transaction with the START command.
Write a single byte to an I2C device: I2C0 WRITE [data]
Write up to 256 bytes from a buffer: I2C0 WRITE BUF[n] [count]
Parameters:
The data parameter can be any valid 8-bit integer (byte) of data to send.
The count parameter is the number of bytes to be sent from the buffer, from 1 to 256.
Response:
This function returns an ACK Response if the command succeeds in writing the data to the I2C device. If the command fails, the function will return a NAK Response.
Example Usage:
Requests n bytes from a given I2C device. The maximum number of bytes in a single request is 256.
Request n bytes: I2C0 REQ [address] [count]
Request n bytes read into a buffer: I2C0 REQ [address] BUF[n] [count]
Parameters:
The address parameter can be any valid 8-bit I2C device address.
The count parameter is the number of bytes to be requested, from 1 to 256.
Response:
This function returns a Data Response with the received bytes in the format of I2C0 RXD followed by the received bytes separated by spaces. If the command fails, the function will return a NAK Response.
Example Usage:
Starts an I2C transmission to a given device by sending a start bit on the I2C bus.
Start an I2C transmission: I2C0 START [address]
Parameters:
The address parameter can be any valid 8-bit I2C device address.
Response:
This function returns an ACK Response if the command succeeds in starting the transaction. If the command fails, the function will return a NAK Response.
Example Usage:
Ends an I2C transmission. It can be used to send a stop bit or a repeated start bit.
Send stop bit: I2C0 END
Send a repeated start bit: I2C0 END R
Parameters:
This command has no parameters.
Response:
This function returns an ACK Response if the command succeeds in sending the desired bit. If the command fails, the function will return a NAK Response.
Example Usage:
This command performs a write of 0 to 1024 bytes followed by a read of 0 to 1024 bytes in a single transaction.
WHR: I2C0 WHR [hex7BitAddress] [endStop] [bytesToRead] [bytesToWrite] [hexPayload]
Parameters:
This command has 5 parameters:
The hex7BitAddress is the address of the I2C peripheral device. This parameter should be entered in hex with a leading "0x".
The endStop parameter is used to send a repeated start bit if desired. This parameter can be either 0 to follow the transaction with a repeated start bit, or 1 to send an I2C stop bit.
The bytesToRead parameter instructs Nova how many bytes to read from the target I2C peripheral device after the write operation has completed. This can be 0 to 1024.
The bytesToWrite parameter indicates the number of bytes to write to the target I2C peripheral device on the bus. This value can be from 0 to 1024 and must match the length of the hexPayload parameter.
The hexPayload parameter is the data that will be written to the I2C peripheral device. This parameter should be entered as a string of hex values without a leading "0x" and no spaces. The length must match the bytesToWrite parameter.
Response:
This function returns either OK or NG when the WHR command is used only to write data (bytesToRead = 0) to an I2C Peripheral device. When the WHR command is used to perform a read operation (bytesToRead > 0), the response will contain the requested number of data bytes read from the I2C peripheral device, or NG indicating that command failed to execute successfully.
Example Usage:
The following use of Master/Slave terminology is considered obsolete. Controller/Peripheral is now used. These firmware commands will be deprecated in an upcoming firmware release.
Configures Binho Nova to behave as an I2C peripheral device. This command is also used to get and set the peripheral device address.
Configure the I2C peripheral to start with the given device address : I2C0 SLAVE [address]
Get the current device address: I2C0 SLAVE ?
Parameters:
The address parameter can be any valid 8-bit I2C peripheral device address.
Response:
This function returns an ACK Response if the command succeeds in starting the device as an I2C peripheral. If the command fails, the function will return a NAK Response.
Example Usage:
Configures the behavior of the emulated I2C peripheral device.
The Binho Nova I2C peripheral device has two modes of operation which allow it to behave like some of the most common I2C peripheral devices:
In this mode of operation, a "pointer register" is used to keep track of the current register index in the device memory bank. This pointer will auto-increment each time a register is read from or written to. This allows successive reads and writes. This is a common approach for advanced I2C devices with rich configuration settings and multiple data parameters that are interesting to be sampled/read at the same time. In this mode, the I2C controller can set the value in the pointer register by performing a 1-byte Write of the desired register index before performing an I2C read operation. This is typically referred to as a "read register" operation. Note that this is the default mode upon I2C peripheral initialization.
In this mode of operation, all I2C read and write transactions will always begin from the 0th register in the memory bank. This is very common for simple devices which just have a few registers.
Set the mode: I2C0 SLAVE MODE [mode]
Get the current mode: I2C0 SLAVE MODE ?
Parameters:
The modeparameter can be either USEPTR or STARTZERO.
Response:
This function returns an ACK Response if the command succeeds in configuring the I2C peripheral mode. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the number of registers in the I2C peripheral device memory bank.
Set the number of registers: I2C0 SLAVE REGCNT [count]
Get the current number of registers: I2C0 SLAVE REGCNT ?
Parameters:
The count parameter can be any integer value from 1 to 256.
Response:
This function returns an ACK Response if the command succeeds in configuring the I2C peripheral to have the desired number of registers in it's memory bank. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the value of any of the registers in the I2C peripheral device, including the pointer register.
Set the value of a peripheral register: I2C0 SLAVE REG [register] [value]
Get the value of a peripheral register: I2C0 SLAVE REG [register] ?
Parameters:
The register parameter can be any integer value from 0 to the number of registers configured in the device using the REGCNT command, a max of 255. This parameter can also be PTR to access the pointer register.
The value parameter can be any integer value from 0 to 255.
Response:
This function returns an ACK Response if the command succeeds in setting the target register to the desired value. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the value of any of the register's readmask.
Set the value of a peripheral register: I2C0 SLAVE READMASK [register] [value]
Get the value of a peripheral register: I2C0 SLAVE READMASK [register] ?
Parameters:
The register parameter can be any integer value from 0 to the number of registers configured in the device using the REGCNT command, a max of 255.
The mask parameter can be any integer value from 0 to 255, where a 1 corresponds to granting read access to the corresponding bit in the register.
Response:
This function returns an ACK Response if the command succeeds in setting the READMASK register to the desired value for the specified register. If the command fails, the function will return a NAK Response.
Example Usage:
Gets/sets the value of any of the register's writemask.
Set the value of a peripheral register: I2C0 SLAVE WRITEMASK [register] [value]
Get the value of a peripheral register: I2C0 SLAVE WRITEMASK [register] ?
Parameters:
The register parameter can be any integer value from 0 to the number of registers configured in the device using the REGCNT command, a max of 255.
The mask parameter can be any integer value from 0 to 255, where a 1 corresponds to granting write access to the corresponding bit in the register.
Response:
This function returns an ACK Response if the command succeeds in setting the WRITEMASK register to the desired value for the specified register. If the command fails, the function will return a NAK Response.
Example Usage:
databits parameter can be set to 5, 6, 7, or 8.The parity parameter can be set as follows:
To set the parity to NONE, use NONE, 0, or N
To set the parity to ODD, use ODD, 1, or O
To set the parity to EVEN, use EVEN, 2, or E
The stopbits parameter can be set to either 1 or 2.
Response:
Set: This function returns an ACK Response if the command succeeds in setting the configuration. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by CFG followed by the current databits, parity, and stopbits values separated by whitespaces.
Example Usage:
Gets/sets the baudrate of the UART connection. The default baudrate is 9600 bps.
Set the UART baudrate: UART0 BAUD [rate]
Get the current UART baudrate: UART0 BAUD ?
Parameters:
The rate parameter can be set to from 300 to 1000000 bps.
Response:
Set: This function returns an ACK Response if the command succeeds in setting the baudrate. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by BAUD followed by the current baudrate.
Example Usage:
Gets/sets the number of databits for the UART connection. The default databits setting is 8.
Set the number of databits: UART0 DATABITS [bits]
Get the current number of databits: UART0 DATABITS ?
Parameters:
The bits parameter can be set to 5, 6, 7, or 8.
Response:
Set: This function returns an ACK Response if the command succeeds in setting the number of databits. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by DATABITS followed by the current number of databits.
Example Usage:
Gets/sets the parity bit configuration for the UART connection. The default parity setting is None.
Set the UART parity: UART0 PARITY [par]
Get the current UART parity: UART0 PARITY ?
Parameters:
The par parameter can be set as follows:
To set the parity to NONE, use NONE, 0, or N
To set the parity to ODD, use ODD, 1, or O
To set the parity to EVEN, use EVEN, 2, or E
Response:
Set: This function returns an ACK Response if the command succeeds in setting the desired parity configuration. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by PARITY followed by the current parity setting.
Example Usage:
Gets/sets the number of stop bits for the UART connection. The default number of stopbits is 1.
Set the number of stopbits: UART0 STOPBITS [bits]
Get the current number of stopbits: UART0 STOPBITS ?
Parameters:
The bits parameter can be set to either 1 or 2.
Response:
Set: This function returns an ACK Response if the command succeeds in setting the desired number of stopbits. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by STOPBITS followed by the current number of stopbits.
Example Usage:
Gets/sets the escape sequence that can be used to break out of the UART bridge mode. The default escape sequence is +++UART0.
Set the escape sequence: UART0 ESC [sequence]
Get the current escape sequence: UART0 ESC ?
Parameters:
The sequence parameter must be a string of 6 to 16 characters.
Response:
Set: This function returns an ACK Response if the command succeeds in setting the desired escape sequence. If the command fails, the function will return a NAK Response.
Get: This function returns -UART0 followed by ESC followed by the current escape sequence.
Example Usage:
Starts the UART bridge. The adapter will remain in UART bridge mode until the escape sequence is sent from the host computer.
Start the UART bridge: UART0 BEGIN
Parameters:
This command takes no parameters.
Response:
Set: This function returns an ACK Response if the command succeeds in opening the UART bridge. If the command fails, the function will return a NAK Response.
Example Usage:
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
# Toggle Echo On
binhoDevice.echo()
# Toggle Echo Off again
binhoDevice.echo()from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.ping()from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
# Change from IO mode to I2C mode
binhoDevice.setOperationMode(0, 'I2C')
# Now change from I2C mode to SPI mode
binhoDevice.setOperationMode(0, 'SPI')
# Let's go back to IO mode
binhoDevice.setOperationMode(0, 'IO')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.getOperationMode(0))
#-MODE IO
# Change from IO mode to I2C mode
binhoDevice.setOperationMode(0, 'I2C')
print(binhoDevice.getOperationMode(0))
#-MODE I2C
# Now change from I2C mode to SPI mode
binhoDevice.setOperationMode(0, 'SPI')
print(binhoDevice.getOperationMode(0))
#-MODE SPIfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
# Set the numerical base to each of the three supported bases
binhoDevice.setNumericalBase('BIN')
binhoDevice.setNumericalBase('DEC')
binhoDevice.setNumericalBase('HEX')
# These functions do the same as the three above
binhoDevice.setNumericalBase('2')
binhoDevice.setNumericalBase('10')
binhoDevice.setNumericalBase('16')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.getNumericalBase())
#-BASE HEX
# Change from hex to binary
binhoDevice.setNumericalBase('BIN')
print(binhoDevice.getNumericalBase())
#-BASE BIN
# Now change to decimal / base-10
binhoDevice.setNumericalBase('DEC')
print(binhoDevice.getNumericalBase())
#-BASE DECfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setLEDRGB(128,64,128)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setLEDColor('WHITE')
binhoDevice.setLEDColor('RED')
binhoDevice.setLEDColor('LIME')
binhoDevice.setLEDColor('GREEN')
binhoDevice.setLEDColor('BLUE')
binhoDevice.setLEDColor('YELLOW')
binhoDevice.setLEDColor('CYAN')
binhoDevice.setLEDColor('AQUA')
binhoDevice.setLEDColor('MAGENTA')
binhoDevice.setLEDColor('FUCHSIA')
binhoDevice.setLEDColor('PURPLE')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.getFirmwareVer())
#-FWVER 0.3from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.getHardwareVer())
#-HWVER 1.0from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.resetToBtldr())
#-BTLDR OKfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.reset())
#-RESET OKfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
print(binhoDevice.getDeviceID())
#-ID 0xc59bb495504e5336362e3120ff041d2cI2C0 CLK ?
-I2C0 CLK 400000
I2C0 CLK 3400000
-OKI2C0 ADDR ?
-I2C0 ADDR 8BIT
I2C0 ADDR 7BIT
-OKI2C0 PULL ?
-I2C0 PULL DISABLED
I2C0 PULL EN
-OK
I2C0 PULL ?
-I2C0 PULL ENABLEDI2C0 SCAN 0xC2
-I2C0 SCAN 0xC2 NG
I2C0 SCAN
-I2C0 SCAN 0x02 NG
-I2C0 SCAN 0x04 NG
-I2C0 SCAN 0x06 NG
-I2C0 SCAN 0x08 NG
-I2C0 SCAN 0x0A NG
-I2C0 SCAN 0x0C NG
[...]
-I2C0 SCAN 0xF8 NG
-I2C0 SCAN 0xFA NG
-I2C0 SCAN 0xFC NG
-I2C0 SCAN 0xFE NG
-I2C0 SCAN OK 0 DEVICES
I2C0 START 0xC2
-OK
I2C0 WRITE 0xAB
-OK
I2C0 END R
-OK
BUF0 WRITE 0xAA 0xAB 0xAC 0xAD
-OK
I2C0 START 0xC2
-OK
I2C0 WRITE BUF0 4
-OK
I2C0 END
-OKI2C0 REQ 0xC2 4
-I2C0 RXD 0xAB 0xAC 0xAD 0xAE
I2C0 REQ 0xFF 1
-NG
BUF0 CLEAR
-OK
I2C0 REQ 0xC2 BUF0 4
-OK
BUF0 READ 4
-BUF0 0xAB 0xAC 0xAD 0xAEI2C0 START 0xC2
-OKI2C0 END
-OK
I2C0 END R
-OKI2C0 WHR 76 0 1 1 0F
-I2C0 RXD 01
I2C0 WHR 76 0 6 1 02
-I2C0 RXD 0006E8FE9422I2C0 SLAVE 0xA0
-OKI2C0 SLAVE MODE ?
-I2C0 SLAVE MODE USEPTR
I2C0 SLAVE MODE STARTZERO
-OK
I2C0 SLAVE MODE ?
-I2C0 SLAVE MODE STARTZERO
I2C0 SLAVE MODE USEPTR
-OK
I2C0 SLAVE MODE ?
-I2C0 SLAVE MODE USEPTRI2C0 SLAVE REGCNT ?
-I2C0 SLAVE REGCNT 0x100
I2C0 SLAVE REGCNT 8
-OK
I2C0 SLAVE REGCNT ?
-I2C0 SLAVE REGCNT 8I2C0 SLAVE REG 0x00 ?
-I2C0 SLAVE REG 0x00 0xFF
I2C0 SLAVE REG 0x0B 0xCD
-OK
I2C0 SLAVE REG 0x0B ?
-I2C0 SLAVE REG 0x0B 0xCD
I2C0 SLAVE REG PTR ?
-I2C0 SLAVE REG PTR 0x00
I2C0 SLAVE REG PTR 0x05
-OK
I2C0 SLAVE REG PTR ?
-I2C0 SLAVE REG PRT 0x05I2C0 SLAVE READMASK 0x00 0x3F
-OK
I2C0 SLAVE READMASK 0x00 ?
-I2C0 SLAVE READMASK 0x00 0x3FI2C0 SLAVE WRITEMASK 0x00 0xF0
-OK
I2C0 SLAVE WRITEMASK 0x00 ?
-I2C0 SLAVE WRITEMASK 0x00 0xF0UART0 CFG ?
-UART0 CFG 8 N 1
UART0 CFG 8 1 2
-OKUART0 BAUD ?
-UART0 BAUD 9600
UART0 BAUD 115200
-OKUART0 DATABITS ?
-UART0 DATABITS 8
UART0 DATABITS 7
-OKUART0 PARITY ?
-UART0 PARITY NONE
UART0 PARITY E
-OK
UART0 PARITY ?
-UART0 PARITY EVENUART0 STOPBITS ?
-UART0 STOPBITS 1
UART0 STOPBITS 2
-OKUART0 ESC ?
-UART0 ESC +++UART0
UART0 ESC +!+!+!456
-OKUART0 ESC ?
-UART0 ESC +++UART0
UART0 BEGIN
-OK
Hello!
Ascii Bridge Content
+++UART0
-OK
Command
Description
Link
MODE
Gets/sets the current mode of a specific IO signal.
INT
Gets/sets the interrupt configuration of a specific IO signal.
VALUE
Gets/sets the current value of a specific IO signal. The meaning of the value is dependent on the current mode setting of the signal.
PWMFREQ
Gets/sets the current value of the PWM frequency of a specific IO signal. This is only applicable when in PWM Mode. Note that IO0 and IO2 share a PWM Frequency, and IO3 and IO4 share a PWM Frequency.
Command
Description
Link
CLEAR
Clears the contents of the buffer
ADD
Adds a single byte of data into the buffer
WRITE
Writes n bytes of data into the buffer
READ
Reads n bytes of data out of the buffer
Starts the Atmel SWI host on the given IO pin. The SWI protocol can be used on any of the IO pins, however it is especially convenient to use it on IO0 and IO2 as the internal pullup resistor can be used thus eliminating the need for an external pullup resistor.
Start the SWI host: SWI0 BEGIN [pin] [pull]
Parameters:
The pin parameter can be set to any of the IO pins 0, 1, 2, 3, or 4.
The pull parameter can be omitted if not using the internal pullup resistors or set to PULL to enable the pullup resistor (available on channels 0 and 2).
Response:
This function returns an if the command succeeds in starting the SWI host on the desired IO pin. If the command fails, the function will return a .
Example Usage:
This command is used to send either a WAKE, ONE, or ZERO token, as defined by the Atmel SWI specification. Note that due to the timing constraints of the protocol, the delay between communication with the host adapter and the PC may prohibit the construction of full data packets by stringing together ZERO and ONE tokens strung together with this command. For actual data packet transmission, use the PACKET command.
Send Token: SWI0 TOKEN [type]
Parameters:
The type parameter can be set to the following values:
to send a Wake token, use WAKE
to send a Zero token, use ZERO or 0
to send a One token, use ONE or 1
Response:
This function returns an if the command succeeds in sending the token. If the command fails, the function will return a .
Example Usage:
This command transmits a flag as defined by the Atmel SWI protocol. Note that this command is simply using the TX command below to send the predefined byte value of each of the four flags.
Transmit an SWI flag: SWI0 FLAG [flag]
Parameters:
The flag parameter can be set to either COMMAND, TRANSMIT, IDLE, or SLEEP.
Response:
This function returns an if the command succeeds in transmitting the SWI flag. If the command fails, the function will return a .
Example Usage:
This command is used to construct and transmit full data packets as defined by the Atmel SWI protocol. This command features a number of sub-commands. The typical flow is to set the OPCODE, set PARAM1 and PARAM2, then set the DATA. At this point, send the packet using the SEND subcommand and then finally CLEAR it and start preparing the next packet to send.
This subcommand is used to set the OPCODE byte of the packet: SWI0 PACKET OPCODE [code]
Parameters:
The following is a complete list of the supported opcodes that can be used for the code parameter:
DERIVEKEY
DEVREV
GENDIG
Response:
This function returns an if the command succeeds in setting the opcode. If the command fails, the function will return a .
Example Usage:
This subcommand is used to set the PARAM1 byte of the packet: SWI0 PACKET PARAM1 [data]
Parameters:
The data parameter accepts an 8-bit integer (byte) value.
Response:
This function returns an if the command succeeds in setting the PARAM1 value. If the command fails, the function will return a .
Example Usage:
This subcommand is used to set the PARAM2 bits of the packet: SWI0 PACKET PARAM2 [data]
Parameters:
The data parameter accepts a 16-bit integer value.
Response:
This function returns an if the command succeeds in setting the PARAM2 value. If the command fails, the function will return a .
Example Usage:
This subcommand is used to set the payload data of the packet.
To load 1 byte of data: SWI0 PACKET DATA [data]
To load up to 64 bytes of data from BUF[n] into the payload: SWI0 PACKET DATA BUF[n] [count]
Parameters:
The data parameter accepts an 8-bit integer (byte) value.
In the case of using the buffer to load data, the count parameter can be from 1 to 64.
Response:
This function returns an if the command succeeds in setting the payload value. If the command fails, the function will return a .
Example Usage:
This command clears the OPCODE, PARAM1, PARAM2, and DATA fields of the packet: SWI0 PACKET CLEAR
Parameters:
This command has no parameters.
Response:
This function returns an if the command succeeds in clearing the packet data. If the command fails, the function will return a .
Example Usage:
This command sends the constructed packet: SWI0 PACKET SEND
Parameters:
This command has no parameters.
Response:
This function returns an if the command succeeds in sending the packet. If the command fails, the function will return a .
Example Usage:
This command transmits a byte of data as defined by the Atmel SWI protocol.
Transmit a byte: SWI0 TX [data]
Parameters:
The data parameter is the 8-bit integer (byte) value to be transmitted.
Response:
This function returns an if the command succeeds in transmitting the byte. If the command fails, the function will return a .
Example Usage:
This command receives n bytes of data as defined by the Atmel SWI protocol.
Transmit a byte: SWI0 RX [count]
Parameters:
The count parameter is the number of bytes to receive up to a max of 255.
Response:
This function returns an if the command succeeds in receiving the bytes. If the command fails, the function will return a .
Example Usage:
IO2 MODE DIN
-OK
IO2 VALUE ?
-IO2 VALUE 0IO2 MODE DOUT
-OK
IO2 VALUE HIGH
-OKIO2 MODE AIN
-OK
IO2 VALUE ?
-IO2 VALUE 4095 3.30VIO1 MODE AOUT
-OK
IO1 VALUE 2.2V
-OK
IO1 Value 830
-OKIO0 MODE PWM
-OK
IO0 VALUE 50%
-OK
IO0 VALUE ?
-IO0 VALUE 512 50%
IO0 VALUE 0
-OK
IO0 VALUE ?
-IO0 VALUE 0 0%
IO0 VALUE 25%
-OK
IO0 VALUE ?
-IO0 VALUE 256 25%IO0 MODE PWM
-OK
IO0 PWMFREQ ?
-IO0 PWMFREQ 10000
IO0 PWMFREQ 25000
-OK
IO0 PWMFREQ 90000
-NG
IO0 PWMFREQ ?
-IO0 PWMFREQ 25000IO0 MODE PWM
-OK
IO2 MODE PWM
-OK
IO2 PWMFREQ ?
-IO2 PWMFREQ 10000
IO0 PWMFREQ 33000
-OK
IO0 PWMFREQ ?
-IO0 PWMFREQ 33000
IO2 PWMFREQ ?
-IO2 PWMFREQ 33000IO0 MODE PWM
-OK
IO0 VALUE 512
-OK
IO0 PWMFREQ 25000
-OK
IO0 VALUE ?
-IO0 VALUE 512 50%IO1 INT ?
-IO1 INT NONE
IO1 INT CHANGING
-OK
IO1 INT RISING
-OK
IO1 INT FALLING
-OK
IO1 INT NONE
-OKbinho <<subcommand>> [arguments]PS C:\Users\Jonathan> binho info
Found a Binho Nova
Port: COM3
Device ID: 0X1C4780B050515950362E3120FF141C2A
Firmware Version: 0.2.5 [Up To Date]
import binho# grab the first device found the system finds
binho = binhoHostAdapter()binho.close()pip install binho-host-adapterfrom binhoHostAdapter import binhoUtilities
from binhoHostAdapter import binhoHostAdapter
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
print('Binho Host Adapters Found On The Following Ports:')
print(devices)from binhoHostAdapter import binhoUtilities
from binhoHostAdapter import binhoHostAdapter
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
print('Binho Host Adapters Found On The Following Ports:')
print(devices)
print()
# Make sure at least one binho device was found before proceeding
if len(devices) < 1:
print('No Binho Host Adapter found...Quitting script')
exit(1)
# Target the port of the first device in the list
targetPort = devices[0]
print('Connecting to host adapter on ' + targetPort)
print()
# Connect to the binho device on the target port
binho = binhoHostAdapter.binhoHostAdapter(targetPort)
print('Connected!')
print()
#
# Here's where we'll implement our desired functionality, see Step #4
#
# Close the connection to the device before exiting
binho.close()
print('Connection closed!')
print()
# Exit gracefully
exit(0)from binhoHostAdapter import binhoUtilities
from binhoHostAdapter import binhoHostAdapter
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
print('Binho Host Adapters Found On The Following Ports:')
print(devices)
print()
# Make sure at least one binho device was found before proceeding
if len(devices) < 1:
print('No Binho Host Adapter found...Quitting script')
exit(1)
# Target the port of the first device in the list
targetPort = devices[0]
print('Connecting to host adapter on ' + targetPort)
print()
# Connect to the binho device on the target port
binho = binhoHostAdapter.binhoHostAdapter(targetPort)
print('Connected!')
print()
# Set the LED color to GREEN
binho.setLEDColor('GREEN')
print('Set LED to Green')
print()
# Set the operation mode to IO
binho.setOperationMode(0, 'IO')
# Set IO0 to PWM mode
binho.setIOpinMode(0, 'PWM')
# Set IO0 PWM Frequency to 75kHz
binho.setIOpinPWMFreq(0, 75000)
# Set IO0 PWM duty cycle to 512/1024
binho.setIOpinValue(0, 512)
print('IO0 set to PWM with 50% duty cycle / 75kHz frequency')
print()
# Close the connection to the device before exiting
binho.close()
print('Connection closed!')
print()
# Exit gracefully
exit(0)HMACCHECKMAC
LOCK
MAC
NONCE
PAUSE
RANDOM
READ
SHA
UPDATEEXTRA
WRITE
GENKEY
INFO
TEMPSENSE
VERIFY
SIGN
SWI0 BEGIN 0 PULL
-OK
SWI BEGIN 1
-OKSWI0 TOKEN WAKE
-OK
SWI0 TOKEN ZERO
-OK
SWI0 TOKEN 1
-OKSWI0 FLAG COMMAND
-OK
SWI0 FLAG TRANSMIT
-OK
SWI0 FLAG IDLE
-OK
SWI0 FLAG SLEEP
-OKSWI0 PACKET OPCODE INFO
-OKSWI0 PACKET PARAM1 0xAB
-OKSWI0 PACKET PARAM2 0xABCD
-OKSWI0 PACKET DATA 0xBB
-OK
BUF0 WRITE 0 0xA1 0xA2 0xA3 0xA4 0xA5 0xA6 0xA7 0xA8
-OK
SWI0 PACKET DATA BUF0 8
-OKSWI0 PACKET CLEAR
-OKSWI0 PACKET SEND
-OKSWI0 TX 0xAA
-OKSWI0 RX 5
-SWI0 RXD 0x0A 0x0B 0x0C 0x0D 0x0E

We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This function sets the clock frequency of the SPI bus. The default clock frequency is 2MHz.
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
clock, which is the desired frequency from 500000 Hz to 12000000 Hz in 1000 Hz steps.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the currently configured clock frequency of the SPI bus.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'CLK' followed by the configured clock frequency in Hertz.
This function sets the SPI bus bit order. The bit order can be configured to either LSB first or MSB first. The default bit order setting is MSB first.
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
order, which is the desired bit order, can be either LSBFIRST or MSBFIRST.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the currently configured SPI bus bit order.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'ORDER' followed by the currently configured bit order.
This function sets the SPI bus mode of operation. SPI Modes 0, 1, 2, or 3 are determined by CPOL and CPHA. It's possible to set the mode directly, or to configure CPOL and CPHA independently to determine the mode setting. The default mode is 0.
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
mode, which is the desired mode: 0, 1, 2, or 3.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the currently configured SPI bus mode.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'MODE' followed by the currently configured mode of operation.
This function gets the current SPI bus Clock Polarity. Clock polarity indicates the idle condition of the clock signal. This is related to the SPI mode. It's possible to configure the CPOL setting directly by using this command, or indirectly by using the MODE command. The default value of CPOL is 0.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'CPOL' followed by the currently configured clock polarity value.
This function gets the current SPI bus Clock Phase. Clock Phase indicates when the data is valid in relation to the clock edges. This is related to the SPI mode. It's possible to configure the CPHA setting directly by using this command, or indirectly by using the MODE command. The default value of CPHA is 0.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'CPHA' followed by the currently configured clock phase value.
This function sets the number of bits per transmission. The SPI bus can be configured to either 8 or 16 bits per transfer. The default setting is 8 bits per transfer.
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
bits, which is the number of bits per transfer and can be either 8 or 16.
The host adapter will respond with '-OK' upon successful execution of the command.
This function gets the number of bits per transmission.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'SPI0' followed by 'TXBITS' followed by the currently configured number of bits per transfer.
This function starts the SPI Controller. This command must be issued before sending/receiving any data on the SPI bus.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function is used to send and receive data on the SPI bus.
Before sending the TXRX command, be sure you've selected the target device on your SPI bus. The CS pin of the target device should be driven to the correct logical value using the .
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
bits, which is the number of bits per transfer and can be either 8 or 16.
The host adapter will respond with 'SPI0' followed by 'RXD' followed by the byte of data received from the SPI peripheral device during the transfer.
This function is used to send and receive data on the SPI bus using the buffer.
This function takes two parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
numBytes, which is the number of bytes to transmit from the buffer. Note that this transfer starts from the byte at index 0 in BUF0.
The host adapter will respond with '-OK' upon successful execution of the command.
This function stops the SPI Controller. The command ends the SPI session until a BEGIN command restarts the SPI controller.
This function takes one parameter:
spiIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command.
This function performs a SPI transfer up to 1024 bytes in a single transaction. This function minimizes the number of round-trips between the PC and Nova in order to maximize SPI throughput. This function is highly recommended for reading/writing SPI memory devices or in any other application where multibyte transactions are frequently used.
This function takes five parameters:
spiIndex, which is always 0 on Binho Nova host adapter.
writeFlag, which should be 1 if the transaction includes writing data to the SPI bus, or 0 if the transaction is only reading data.
readFlag, which should be 1 if the transaction includes reading data from the SPI bus, or 0 if the transaction is only writing data.
The host adapter will respond with '-OK' upon successful execution of the command when the readFlag is 0. If readFlag is 1, the host adapter will respond with '-SPI0 RXD' followed by the data read from the SPI bus. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
The function starts the Atmel SWI host on the given IO pin. The SWI protocol can be used on any of the IO pins, however it is especially convenient to use it on IO0 and IO2 as the internal pull-up resistor can be used thus eliminating the need for an external pull-up resistor.
This function takes three parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
pin, which can be any of the IO pins 0 through 4.
pullup, which can be either True or
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to send either a WAKE, ONE, or ZERO token, as defined by the Atmel SWI protocol specification. Note that due to the timing constraints of the protocol, the delay between communication with the host adapter and the PC may prohibit the construction of full data packets by stringing together a series of ZERO and ONE tokens with this command. For actual data packet transmission, use the PACKET command.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
token, which can be WAKE, ZERO, or ONE.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits a flag as defined by the Atmel SWI protocol. Note that this command is simply using the TX command below to send the predefined byte value of each of the four flags.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
flag, which can be COMMAND, TRANSMIT, IDLE, or SLEEP.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits a COMMAND flag.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits a TRANSMIT flag.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits an IDLE flag.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits a SLEEP flag.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function transmits a byte of data as defined by the Atmel SWI protocol.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
data, which is the byte of data to be transmitted.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function receives n bytes of data as defined by the Atmel SWI protocol.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
data, which is the byte of data to be transmitted.
The host adapter will respond with 'SWI0' followed by 'RXD' followed by n bytes of received data.
This function is used to set the opcode of an SWI packet.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
opCode, which is the byte of data to be transmitted.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to set the value of the Param1 byte of the SWI Packet.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
value, which is the byte of data to be transmitted in the Param1 field of the packet.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to set the 16bit value of the Param2 field of the SWI Packet.
This function takes two parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
data, which is the 16bit value to be transmitted in the Param2 field of the packet.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to set the bytes of the Data field one by one.
This function takes three parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
index, which is the byte index to load the value into the Data field.
value, which is the byte of data loaded into the given index of the Data field.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to set the Data field of the SWI packet to the contents from a buffer.
This function takes three parameters:
swiIndex, which is always 0 on the Binho Nova host adapter.
byteCount, which is the number of bytes to load from the buffer.
bufferName, which is the name of the buffer to use, typically BUF0.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function sends the the constructed SWI packet.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function clears the OpCode, Param1, Param2, and Data fields of the SWI Packet.
This function takes one parameter:
swiIndex, which is always 0 on the Binho Nova host adapter.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
numBytes, which indicates the number of bytes to be transferred on the SPI bus and must match the length of the data parameter.
data, which is a string of hex characters without the leading '0x' and no spaces indicating the data to be written to the bus, and must match the length specified by the numBytes parameter.
Falsepinfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.getClockSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.getOrderSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.getModeSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.getCpolSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.getCphaSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
binhoDevice.getBitsPerTransferSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
#configure the CS pin
binhoDevice.setIOpinMode(0, 'DOUT')
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.beginSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
#configure the CS pin
binhoDevice.setIOpinMode(0, 'DOUT')
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.beginSPI(0)
binhoDevice.setIOpinValue(0, 'LOW')
binhoDevice.transferSPI(0, 0x9F)
binhoDevice.transferSPI(0, 0x00)
binhoDevice.transferSPI(0, 0x00)
binhoDevice.transferSPI(0, 0x00)
binhoDevice.transferSPI(0, 0x00)
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.endSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
#load the buffer with the data
binhoDevice.clearBuffer(0)
binhoDevice.addByteToBuffer(0, 0x9F)
binhoDevice.addByteToBuffer(0, 0x00)
binhoDevice.addByteToBuffer(0, 0x00)
binhoDevice.addByteToBuffer(0, 0x00)
binhoDevice.addByteToBuffer(0, 0x00)
#configure the CS pin
binhoDevice.setIOpinMode(0, 'DOUT')
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.beginSPI(0)
binhoDevice.setIOpinValue(0, 'LOW')
binhoDevice.transferBufferSPI(0, 5)
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.endSPI(0)
#see what data was received during the transfer
print(binhoDevice.readBuffer(0, 5))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
#configure the CS pin
binhoDevice.setIOpinMode(0, 'DOUT')
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.beginSPI(0)
binhoDevice.setIOpinValue(0, 'LOW')
binhoDevice.transferSPI(0, 0x9F)
binhoDevice.setIOpinValue(0, 'HIGH')
binhoDevice.endSPI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
# configure the SPI Bus
binhoDevice.setOperationMode(0, 'SPI')
binhoDevice.setClockSPI(0, 4000000)
binhoDevice.setOrderSPI(0, 'MSBFIRST')
binhoDevice.setModeSPI(0, 0)
binhoDevice.setBitsPerTransferSPI(0, 8)
hostAdapter.setIOpinValue(0, 'HIGH')
# Assert CS pin
hostAdapter.setIOpinValue(0, 'LOW')
# Read 1024 bytes
print(binhoDevice.writeToReadFromSPI(0, 0, 1, 1024, 0))
# DeAssert CS pin
hostAdapter.setIOpinValue(0, 'HIGH')
hostAdapter.setIOpinValue(0, 'LOW')
# Write 4 bytes and then read 4 bytes (8 total bytes)
print(binhoDevice.writeToReadFromSPI(0, 1, 1, 8, 'DEADBEEF00000000'))
hostAdapter.setIOpinValue(0, 'HIGH')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.sendFlagSWI(0, 'IDLE')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.sendCommandFlagSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.sendTransmitFlagSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.sendIdleFlagSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.sendSleepFlagSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.transmitByteSWI(0, 0xAA)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
print(binhoDevice.receiveBytesSWI(0, 5))
#-SWI0 RXD 0x0A 0x0B 0x0C 0x0D 0x0Efrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)
binhoDevice.setPacketParam2SWI(0, 0x0003)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)
binhoDevice.setPacketParam2SWI(0, 0x0003)
binhoDevice.setPacketDataSWI(0, 0, 0x00)
binhoDevice.setPacketDataSWI(0, 1, 0x11)
binhoDevice.setPacketDataSWI(0, 2, 0x22)
binhoDevice.setPacketDataSWI(0, 3, 0x33)
binhoDevice.setPacketDataSWI(0, 4, 0x44)
binhoDevice.setPacketDataSWI(0, 5, 0x55)
binhoDevice.setPacketDataSWI(0, 6, 0x66)
binhoDevice.setPacketDataSWI(0, 7, 0x77)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)
binhoDevice.setPacketParam2SWI(0, 0x0003)
data = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF]
binhoDevice.writeToBuffer(0, 0, data)
binhoDevice.setPacketDataFromBufferSWI(swiIndex, 32, 'BUF0')
binhoDevice.sendPacketSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)
binhoDevice.setPacketParam2SWI(0, 0x0003)
binhoDevice.setPacketDataSWI(0, 0, 0x00)
binhoDevice.setPacketDataSWI(0, 1, 0x11)
binhoDevice.setPacketDataSWI(0, 2, 0x22)
binhoDevice.setPacketDataSWI(0, 3, 0x33)
binhoDevice.setPacketDataSWI(0, 4, 0x44)
binhoDevice.setPacketDataSWI(0, 5, 0x55)
binhoDevice.setPacketDataSWI(0, 6, 0x66)
binhoDevice.setPacketDataSWI(0, 7, 0x77)
binhoDevice.sendPacketSWI(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'SWI')
binhoDevice.beginSWI(0, 0, True)
binhoDevice.sendTokenSWI(0, 'WAKE')
binhoDevice.setPacketOpCodeSWI(0, 0x02)
binhoDevice.setPacketParam1SWI(0, 0x00)
binhoDevice.setPacketParam2SWI(0, 0x0003)
binhoDevice.setPacketDataSWI(0, 0, 0x00)
binhoDevice.setPacketDataSWI(0, 1, 0x11)
binhoDevice.setPacketDataSWI(0, 2, 0x22)
binhoDevice.setPacketDataSWI(0, 3, 0x33)
binhoDevice.setPacketDataSWI(0, 4, 0x44)
binhoDevice.setPacketDataSWI(0, 5, 0x55)
binhoDevice.setPacketDataSWI(0, 6, 0x66)
binhoDevice.setPacketDataSWI(0, 7, 0x77)
binhoDevice.sendPacketSWI(0)
binhoDevice.clearPacketSWI(0)







We highly encourage everyone to use our new Python package which is packed with features. This library is still supported, but is not recommended for new design.
This function sets the clock frequency of the I2C bus. The Binho Nova Multi-Protocol USB Host Adapter supports I2C bus speeds from 100kHz to 4MHz. Per the I2C specification, the common clock frequencies are 100kHz, 400kHz, and 1MHz, although it's possible to run the bus at other frequencies.
Inputs:
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
frequency, which is an integer value in Hertz in the range of 100000 to 4000000. Note that the frequency value is truncated to 1kHz resolution. For example, a frequency value of will 200800 will result in an I2C clock frequency of 200kHz.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
This function gets the clock frequency of the I2C bus. The Binho Nova supports I2C bus speeds from 100kHz to 4MHz. Per the I2C specification, the common clock frequencies are 100kHz, 400kHz, and 1MHz, although it's possible to run the bus at other frequencies.
Inputs:
This function takes one parameter:
i2cIndex, which is always 0 on Binho Nova host adapter.
Outputs:
The host adapter will respond with '-I2C0 CLK' followed by a space followed by the current I2C clock frequency in Hertz.
Example Usage:
This function is used to engage / disengage the 2.2kOhm internal pull-up resistors on the SDA and SCL signals.
Inputs:
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
state, which is the desired state of the pullup resistors, either 'EN' for enable or 'DIS' for disable. See the example below for additional acceptable values for convenience.
Outputs:
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
Example Usage:
This function is used to get the status of the 2.2kOhm internal pull-up resistors on the SDA and SCL signals, as in whether they are currently engaged or disengaged.
Inputs:
This function takes one parameter:
i2cIndex, which is always 0 on Binho Nova host adapter.
Outputs:
The host adapter will respond with '-I2C0 PULL' followed by a space followed by the current state of the pull-up resistors, either 'ENABLED' or 'DISABLED'.
Example Usage:
This function is used to scan a single address to determine if a slave device is present and responding.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which is the address of the target peripheral device on the I2C bus.
The host adapter will respond with '-I2C0 SCAN' followed by a space followed by the address scanned, followed by the scan result, which will be either 'OK' or 'NG'.
This function is used to write a single byte to a peripheral device on the I2C bus.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
data, which is the value to write to the target slave device.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to request a single byte from a peripheral device on the I2C bus.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which is the address of the target peripheral device on the I2C bus.
The host adapter will respond with '-I2C0 RXD' followed by a space followed by the received byte. If no data is received or an error occurs during the read, the response will be 'NG'.
This function is used to request data from a peripheral device on the I2C bus. The maximum number of bytes in a single request is 256.
This function takes three parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which is the address of the target peripheral device on the I2C bus.
numBytes, which is the number of bytes to request from the peripheral device.
The host adapter will respond with '-I2C0 RXD' followed by a space followed by the received bytes. If no data is received or an error occurs during the read, the response will be 'NG'.
This function is used to send data to a peripheral device on the I2C bus from the internal buffer.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
numBytes, which is the number of bytes to send from the internal buffer. The data from the buffer is sent beginning with index 0 in the buffer.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to request data from a peripheral device on the I2C bus and receive it into BUF0. The maximum number of bytes in a single request is 256.
This function takes three parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which is the address of the target peripheral device on the I2C bus.
numBytes, which is the number of bytes to request from the peripheral device.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function is used to start an I2C transmission to a target peripheral device on the I2C bus.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which is the address of the target slave device on the I2C bus.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function ends an I2C transmission. It can be used to send a stop bit or a repeated start bit.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
repeat, which shall be set to True to send a repeated start bit, otherwise the transmission will be terminated with a stop bit.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function performs a write of 0 to 1024 bytes followed by a read of 0 to 1024 bytes in a single transaction. This function minimizes the number of round-trips between the PC and Nova in order to maximize I2C throughput. This function is highly recommended for reading/writing I2C memory devices or in any other application where multibyte transactions are frequently used.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
addr, which is the address of the target I2C peripheral device on the bus. Note the address must be formatted as 7bit address in hex, without the leading "0x".
stop, which is used to indicate a stop bit should be sent at the end of the transaction. 0 = no stop bit sent, 1 = terminate transaction with stop bit.
The host adapter will respond with '-OK' upon successful execution of the command if numRBytes is 0. If numRBytes > 0, then the response will be 'I2C0 RXD' followed by the received data in Hex. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function configures Nova to behave as an I2C peripheral device assigned to the provided address.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
address, which can be any valid 8-bit I2C peripheral device address.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the address assigned to Nova while operating in I2C peripheral mode.
This function takes one parameter:
i2cIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'I2C0 SLAVE' followed by the configured device address upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function configures the behavior of the emulated I2C peripheral device. At this time, the Binho Nova I2C peripheral supports two modes of operation which allow it to behave like some of the most common I2C peripheral devices. Please see the description of the modes on the page.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
mode, which can be either USEPTR or STARTZERO.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the configured mode of the emulated I2C peripheral device. At this time, the Binho Nova I2C peripheral supports two modes of operation which allow it to behave like some of the most common I2C peripheral devices. Please see the description of the modes on the page.
This function takes one parameter:
i2cIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'I2C0 SLAVE MODE' followed by either USEPTR or STARTZERO upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function configures the number of registers to emulate in the I2C peripheral device memory bank while operating in I2C peripheral mode.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
registerCount, which can be any integer value from 1 to 256.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the number of registers being emulated in the I2C peripheral device memory bank while operating in I2C peripheral mode.
This function takes one parameter:
i2cIndex, which is always 0 on Binho Nova host adapter.
The host adapter will respond with 'I2C0 SLAVE REGCNT' followed by the number of registers upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function sets the value stored in a given register in the emulated I2C peripheral device to the provided value while operating in I2C peripheral mode.
This function takes three parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
value, which can be any integer value from 0 to 255
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the value stored in a given register in the emulated I2C peripheral device while operating in I2C peripheral mode.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
The host adapter will respond with 'I2C0 SLAVE REG' followed by the register number and the value stored in that register. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function sets the value of any register's writemask which is used to determine which bits in a register can be written to by an I2C controller on the bus.
This function takes three parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
mask, which can be any integer value from 0 to 255, where a 1 corresponds to granting write access to the corresponding bit in the register.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the value of any register's writemask which is used to determine which bits in a register can be written to by an I2C controller on the bus.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
The host adapter will respond with '-I2C0 SLAVE WRITEMASK' followed by the mask value upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function sets the value of any register's readmask which is used to determine which bits in a register can be read from by an I2C controller on the bus. This can be used to emulate strobe bits in a register.
This function takes three parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
mask, which can be any integer value from 0 to 255, where a 1 corresponds to granting read access to the corresponding bit in the register.
The host adapter will respond with '-OK' upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
This function returns the value of any register's readmask which is used to determine which bits in a register can be read from by an I2C controller on the bus.
This function takes two parameters:
i2cIndex, which is always 0 on Binho Nova host adapter.
register, which can be any integer value from 0 to the number of registers configured in the device.
The host adapter will respond with '-I2C0 SLAVE READMASK' followed by the mask value upon successful execution of the command. In case of an invalid parameter, the host adapter will respond with '-NG' indicating the command did not execute successfully.
numRBytes, which is the number of bytes to read, from 0 to 1024.
numWBytes, which is the number of bytes to write, from 0 to 1024.
data, which is a string of hex characters that matches the length specified by numWBytes parameter.
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
print(binhoDevice.getClockI2C(0))
#-I2C0 CLK 1000000from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
# any of these calls are valid ways to engage the pull up resistors
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.setPullUpStateI2C(0, 'ENABLE')
binhoDevice.setPullUpStateI2C(0, '1')
binhoDevice.setPullUpStateI2C(0, 'ON')
# any of these calls are valid ways to disengage the pull up resistors
binhoDevice.setPullUpStateI2C(0, 'DIS')
binhoDevice.setPullUpStateI2C(0, 'DISABLE')
binhoDevice.setPullUpStateI2C(0, '0')
binhoDevice.setPullUpStateI2C(0, 'OFF')from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
print(binhoDevice.getPullUpStateI2C(0))
#-I2C0 PULL ENABLED
binhoDevice.setPullUpStateI2C(0, 'DIS')
print(binhoDevice.getPullUpStateI2C(0))
#-I2C0 PULL DISABLEDfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
print(binhoDevice.scanAddrI2C(0, 0x42))
#-I2C0 SCAN 0x42 OKfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.startI2C(0, 0x42)
binhoDevice.writeByteI2C(0, 0xFA)
binhoDevice.endI2C(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
print(binhoDevice.readByteI2C(0, 0x42))
#-I2C0 RXD 0xABfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
print(binhoDevice.readBytesI2C(0, 0x42, 4))
#-I2C0 RXD 0xAB 0xAC 0xAD 0xAEfrom binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.clearBuffer(0)
binhoDevice.addByteToBuffer(0, 12)
binhoDevice.addByteToBuffer(0, 136)
binhoDevice.addByteToBuffer(0, 0)
binhoDevice.addByteToBuffer(0, 255)
binhoDevice.writeFromBufferI2C(0, 4)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.readToBufferI2C(0, 0x42, 4)
print(binhoDevice.readBuffer(0, 4))
#BUF0 12 136 0 255from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.startI2C(0, 0x42)
binhoDevice.writeByteI2C(0, 0xFA)
binhoDevice.endI2C(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
binhoDevice.startI2C(0, 0x42)
binhoDevice.writeByteI2C(0, 0xFA)
binhoDevice.endI2C(0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setClockI2C(0, 1000000)
binhoDevice.setPullUpStateI2C(0, 'EN')
#write 4 bytes, no read
binhoDevice.writeToReadFromI2C(0, 'A0', 1, 0, 4, 'DEADBEEF')
#write 2 bytes, read back 8 bytes
binhoDevice.writeToReadFromI2C(0, 'A0', 1, 8, 2, 'ABCD')
from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
print(binhoDevice.getSlaveAddressI2C(0))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
print(binhoDevice.getSlaveModeI2C(0))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
print(binhoDevice.getSlaveRegisterCount(0))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)
print(binhoDevice.getSlaveRegisterI2C(0,2))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)
# Only the lower byte of register 1 is writeable
binhoDevice.setSlaveWriteMaskI2C(0, 1, 0x0F)
# Make Registers 2 and 3 READ-ONLY
binhoDevice.setSlaveWriteMaskI2C(0, 2, 0x00)
binhoDevice.setSlaveWriteMaskI2C(0, 3, 0x00)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)
# Only the lower byte of register 1 is writeable
binhoDevice.setSlaveWriteMaskI2C(0, 1, 0x0F)
print(binhoDevice.getSlaveWriteMaskI2C(0, 1))from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)
# Only the lower byte of register 1 is readable
binhoDevice.setSlaveReadMaskI2C(0, 1, 0x0F)from binhoHostAdapter import binhoHostAdapter
# Change this to match your COMPort
default_commport = "COM22"
binhoDevice = binhoHostAdapter.binhoHostAdapter(default_commport)
binhoDevice.setOperationMode(0, 'I2C')
binhoDevice.setPullUpStateI2C(0, "EN")
binhoDevice.setSlaveAddressI2C(0, 0xA0)
binhoDevice.setSlaveModeI2C(0, "USEPTR")
binhoDevice.setSlaveRegisterCount(0, 128)
binhoDevice.setSlaveRegisterI2C(0, 0, 0xDE)
binhoDevice.setSlaveRegisterI2C(0, 1, 0xAD)
binhoDevice.setSlaveRegisterI2C(0, 2, 0xBE)
binhoDevice.setSlaveRegisterI2C(0, 3, 0xEF)
# Only the lower byte of register 1 is readable
binhoDevice.setSlaveReadMaskI2C(0, 1, 0x0F)
print(binhoDevice.getSlaveReadMaskI2C(0,1))


