]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/doc/build.md
usb_hid: Remove USB_Host_Shield_2.0
[max/tmk_keyboard.git] / tmk_core / doc / build.md
index 20702e94c96304612fd72c5ba1ee66dc9e8e1d54..57a36ac42b56b203e913868ae1c78db4fa241b17 100644 (file)
@@ -6,11 +6,11 @@ Download and Install
 --------------------
 ### 1. Install Tools
 
-1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager.
+1. **Toolchain** On Windows install [Atmel AVR Toolchain][atmelgcc] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack] or your favorite package manager. On Linux you can install AVR GCC with your favorite package manager.
 
-2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog].
+2. **Programmer** Install [dfu-programmer][dfu-prog]. GUI tool [Atmel FLIP][flip] also can be used on Windows.
 
-3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver.
+3. **Driver** On Windows when you start DFU bootloader on the chip first time you will see **Found New Hardware Wizard** to install driver. If you install device driver properly you will find chip name like **ATmega32U4** under **LibUSB-Win32 Devices** tree on **Device Manager**. If not you shall need to update its driver on **Device Manager**. You will find the driver in `FLIP` install directory like: `C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\`. In case of `dfu-programmer` install driver distributed with it.
 
 If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader].
 
@@ -20,7 +20,7 @@ You can find firmware source at github:
 
 - <https://github.com/tmk/tmk_keyboard>
 
-If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from:
+If you are familiar with [`git`][git] tools you are recommended to use it but you can also download zip archive from:
 
 - <https://github.com/tmk/tmk_keyboard/archive/master.zip>
 
@@ -28,7 +28,7 @@ If you are familiar with `Git` tools you are recommended to use it but you can a
 Build firmware
 --------------
 ### 1. Open terminal
-Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up.
+Open terminal window to get access to commands. Use Cygwin(or MingGW) shell terminal in Windows or `Terminal.app` on Mac OSX.
 
 ### 2. Change directory
 Move to project directory in the firmware source.
@@ -53,60 +53,65 @@ Now you have **hex** file to program on current directory. This **hex** is only
 How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual.
 
 ### 2. Program with DFU bootloader
-Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows.
+Stock AVR USB chips have DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. `FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below. Open source alternative `dfu-programmer` also supports AVR chips, it is command line tool and runs on Linux, Mac OSX and even Windows.
 
-To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`.
-If you have a proper program command in `Makefile` just type this.
 
-`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below.
-To use command line tool run this command. Note that you need to set PATH variable properly.
+To program with command of `FLIP` run this. Note that you need to set PATH variable properly.
 
     $ make -f Makefile.<variant> flip
 
-Or to program with `dfu-programmer` run:
+With `dfu-programmer` run this.
 
     $ make -f Makefile.<variant> dfu
 
+Or you can execute the command directly as the following.
+
+    $ dfu-programmer <controller> erase --force
+    $ dfu-programmer <controller> flash <your_firmware.hex>
+    $ dfu-programmer <controller> reset
+
+`<controller>` part will be `atmega32u4` or `atmega32u2` in most cases. See manual of the command for the detail. On Linux and Mac OSX you will need proper permission to program a controller and you can use `sudo` command for this purpose probably. On Linux you also can configure `udev` rules to set permission.
+
+
 #### FLIP GUI tutorial
-1. On menu bar click Device -> Select, then. `ATmega32u4`.
-2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog.
-At this point you'll see grey-outed widgets on the app get colored and ready.
+1. On menu bar click **Device** -> **Select**, then choose your chip name. (In most cases **ATmega32U2** or **ATmega32U4**)
+2. On menu bar click **Settings** -> **Communication** -> **USB**, then click **Open** button on **USB Port Connection** dialog. At this point you'll have to plug into USB and start bootloader.
 
-3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog.
-4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected.
-5. Re-plug USB cord or click 'Start Application' button to restart your controller.
+3. On menu bar click **File** -> **Load HEX File**, then select your firmware hex file on File Selector dialog.
+4. On **Operations Flow** panel click **Run** button to load the firmware binary to the chip. Note that you should keep **Erase**, **Blank Check**, **Program** and **Verify** check boxes selected.
+5. Re-plug USB cord or click **Start Application** button to restart your controller.
 Done.
 
-See also these instructions if you need.
+See also these instructions if needed.
 
 - <http://code.google.com/p/micropendous/wiki/LoadingFirmwareWithFLIP>
 - <http://www.atmel.com/Images/doc7769.pdf>
 
 
-### 3. Program with Teensy Loader
-If you have PJRC Teensy see instruction of `Teensy Loader`.
+##### Troubleshoot
+* **FLIP: AtLibUsbDfu.dll not found**
+Remove current driver and re-install one FLIP provides from DeviceManager of WIndows. See <http://imgur.com/a/bnwzy>
 
-- <http://www.pjrc.com/teensy/loader.html>
 
-Or use this command if you have command line version of Teensy Loader installed.
+### 3. Program with Other programmer
+If you are using PJRC Teensy consult with instruction of [Teensy Loader][teensy-loader]. Or run this target with `make` after you install command line version of it.
 
     $ make -f Makefile.<variant> teensy
 
-
-### 4. Program with Other programmer
-You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile.
+You may want to use other programmer like [`avrdude`][avrdude]. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile. See below.
 
     $ make -f Makefile.<variant> program
 
 
+[atmelgcc]:     http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx
 [cygwin]:       https://www.cygwin.com/
 [mingw]:        http://www.mingw.org/
-[mhv]:          https://infernoembedded.com/products/avr-tools
-[winavr]:       http://winavr.sourceforge.net/
 [crosspack]:    http://www.obdev.at/products/crosspack/index.html
 [flip]:         http://www.atmel.com/tools/FLIP.aspx
 [dfu-prog]:     http://dfu-programmer.sourceforge.net/
 [teensy-loader]:http://www.pjrc.com/teensy/loader.html
+[avrdude]:      http://savannah.nongnu.org/projects/avrdude/
+[git]:          https://git-scm.com/
 
 
 
@@ -122,6 +127,7 @@ Set your MCU and its clock in Hz.
 
     # Boot Section Size in *bytes*
     #   Teensy halfKay   512
+    #   Teensy++ halfKay 2048
     #   Atmel DFU loader 4096
     #   LUFA bootloader  4096
     OPT_DEFS += -DBOOTLOADER_SIZE=4096
@@ -141,7 +147,7 @@ Optional. Note that ***comment out*** with `#` to disable them.
     #BACKLIGHT_ENABLE = yes     # Enable keyboard backlight functionality
 
 ### 3. Programmer
-Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`.
+Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`.
 
     # avrdude with AVRISPmkII
     PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex