background image

MT-DB-U2

Manual

D2, D3, etc. These are Arduino digital pins, not to be confused with port D pins. MattairTech boards 

are printed with both port pin names as well as sequential numbers indicating Arduino digital/analog 
pins (0 means D0 or A0, 10 means D10 or A10, etc).

Using Libraries

There are several libraries included with Arduino. Some of these needed simple changes to 

work with MattairTech boards. If a library was ported, it is included in the MattairTech download and 

installed in the Arduino user directory with "_MattairTech_Port" appended to the name of the original 
directory name. This can be seen in the Arduino IDE in File­>Sketchbook­>libraries and File­

>Examples. If you see the Files­>Examples version of a particular library then you must use it instead 
of the original library which will still be shown lower on the menu. If there is no Files­>Examples 

version, then you can use the original, which did not require porting. If there is a library you would like 
to use that is not included with Arduino, email support and I should be able to quickly support it. Often,

only pin mappings need to be changed. The I2cMaster library contains a software I2C library that can 
be used with the MT­DB­U1 and MT­DB­U2, which do not contain I2C hardware.

USB Serial interface

The LUFA directory contains a reorganized subset of the LUFA USB library by Dean Camera 

(fourwalledcubicle.com). It implements a CDC class device, which appears as a COM port on the host 
computer. A terminal emulator or the Arduino serial monitor can be used to communicate with the board. 
Use this interface the same way you would on a standard Arduino (ie: Serial.println()). The interface is 
nearly the same as the one in HardwareSerial.cpp. For example:

void setup() {
  Serial.begin(9600); // The default settings for USB options are used (all enabled)
  pinMode(2, INPUT);
}

void loop() {
  int sensorValue = digitalRead(2);
  Serial.println(sensorValue, DEC);
  //Serial.flush();

// needed if autoflush is not used

  delay(1000);
}

Serial.begin() sets up the USB serial interface with a single 32­bit argument. This value is setup by ORing 
three USB options together along with the optional baud rate. This works because the three options are 
stored in the upper bits of the 32­bit value. The baud rate is ignored because the fastest speed supported is
always used (2Mbps for the AT90USB162 and ATmega32U2, 8Mbps for the ATmega32U4). For example:

Serial.begin(9600 | USB_LED_ENABLED | USB_WAITFORCONNECT_DISABLED | USB_AUTOFLUSH_ENABLED);

Note that Serial.begin() is no longer needed to support the HID keyboard or mouse. Also note that 
USB_WAITFORCONNECT_DISABLED is now the default option (it was enabled prior to 1.0.5).

USB_LED_ENABLED, USB_LED_DISABLED

