Afero Blog

A Simple Way to Connect

Up until the latest release, your only choice for connecting an MCU to an Afero device was through the SPI bus. SPI is a great interface but some of our customers were asking for a simple UART interface.

We heard you and now in the latest release you can do with two wires what used to take five. afLib has been extended to support the UART interface with very minor changes to your MCU code. Basically, you change a “define” to say you want to use UART, specify the UART pins, and you are up and running.

We use a slightly modified version of afPro protocol, using all the same messages to handle the communications over UART. This eliminates the need for the interrupt pin and associated interrupt service routine (needed with SPI), which simplifies the code on certain platforms.

For an example, check out: https://github.com/aferodeveloper/afLib/blob/master/examples/afBlink/afBlink.ino#L149
Search for USE_UART to find the relevant changes.

Scott Zimmerman

Born and raised in Silicon Valley, ZZ started his career at Intel in 1981 and has been building new technology ever since. He has worked with all parts of the stack from firmware to mobile applications at companies such as Intel, Apple, Sun, Danger, Microsoft, and Netflix. For fun he developed a battery charger for lithium ion batteries and was part of a team that set an electric motorcycle land speed record at the Bonneville Salt Flats.