MEAM.Design - MAEVARM - mBUS Peripheral Interface


Overview

New to the M2 are a number of plug-and-play add on modules, including wireless communications, inertial measurement, enhanced ADC, SD card data storage, and more. Communications take place over the TWI (two-wire interface), which is the Atmel implementation of the I2C serial protocol. The mBUS requires only three pins (D0-D2) plus power and ground, and can host up to 128 software-addressable devices.



Connections

All mBUS devices are equipped with a 5-pin 0.050" male header that is intended to mate with a female header at the end of the m2 board. Certain devices also have 0.100"-spaced holes to accommodate breadboard connections.

To connect a device to the mBUS, you have two options:

1. Solder a 0.050" 5-pin female header (Digikey part #S9010E-05-ND) onto the end of the M2, as shown in the images below:

Be careful to avoid bridging the pins together. With this header in place, you can directly connect any mBUS device directly into the m2, like this:



2. The other option would be to run wires from 5V, GND, D0, D1, and D2 to the mBUS module.



Code

To enable the mBUS, you will need to download the following C and H files:


m_bus.c (right-click, select download)
m_bus.h (right-click, select download)


Be sure to include the C file in your project:

  • For Windows OS users, if you're using Option 1, you will then need to right-click on the Source Files folder, and select Add Existing Source File(s)..., then select the m_bus.c file, and if you're using Option 2, place m_bus.c in src/.
  • For Mac and Linux users, If you're using Option 1, edit your Makefile to add "m_bus.o" after "main.o" on the OBJECTS line, and If you're using Option 2, place m_bus.c in src/.

Also, place the H file next to your main file for Option 1 or place the H file in inc/ for Option 2, and include m_bus.h in your main routine.

In order to utilize the mBUS, you must make sure that the system clock has a frequency of 16 MHz, and you must initialize the mBUS by calling "m_bus_init();"