If USB_LED_ENABLED is set, then the LED will display the state of the USB connection (on 

October 29, 2015

15

http://www.mattairtech.com/

Summary of Contents for MT-DB-U2

Page 1: ...MT DB U2 Manual October 29 2015 1 http www mattairtech com...

Page 2: ...to 5 5V 12 Externally Powered 3 0V to 3 6V 12 USB Shield 12 Arduino Compatibility 13 Features 13 Pin Mapping 13 Installation 14 Using Arduino 14 Using Libraries 15 USB Serial interface 15 CDC Bootload...

Page 3: ...ble with HV programming The USB connections are also routed to header pins which allows for panel mount USB connectors The PCB is high quality with ENIG gold plated finish red soldermask and white scr...

Page 4: ...mory Endpoint 0 for Control Transfers from 8 up to 64 bytes 4 Programmable Endpoints IN or Out Directions Bulk Interrupt and IsochronousTransfers Programmable maximum packet size from 8 to 64 bytes Pr...

Page 5: ...5x5mm TQFP32 packages Operating Voltages 2 7 5 5V Operating temperature Industrial 40 C to 85 C Maximum Frequency 8 MHz at 2 7V Industrial range 16 MHz at 4 5V Industrial range October 29 2015 5 http...

Page 6: ...MT DB U2 Manual MT DB U2 Hardware MT DB U2 Hardware Layout Header Pins October 29 2015 6 http www mattairtech com...

Page 7: ...MT DB U2 Manual Solder Jumpers October 29 2015 7 http www mattairtech com...

Page 8: ...d to this pin when solder jumper J2 is set The LED is connected to ground through a 240 ohm resistor The user application is free to use this LED Drive the pin high to turn on the LED D7 HWB This pin...

Page 9: ...n external clock is is used solder jumper J6 can be switched to connect the microcontroller pin directly to header pin rather than the onboard crystal An external clock signal can then be applied to p...

Page 10: ...pullup on the reset line ISP Header The ISP header is configured by default to allow ISP programming using an external programmer That is RESET is routed to pin 5 Pin 1 is marked on the board it is th...

Page 11: ...3V Vcc 5V UVcc Vcc Disable 8 MHz WARNING Care must be taken when configuring the solder jumpers It is possible to cause permanent damage to the device or the power supply by improperly setting the ju...

Page 12: ...Externally Powered 3 0V to 3 6V In this configuration solder jumper J8 is set such that both UVcc and 3 3V are connected to Vcc Vcc is then supplied externally with 3 0V to 3 6V on the Vcc header pin...

Page 13: ...as the original HardwareSerial cpp ie Serial println Hello Based on LUFA USB library by Dean Camera www fourwalledcubicle com USART1 also available can be used at the same time Arduino AVRDUDE compati...

Page 14: ...ware tools avr avr include avr power h with arduino user directory hardware MattairTech install power h 8 Now plug in the board with the jumper installed so that the bootloader runs Point the driver i...

Page 15: ...s a reorganized subset of the LUFA USB library by Dean Camera fourwalledcubicle com It implements a CDC class device which appears as a COM port on the host computer A terminal emulator or the Arduino...

Page 16: ...rial The default setting is USB_WAITFORCONNECT_DISABLED USB_AUTORESET_ENABLED USB_AUTORESET_DISABLED If USB_AUTORESET_ENABLED is set the bootloader will be invoked automatically by the Arduino IDE If...

Page 17: ...one and after any subsequent printing during tone generation Otherwise some data may not be sent until the tone stops and autoflushing returns to normal operation The USB LED handling if enabled will...

Page 18: ...oblems ie a delayed response to user input then change both buffer sizes to 1 CDC Bootloader The CDC bootloader uses the AVR109 protocol and can be used withing the Arduino environment or directly wit...

Page 19: ...rrently list the bootloader directory as caterina the bootloader used on the Leonardo The actual bootloader is a modified version of the LUFA CDC bootloader by Dean Camera lufa lib org It resides in t...

Page 20: ...3886 and install Once FLIP is installed the DFU bootloader drivers can be loaded Install the HWB jumper and power up the board or press reset This will enter the DFU bootloader The LED should be puls...

Page 21: ...er and power up the board or press reset This will enter the DFU bootloader The LED should be pulsing Now launch the FLIP utility When it has loaded click on the chip icon and select the Atmega32U2 Oc...

Page 22: ...e quickly loaded onto the ATmega32U2 You may also program the EEPROM If so click on Select EEPROM at the bottom Then click on the File menu and open the appropriate eep file You will have to change th...

Page 23: ...wnload version 0 5 4 or higher from http dfu programmer sourceforge net The following commands can be used dfu programmer atmega32u2 erase dfu programmer atmega32u2 flash eeprom YourHex eep if applica...

Page 24: ...bitlash net type HELP 1706 bytes free print free bytes free 1702 bytes free pinMode 13 1 d13 1 x 255 d 0 function brighter if x 255 d 0 else a13 x snooze 2 saved function dimmer if x 0 d 1 else a13 x...

Page 25: ...y examples that can be easily compiled for the ATmega32U2 See the CDC Bootloader section for details on installing the CDC Serial driver The old demo requires an ANSI terminal to allow drawing of the...

Page 26: ...MT DB U2 Manual Schematic Schematic October 29 2015 26 http www mattairtech com...

Page 27: ...pport forum is planned Support for AVRs in general can be found at AVRfreaks http www avrfreaks net There I monitor the forums section as the user physicist Justin Mattair MattairTech LLC PO Box 1079...

Page 28: ...TRATION OR EVALUATION PURPOSES ONLY It is not a finished product and may not yet comply with some or any technical or legal requirements that are applicable to finished products including without limi...

Page 29: ...tor to power itself be sure not to exceed the regulator maximum current output CAUTION The MT DB U2 contains static sensitive components Use the usual ESD procedures when handling CAUTION Improper fus...

Page 30: ...B 8KB SRAM 5V 500mA LDO regulator 3V 30V input Auto power source selection IC USB External 16MHz and 32 768KHz crystals Arduino compatible CDC or DFU bootloader MT DB X4 USB AVR XMEGA board ATxmega128...

Reviews: