MT-DB-U4 User Guide Overview Overview Introduction The MTDBU4 is a development board for the Atmel ATmega32U4 USB microcontroller. The board has 40 pins in a dual inline configuration with 100 mil pin spacing and 700 mil row spacing which allows for easy mounting on a breadboard. It includes a mini USB connector, status LED, 16MHz crystal, reset button, HWB boot jumper, and ISP header pads. A bootloader comes preinstalled which allows programming of the chip over USB without an external programmer. An ISP header is available which can be used with an external programmer. This header can be reconfigured to allow the MTDBU4 itself to be used as an ISP programmer (hex file available on website), or to be used as a SPI master or slave. The board can be powered via USB at 5V or it can be externally powered (3V 5.5V). All pins are routed to headers, including those used by onboard hardware. The chip can be clocked externally, and the board is compatible with HV programming. The USB connections are also routed to header pins, which allows for panelmount USB connectors. The PCB is highquality with ENIG (goldplated) finish, red soldermask, and white screenprinting showing the pinout and Arduino pin numbering. There are two 3mm mounting holes (~5mm pad). It measures approximately 2.1” x 0.9” (52mm x 23mm) and is 0.062” (1.6mm) thick. MTDBU4 Features ATmega32U4 USB microcontroller ● 32KB FLASH, 2.5KB SRAM, 1KB EEPROM ● 12 10bit ADC channels (1 used by LED which can be disconnected) ● Serial USART, SPI, and TWI (I2C) communications ● 4 timers with 14 PWM channels (up to 7 simultaneous) ● Arduino compatible (now supports IDE 1.6.7 and boards manager) ● CDC (Arduino/AVRDUDE) or DFU (FLIP) bootloader preinstalled ● Bitlash preinstalled (Arduino command shell) ● ISP header (program chip using external programmer) ● 16MHz crystal ●...
MT-DB-U4 User Guide ATmega32U4 Features High Performance, Low Power AVR 8-Bit Microcontroller ● ® Advanced RISC Architecture ● – 135 Powerful Instructions – Most Single Clock Cycle Execution – 32 x 8 General Purpose Working Registers – Fully Static Operation – Up to 16 MIPS Throughput at 16 MHz –...
Page 6
MT-DB-U4 User Guide – Power-on Reset and Programmable Brown-out Detection – Internal 8 MHz Calibrated Oscillator – Internal clock prescaler & On-the-fly Clock Switching (Int RC / Ext Osc) – External and Internal Interrupt Sources – Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby, and Extended...
Page 7
MT-DB-U4 User Guide December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide MTDBU4 Hardware MTDBU4 Hardware Board Revisions There are two board revisions, A and B. Boards shipped after November 22, 2012 are revision B. Revision B adds two 3mm (~5mm pad) mounting holes, adds a solder jumper to allow disconnection of the LED from pin D7, adds solder jumpers to allow connection of the xtal traces to two main header pins, adds Arduino pin numbering to the screen printing, and makes other various changes to improve the manufacturing process.
MT-DB-U4 User Guide Pin Descriptions Description Digital ground 5V, Vbus 5V output from USB Vbus. Vbus pin is tied to 5V pin. These pins are connected to the Vbus and UVcc pins of the microcontroller. Voltage input pin. Use solder jumper J1 to connect this pin to 5V (default setting) when using USB power. In this case, Vcc is an output. Leave J1 unconnected to supply power from an external source to the Vcc pin. This pin is connected to the Vcc and AVcc pins on the microcontroller, as well as the ISP header and reset pullup. See Power Configuration Section. 3.3V 3.3V output from the microcontrollers internal 3.3V regulator. This pin is connected to Ucap on the microcontroller. Avcc Voltage input to the analog section of the microcontroller. This pin is connected to Vcc through a 10uH inductor and 100nF capacitor and provides power to the microcontroller analog section (Avcc pin). Aref Voltage input. This is the reference voltage used by the ADC in the microcontroller. DO NOT connect if using an internal reference. Agnd Analog ground Connects to reset pin of microcontroller as well as the reset button. A 10K pullup resistor and 100nF capacitor are connected to this pin. E2 / B (Boot) This pin is connected to the HWB jumper. The jumper is connected to ground through a 240 ohm resistor. The pin is sampled after all reset sources, including powerup. If the pin is low (HWB jumper installed), then the bootloader is run. If the pin is high (HWB jumper removed), then the user application is run. This pin functions as a normal GPIO pin at all other times. The 240 ohm resistor provides shortcircuit protection in case the pin is used as an output and the jumper is installed. D7 / L (LED) The green status LED is connected to this pin. The LED is connected to ground through a 240 ohm resistor. Drive the pin high to turn on the LED. It can be disconnected by cutting the solder jumper trace (Rev B only).
MT-DB-U4 User Guide Boot Jumper / RESET button / LED This section does not apply to the Atmel DFU bootloader option, in which case, the fuses will be left at their factory default settings and the factory installed Atmel DFU bootloader will not be overwritten. The boot jumper (labeled HWB) selects between the bootloader and user application. The pin is sampled after reset or powerup. Note that the hardware HWB function of the ATmega32U4 is disabled (HWBE fuse is disabled) and the bootloader startup code is always run after reset or powerup (BOOTRST fuse is set). This startup code then samples the state of the HWB pin. If it is high, the user application runs. Otherwise, the bootloader continues to run, waiting for programming instructions while pulsing the LED. The LED remains on when jumping to the user application. The bootloader always runs at 8 MHz, which is compatible with lower voltages. It remains at 8MHz when jumping to the user application. The user may then set the cpu speed to 16MHz in software, if running at 5V. It is not necessary to remove and replace the jumper when switching between the bootloader and the user application. The jumper can be left on. After FLASH programming, the CDC bootloader will automatically jump to the application. If using the DFU bootloader, then you can command FLIP or dfu programmer to jump to the application. Then, when running the application, the reset button can be pressed to reenter the bootloader. This is useful when writing and debugging firmware. When the firmware is complete, the jumper can be removed so that future resets will always run the application. 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 the pin closest to the chip). The ISP header can be reconfigured so that pin PB0 (SS) is connected to pin 5 rather than RESET. This can be done by switching solder jumper J2, next to the ISP header, to the position opposite to the “ISP” label. This allows the MTDBU4 to be used as an AVRISPmkII programmer itself, using Dean Camera's AVRISPmkII software available at http://www.fourwalledcubicle.com/. A precompiled hex file will be made available at http://www.mattairtech.com/ on the MTDBU2 product page. Note that when using the ISP header in this way, Vcc and ground are output to the target board. Therefore, the target board should not be powered itself. You should also verify that it is safe to power the target board through the ISP connector. Another use for the ISP header configured with SS on pin 5 is to make use of SPI, either as a master or slave. SPI can also be used on the normal DIL headers. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide JTAG JTAG can be used for programming and debugging. While there is no JTAG header, all JTAG signals are available on the DIL header pins. Four JTAG signals are shared with ADC pins (F4F7). JTAG is enabled while running the bootloader only. It is disabled when the user application is run to allow access to the ADC pins. It can be reenabled in software. When using the Atmel DFU bootloader option, JTAG will always be enabled. It will then have to be disabled in software or by fuse setting to enable access to the four ADC channels. Mounting Holes There are two grounded mounting holes. They have a hole diameter of 3mm and the pad is 4.8mm. Each one is located 6.2mm from the closest long edge of the board. The hole nearest the USB connector is 11.4mm from the closest short edge. The hole furthest from the USB connector is 2.7mm from the closest short edge. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide Power Configuration Power Configuration Bus Powered 5V By default, the MTDBU4 is configured for 5V from the USB connector (Vbus). In this configuration, solder jumper J1 is set to the 5V position. This shorts 5V (Vbus) to Vcc. Thus, the 5V and Vcc pins are both outputs. The 3.3V pin is also an output from the AVR internal regulator, which must be enabled. This pin can supply about 55mA. Externally Powered – 3.4V to 5.5V In this configuration, disconnect solder jumper J1 (not set to 5V or 3.3V). Then supply 3.4V to 5.5V to the Vcc pin, which is now an input. The 5V pin still outputs 5V when the USB cable is plugged in. The 3.3V pin is also an output from the AVR internal regulator, which must be enabled. This pin can supply about 55mA. Note that when using a voltage less than 4.5V, the AVR should be set to run at 8MHz or less. This can be done in software using the prescaler (no need to change the crystal). Externally Powered – 3.0V to 3.6V In this configuration, change your code to disable the internal 3.3V regulator. Disconnect solder jumper J1 (not set to 5V or 3.3V). Then supply 3.0V to 3.6V to both the Vcc pin and the 3.3V pin, which are now both inputs. Alternatively, the solder jumper J1 can be set to the 3.3V position so that only the Vcc pin need be connected. Note that unlike the AT90USBXX2 or ATmegaXXU2, the internal 3.3V regulator cannot be used to power Vcc because the regulator is disabled on reset or powerup. Also note that if the bootloader is set to run (HWB jumper installed) the regulator will be enabled. The regulator is then disabled before jumping to the user application. The regulator is never enabled if the application is configured to run (HWB jumper not installed). Therefore, if the bootloader is to be used in this configuration, only 3.3V should be connected to Vcc. The 5V pin still outputs 5V when the USB cable is plugged in. In this configuration, the AVR should be set to run at 8MHz or less. This can be done in software using the prescaler (no need to change the crystal). USB Shield Jumper J3 can be soldered to connect the USB shield to ground. The USB specification calls for the USB shield to be connected to ground on the host side only. However, some prefer to have it grounded on the device side as well, though a ground loop would be formed. An 0603 SMT component may be soldered on the solder jumper pads as well. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide Arduino Compatibility (IDE 1.6.7) Arduino Compatibility (IDE 1.6.7) This is a fork of the Arduino AVR core from arduino/Arduino (hardware/arduino/avr/ directory) on GitHub. This will be used to maintain Arduino support for AVR boards including the MattairTech MT DBU1, MTDBU2, MTDBU4, and the MTDBU6 (see https://www.mattairtech.com/). This core is intended to be installed using Boards Manager (see below). To update from a previous version, click on MattairTech AVR Boards in Boards Manager, then click Update. What's New Initial release of the 1.6.x compatible AVR core. ● Any combination of CDC, HID, or UART can be used (or no combination), by using the Tools ● >Communication menu. Note that switching between CDC and CDC+HID will require reselecting the COM port. ● More detailed memory usage at end of compilation (see below). ● Merged in upstream updates. ● Summary Feature MT-DB-U6 MT-DB-U4 MT-DB-U2 MT-DB-U1 AT90USB64/AT90US ATmega32U4, 8 ATmega32U2, 8 AT90USB162, 8 Microcontroller B128, 8Bit AVR Bit AVR Bit AVR Bit AVR Clock Speed 16 MHz 16 MHz...
MT-DB-U4 User Guide Feature MT-DB-U6 MT-DB-U4 MT-DB-U2 MT-DB-U1 DC Current per I/O 20 mA 20 mA 20 mA 20 mA Only INT pins are supported in this core (PCINT pins are not supported). ● MTDBU4: 1 additional analog pin is available by disconnecting the LED (solder jumper on rev B ● and higher boards) MTDBU664/128: 2 additional digital, 2 additional PWM, or 2 additional INT pins available with ● RTC crystal removed. Note however, that the RTC crystal holes are smaller and closer together than the header pin holes. Special Notes Tools>Communications menu ● Currently, the Tools>Communications menu must be used to select the communications configuration. This configuration must match the included libraries. For example, when including the HID and Keyboard libraries, you must select an option that includes HID (ie: CDC_HID_UART). This menu is currently needed to select the USB PID that matches the USB device configuration (needed for Windows). This may become automatic in a future release. Include platform specific libraries ●...
MT-DB-U4 User Guide Pin Capabilities Digital: All pins can be used for general purpose I/O ● Supports INPUT, OUTPUT, and INPUT_PULLUP. ● Each pin can source or sink a maximum of 20 mA. ● Internal pullup resistors of 2050 Kohms (disconnected by default). ● Use the pinMode(), digitalWrite(), and digitalRead() functions. ● Analog Inputs: 8 pins (MTDBU6) or 11 pins (MTDBU4) can be configured as ADC ● analog inputs. These are available using the analogRead() function. ● All pins can be used for GPIO and some pins can be used for other digital functions (ie. ● pwm or serial). Each pin provides 10 bits of resolution (1024 values). ● Each pin measures from ground to 5.0 volts. ● The upper end of the measurement range can be changed using the AREF pin and the ● analogReference() function. PWM: 7 pins (MTDBU6, MTDBU4) or 4 pins (MTDBU2, MTDBU1) can be configured ● as PWM outputs. Available using the analogWrite() function. ● Each pin provides 8 bits of resolution (256 values) by default. ● External Interrupts: Up to 8 pins can be configured with external interrupts. ● 6 pins (MTDBU6), 5 pins (MTDBU4), or 8 pins (MTDBU2, MTDBU1). ...
MT-DB-U4 User Guide The upper end of the analog measurement range can be changed using the ● analogReference() function. Reset: Bring this line LOW to reset the microcontroller. ● Using Arduino with MattairTech USB boards Because of the similarities with the Arduino Leonardo, please read http://arduino.cc/en/Guide/ArduinoLeonardo first. Within the Arduino IDE Tools menu, select the appropriate MattairTech board, Frequency/Voltage, Processor, Communications setting, and COM port. There are 2 Frequency/Voltage configurations for each board, 16MHz(5V) and 8MHz(3.3V). You may select 8MHz even if using 5V. When operating at 3.3V, you should select 8MHz. Operating at 16MHz at 3.3V is out of spec, but should work fine at room temperatures. Be sure to select the Communications setting that matches your sketch (by default, this is CDC_ONLY). This is important. Note that some example sketches indicate the use of pins using the naming convention D2, D3, etc. These are Arduino digital pins, not to be confused with port D pins. Most MattairTech USB AVR boards are printed with both port pin names as well as sequential numbers indicating the Arduino pin number. You may use the 'A' or 'D' prefixes, but they are simply aliased to the arduino pin number (ie: A2 = D2 = 2). There are several libraries included with Arduino. Some of these need simple changes to work with MattairTech boards. Usually, only pin mappings need to be changed. Serial Monitor To print to the Serial Monitor over USB, use 'Serial'. Serial points to SerialUSB (Serial1 is a UART). Unlike most Arduino boards (ie. Uno), USB AVR based boards do not automatically reset when the serial monitor is opened. To see what your sketch outputs to the serial monitor from the beginning, the sketch must wait for the SerialUSB port to open first. Add the following to setup(): while (!Serial) ;...
MT-DB-U4 User Guide The MTDBU2 and MTDBU1 support 2 simultaneous tones using timers 1 and 0. Note that timer 0 has a lower accuracy for tone generation because it is 8bit (timers 3 and 1 are 16bit). Note also that use of timer 0 temporarily disables the use of delay(), which will return to normal operation once the tone stops playing. Thus, timer 0 is set with the lowest priority. For example, if generating DTMF tones on the MTDBU4, timers 3 and 1 will be used. However, the MTDBU2 and MTDBU1 will both use timer 0 for the second tone. If timer 0 is used, delay() should not be called while timer 0 is generating a tone. Instead, use _delay_ms(), which is included with avrlibc. The DTMF_Demo sketch demonstrates usage of Tone.cpp for DTMF generation. Detailed Memory Usage Output After Compilation In this release, two programs are run at the end of compilation to provide more detailed memory usage. This is enabled only when verbose messages for compilation is enabled in the IDE Preferences. Just above the normal flash usage message, is the output from the size utility. Above the size utility output is the output from the nm utility. The values on the left are in bytes. The letters stand for: T(t)=.text, D(d)=.data, B(b)=.bss, and everything else (ie: W) resides in flash (in most cases). USB Technical Notes Note that USB CDC is required for autoreset into the bootloader to work (otherwise, ● manually press reset with jumper installed). ATmegaxxU4: 832 bytes DPRAM, 1 (control, 64 byte max) + 1 (two banks, 256 byte max) + 5 (two banks, 64 byte max) endpoints AT90USBxxx6/7: 832 bytes DPRAM, 1 (control, 64 byte max) + 1 (two banks, 256 byte max) + 5 (two banks, 64 byte max) endpoints // These are used by the core #define USB_CONTROL_EP_SIZE...
MT-DB-U4 User Guide 9. Continue with AVR Core Installation below. Linux 1. No driver installation is needed. 2. On some distros, you may need to add your user to the same group as the port (ie: dialout) and/or set udev rules. 3. You MAY have to install and use Arduino as the root user in order to get reliable access to the serial port. This is true even when group permissions are set correctly, and it may fail after ● previously working. You can also create/modify a udev rule to set permissions on the port so everyone can ● read / write. 4. Continue with AVR Core Installation below. OS X UNTESTED 1. No driver installation is needed. 2. Plug in the board. You may get a dialog box asking if you wish to open the “Network Preferences”: Click the "Network Preferences..." button, then click "Apply". ● The board will show up as “Not Configured”, but it will work fine. ● 3. Continue with AVR Core Installation below. AVR Core Installation To update from a previous version, click on MattairTech AVR Boards in Boards ...
MT-DB-U4 User Guide below. 12.Plug in the board. The blink sketch should be running. 13.Click Tools>Port and choose the COM port. 14.You can now upload your own sketch. Uploading the First Sketch 1. In the Arduino IDE 1.6.7 (or above), open File>Examples>01.Basics>Blink. 2. Change the three instances of '13' to 'LED_BUILTIN'. 3. Be sure the correct options are selected in the Tools menu (see AVR Core Installation above). 4. With the board plugged in, select the correct port from Tools>Port. 5. Click the Upload button. After compiling, the sketch should be transferred to the board. 6. Once the bootloader exits, the blink sketch should be running. USB CDC Bootloader (Arduino compatible) Each board has several bootloaders available. The CDC bootloader can be used with Arduino. Version 130410 or above is required to support the autoreset feature. Note that several boards that were shipped after 130410 but before 130626 still have the old bootloader. The bootloader enters programming mode only if the jumper is installed, except when using Arduino autoreset or when the FLASH is empty. Even with the jumper installed, programming mode will NOT be entered if the reset was from the watchdog timer, unless the boot key is enabled and the key matches, as is the case with Arduino autoreset (the Arduino core uses a watchdog reset to enter the bootloader). The default CDC bootloader has the following compiletime options defined: #define ENABLE_LED_BOOT #define ENABLE_LED_APPLICATION...
MT-DB-U4 User Guide 5. Click Tools>Burn Bootloader. Ignore any messages about not supporting shutdown or reset. 6. Continue with driver installation above. Using AVRDUDE Standalone AVRDUDE can be used standalone. You can use the version included with Arduino (in arduino 1.6.7/hardware/tools/avr/bin) or download a separate version from http://download.savannah.gnu.org/releases/avrdude/. As an example, AVRDUDE will be used to upload the test firmware (blink sketch): Download firmware from https://www.mattairtech.com/software/CDCbootloadertest firmware.zip and unzip. 2. If you have not already installed the bootloader driver, see Driver Installation above. 3. Be sure there is a hex file that matches your chip. On the command line (change the hex file to match yours): avrdude -p m32u4 -c avr109 -P usb -U flash:w:"blink.hex" 1. On linux, the P option should be something like /dev/ttyACM0. 2. See http://www.nongnu.org/avrdude/usermanual/avrdude_4.html for details. 3. Press the reset button with the jumper off to load the sketch. 4. When using AVRDUDE standalone, the jumper must be installed before pressing reset to run the bootloader. Possible Future Additions Features for lower power consumption ...
130303, updates the Arduino core files and libraries to 1.0.4, updates the bootloaders, and adds support for the new MTDBU6. License and credits This core has been developed by Arduino LLC. This fork developed by Justin Mattair of MattairTech LLC. Copyright (c) 2015 Arduino LLC. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation;...
MT-DB-U4 User Guide CDC Bootloader (Arduino/AVRDUDE) CDC Bootloader (Arduino/AVRDUDE) CDC Serial Driver The CDC Serial driver allows the board to appear as a COM port. The driver itself is included with Windows, but an .inf file is needed to configure it. Download the .inf file from https://www.mattairtech.com/software/MattairTech_CDC_Driver_Signed.zip . Note that Windows Vista 64bit, Windows 7 64bit and Windows 8 require the signed driver. You may need to rename the file so that it has the inf extension. Next, plug in the board with the jumper removed. Windows will then prompt you for the MattairTech CDC Serial driver. Point the installer to the directory where you downloaded the driver and install, ignoring any warnings. Once the driver is loaded, the device will appear as the MattairTech CDC Serial device using a COM port in the device manager. If you wish, doubleclick on the CDC Serial device entry in the device manager to configure the driver. Nothing on the port settings tab needs to be changed. We are using a virtual COM port so the settings are ignored. The baud rate will always be as fast as possible. On the advanced tab, you can adjust the FIFO buffer sizes. If you experience any buffering problems (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 with AVRDUDE. Version 130410 or above is required to support the auto reset feature (note that several boards that were shipped before 130626 still have the old bootloader). If using a terminal emulator, you must first disconnect before running the bootloader. The bootloader enters programming mode only if the jumper is installed, even when using Arduino autoreset. The one exception is when the FLASH is empty. Even with the jumper installed, programming mode will NOT be entered if the reset was from the watchdog timer. The one exception to this is when the boot key is enabled and the key matches. The key will match when the Arduino IDE autoresets the board to enter bootloader programming mode. The key is needed because the Arduino core part of the firmware, which listens for the IDE autoreset signal, uses a watchdog reset to enter the bootloader. This way, the user application can make use of the watchdog timer. The bootloader will jump to the user application at the end of FLASH programming. Other operations with AVRDUDE, like writing the EEPROM, will not trigger this. Just press reset to get back to the bootloader (as long as the jumper is installed). May 2, 2014 UPDATE: Version 140502: Added #define ARDUINO_MODE to AppConfig.h. This eliminates the requirement for the • jumper to be installed. Arduino users should now always leave the jumper off. If you cannot ...
Page 26
MT-DB-U4 User Guide Removed #define ENABLE_CLKDIV_1_APPLICATION from AppConfig.h. Now, the • bootloader always runs at the crystal speed (16MHz). See next entry. Fixed problem on Linux systems where the LED would sometimes freeze and the USB • connection would fail. This was due to the bootloader running at 8MHz. Now it always runs at 16MHz. Note that when operating at 3.3V, the cpu will be overclocked, but it should work fine. Fixed problem where AVRDUDE would sometimes freeze at the end of programming. This • was due to the bootloader exiting before the last ACK was sent to AVRDUDE. This may have affected other host software as well. Increased the time between disconnecting from the USB host and switching to the application. • Updated LUFA library to version 140302. • Each board has several bootloaders available. The CDC bootloader can be used with Arduino. Version 130410 or above is required to support the autoreset feature. Note that several boards that were shipped after 130410 but before 130626 still have the old bootloader. It is strongly recommended to use version 140502 or higher when using with Arduino. The default CDC bootloader has the following compiletime options defined: #define NO_LOCK_BYTE_WRITE_SUPPORT #define ENABLE_LED_BOOT #define ENABLE_LED_APPLICATION #define DISABLE_JTAG_APPLICATION #define ENABLE_BOOT_KEY #define ENABLE_RESET_AFTER_PROGRAMMING #define ARDUINO_MODE An alternate version with the above options undefined is available on the website named Bootloader_no_options.hex. Use it if the default options interfere with your application. For example, you may disconnect the LED and use the pin as an analog input. When using the autoreset feature of Arduino, the boards.txt file must currently 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 (lufalib.org). It resides December 30, 2015 http://www.mattairtech.com/...
Page 27
MT-DB-U4 User Guide in the mtdbxx folder (where xx corresponds to the board you have). So, if you wish to use the Arduino IDE to burn the bootloader, you must temporarily change the appropriate entry in the boards.txt file to point toward the actual bootloader directory. Change it back to caterina when finished to reenable autoreset. Example for Windows: avrdude -p m32u4 -c avr109 -P COM5 -U flash:w:"bitlashdemo_MT-DB-U4.hex" Example for Linux: avrdude -p m32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:"bitlashdemo_MT-DB-U4.hex" Arduino environment: Be sure to select the COM port. Then upload your sketch with the Upload button. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide DFU Bootloader (FLIP/dfuprogrammer) DFU Bootloader (FLIP/dfuprogrammer) Installation FLIP is a graphical utility used to load firmware into the ATmega32U4. FLIP also includes the driver for the bootloader. Download FLIP 3.4.2 or higher from http://www.atmel.com/tools/FLIP.aspx. Be sure to choose the version that bundles a Java JRE if you do not already have one installed. Run the downloaded executable to begin the installation. Next, install the HWB jumper by placing the jumper cap onto the two pins marked HWB (so they are shorted). Note that HWB as printed on the board refers to the jumper function, not to the actual AVR pin. Also note that if you selected the Atmel DFU bootloader instead of the standard LUFA DFU bootloader, you will need to add an external pullup resistor to pin E2 (ie: a 10Kohm resistor between E2 and Vcc; and it must remain installed at all times). Then, connect the board to your computer via USB. Because the HWB jumper is installed, the bootloader will run. The LED should be pulsing. Windows will then prompt you for the ATmega32U4 driver. By default, this is located in the Program Files/Atmel/Flip 3.4.2/usb directory. Point the installer to that directory and install. Once the driver is loaded, the device will appear as the ATmega32U4 device under Atmel USB Devices in the device manager. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide FLIP Install the HWB jumper by placing the jumper cap onto the two pins marked HWB. Then, connect the board to your computer via USB. The LED should be pulsing (unless using the Atmel bootloader). Now launch the FLIP utility. Click on the chip icon (far left) and select the Atmega32U4. December 30, 2015 http://www.mattairtech.com/...
Page 30
MT-DB-U4 User Guide Next, click on the USB cable icon (second from left), select USB, then connect. The screen should now show information about the ATmega32U4. ** NOTE: If you get a "AtLibUsbDfu.dll not found message" error message from Flip when you click on the USB icon, the problem is a a wrong/missing board driver. Close Flip. Disconnect/reconnect/reset board as needed to get Windows to reload the driver. Point the driver install wizard to the "..\Program Files\Atmel\Flip 3.4.7\usb\" folder. Once the driver is installed, go back to step 1. Click on the File menu, and open the appropriate hex file. More information will appear about the program. All four check boxes should be checked. Be sure that erase is checked. The firmware cannot be loaded unless the flash is erased first. Now click on the Run button in the lowerleft of the screen, and the firmware will be quickly loaded onto the ATmega32U4. If verification is successful, “Verify PASS” will appear in the status message area (bottom left). December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide If the EEPROM must also be programmed, click on Select EEPROM at the bottom. Then, click on the File menu and open the appropriate eep file. You will have to change the file filter to allow you to see the eep file. Note that eep files are just hex files but with the eep extension instead of hex. More information will appear about the file when selected. Both Program and Verify should be checked. Click run to program the EEPROM. Finally, remove the jumper so that the bootloader does not run after resetting / powercycling. Initiate reset by unchecking the reset box and pressing the “Start Application” button (lower right). Or, simply press the reset button. The firmware that was just loaded will now run. dfuprogrammer dfuprogrammer is a command line utility used to program the ATmega32U4 that runs under Linux. A DFU driver installation is not required. Download version 0.5.4 or higher from http://dfu programmer.sourceforge.net/ . The following commands can be used: dfu-programmer atmega32u4 erase dfu-programmer atmega32u4 flash-eeprom YourHex.eep (if applicable) dfu-programmer atmega32u4 flash YourHex.hex dfu-programmer atmega32u4 start (to jump to application section without reset) December 30, 2015...
MT-DB-U4 User Guide Running Bitlash Demo Running Bitlash Demo Bitlash is an open source interpreted language shell and embedded programming environment. The preinstalled Bitlash demo was compiled in the Arduino environment and supports Arduino functions (ie: dw() for digitalWrite()). A terminal emulator (recommended) or the Arduino serial monitor may be used. See the CDC Bootloader section for details on installing the CDC Serial driver. The following example saves three functions to EEPROM. It is then run in the background, pulsing the LED using analog write (PWM): bitlash here! v2.0RC4 (c)2011 Bill Roy, bitlash.net -type HELP- 1706 bytes free > print free, " bytes free" 1702 bytes free > pinMode(25,1) > d25=1 > x=255;d=0; > function brighter {if (x==255) {d=0;} else { a25=++x; snooze(2);}} saved >...
Page 33
MT-DB-U4 User Guide Old Demo Program The old demo program makes use the use of the MTDBU4 as a CDC device (virtual COM port). This is one of the most common ways to connect to a PC over USB. It uses Dean Camera's opensource LUFA USB library available at http://www.fourwalledcubicle.com/. The LUFA download includes many examples that can be easily compiled for the ATmega32U4. 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 menu system. If you see garbage on the terminal screen, click on the configuration icon and change the emulation to ANSI (or ANSIW). After connecting, a message that reads “Press any Key” is printed periodically. If you do not see this message, just press any key to continue. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide Fuse and Lock Settings Fuse and Lock Settings The bootloaders were preinstalled with the following commands (ATmega32u4 CDC bootloader shown): avrdude p m32u4 c avrisp2 P usb e avrdude p m32u4 c avrisp2 P usb U lfuse:w:0x7f:m U hfuse:w:0x98:m U efuse:w:0xcb:m avrdude p m32u4 c avrisp2 P usb B 4 U flash:w:"Bootloader.hex" The Bitlash program was preinstalled with the following command ( ATmega32u4 CDC bootloader shown): avrdude p m32u4 c avr109 P /dev/ttyACM0 U flash:w:"bitlashdemo_MTDBU4.hex" The lockbits are not set with the CDC bootloader. They ARE set with the Atmel DFU bootloader. Troubleshooting / FAQ Troubleshooting / FAQ The board may have either the TQFP or the QFN chip package installed (usually the TQFP). ● Additionally, on rare occasions, the RC variant will be installed. If so, the fuses will be changed such that the chip is exactly the same as the nonRC variant. The solder jumper J1 can become unsoldered when attaching headers. ● Support Information Support Information Please check the MattairTech website (http://www.MattairTech.com/) for firmware and software updates. Email me if you have any feature requests, suggestions, or if you have found a bug. If you need support, please contact me (email is best). You can also find support information at the MattairTech website. A support 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 Heppner, OR 97836 USA 541-626-1531 justin@mattair.net...
Further, the user indemnifies MattairTech LLC from all claims arising from the handling or use of the goods. Due to the open construction of the product, it is the user's responsibility to take any and all appropriate precautions with regard to electrostatic discharge and any other technical or legal concerns.
Be sure to limit current consumption to prevent excessive heat. The regulator will enter thermal shutdown if it gets too hot. CAUTION The MT-DB-U4 contains static sensitive components. Use the usual ESD procedures when handling. December 30, 2015 http://www.mattairtech.com/...
MT-DB-U4 User Guide Appendix B: Other MattairTech Products Appendix B: Other MattairTech Products ZeptoProg II AVRISP mkII Programmer ● AVRISPmkII compatible AVR Programmer ● Supports all AVRs with ISP, PDI, or TPI ● Optional 5V output via headers to target board, with ● standard jumper and PTC fuse 4channel Logic Analyzer ● Serial bridge / pattern generator / SPI interface ● GPIO / PWM / frequency input & output ● Atmel Studio / AVRDUDE support ● Target board voltage of 2V to 5.5V via levelshifted ● pins on two main headers MTDBU6 USB AVR development board ● AT90USB646 / AT90USB1286 USB AVR ● 64KB/128KB FLASH, 4KB/8KB SRAM ● 5V, 500mA LDO regulator (3V30V input) ● Auto power source selection IC (USB/External) ● 16MHz and 32.768KHz crystals ● Arduino compatible ● CDC or DFU bootloader ●...
Need help?
Do you have a question about the MT-DB-U4 and is the answer not in the manual?
Questions and answers