diff --git a/README.md b/README.md index a87cf54f559bb0c486c42a18850ca16d31130a5b..9c3a24accb725c9c58e1db977a437b55251ac90c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -<h1>XMega Learning</h1> +# XMEGA Hello-Worlds -<h2>Toolchain Installation</h2> +## Using a Commandline Toolchain <h3>Linux</h3> <p>This installation is more or less straightforward:</p> @@ -19,9 +19,8 @@ <p>Also, as of 11/30/2017, there seems to be some strange behavior when trying to use an Atmel Ice programmer from a mac. When you try to program, you may see an error message from usbdev_open() about not claiming the interface. I used the answer posted <a href='http://www.avrfreaks.net/comment/1421981#comment-1421981'>here (post 32 and 33)</a> -- the attached kext file already has the correct VID and PID. A full restart was required.</p> +## Examples using the Commandline Toolchain - -<h2>Examples</h2> <p>Below are projects using the xmega peripherals as I'm learning about them. They definitely aren't minimal "hello world" examples, but at some point hopefully I'll get around to boiling them down. For the moment, however, hopefully they demonstrate how to use each capability of the mcu.</p> <h3>DAC</h3> @@ -99,9 +98,58 @@ <li><a href='i2c/loadcell-reading-v-force.png'>Results</a></li> </ul> +## Atmel Studio Toolchain + +``` !warn! windows only, sorry ``` + +Another way to make programming these devices easier is to give in to the proprietary software world. I use [Atmel Studio](https://www.microchip.com/mplab/avr-support/atmel-studio-7) for big messy projects that want an IDE, and in unfamiliar environments where I don't know the register structure so well and would like to poke around with autocomplete. The software is available for free download. + +#### Start a New Project + +To begin, open Atmel Studio, start a new project and select **GCC C Executable Project** - GCC is the 'GNU Compiler Collection' - this just means that atmel is going to start a new C-code project for you. + + + +#### Select the Device + +Atmel Studio needs to know what kind of microcontroller it's going to build for. The XMEGA used in most [automatakit](https://gitlab.cba.mit.edu/jakeread/automatakit) projects (at the time of writing) is the XMEGA256A3U, but the lab should have available XMEGA8E5's and a few more. They all follow the same basic structure. You can search in the top-right for the chip you're using. + +I've also worked with the ATSAMD51, [made popular, and supported by adafruit](https://www.adafruit.com/product/3382) (meaning you can set it up to build code with arduino) and the ATSAMS70. Some example code for each of those should be brain-dumped at [the CBA hello-world gitlab group](https://gitlab.cba.mit.edu/pub/hello-world). + + + +#### Test Build and Flash + +To make sure you can build, use **Build > Build Solution** in the top menu, or hit F7. + +To flash code, use **Debug > Start Without Debugging** - this will attempt to build and then flash the code onto the micro. If the project is new, it will tell you you haven't set up a tool yet. This is true. With your tool plugged into a USB port, it should appear on the 'selected debugger/programmer' window. I use an Atmel ICE, and they are available in most of the How to Make labs. + + + +You should now be able to flash your code with **Debug > Start Without Debugging** or **CTRL + ALT + F5**. + +If you have errors, make sure your pinouts are correct, your board has power, and the ICE cable is plugged into the correct port (i.e. one is labelled 'SAM' and the other 'AVR' - use SAM for ATSAM boards, AVR for XMEGA and anything else). + +#### Including Example Code + +I've build a few 'libraries' for all of these chips. Each is a .c and .h file. To include them in your project, follow these steps. + +In the Atmel Studio 'Solution Explorer' (might not be open, go to View -> Solution Explorer), right-click on the Solution (mkembedded-example in this case) and do Add -> Existing Item + + + +Now select all of the .c and .h files from the example code. + + + +Your Atmel Studio environment and project embedded director should look something like this: + + + +Now we should be ready to build the example: -<h3>USB</h3> + -<h3>DMA</h3> +## Example Circuitry -<h3>WEX</h3> +In in [this subdirectory](circuit) you'll find an example eagle schematic and \ No newline at end of file diff --git a/images/atstudio-01.png b/images/atstudio-01.png new file mode 100644 index 0000000000000000000000000000000000000000..aca8d3f969476c465baf5fa9369844cec5465ff8 Binary files /dev/null and b/images/atstudio-01.png differ diff --git a/images/atstudio-02.png b/images/atstudio-02.png new file mode 100644 index 0000000000000000000000000000000000000000..0fe17ae700a5702946da8d7e2505c8e9afd9a9b6 Binary files /dev/null and b/images/atstudio-02.png differ diff --git a/images/atstudio-02_5.png b/images/atstudio-02_5.png new file mode 100644 index 0000000000000000000000000000000000000000..2d29bdc42d1ab404776b7479f43e0aa05cad3b73 Binary files /dev/null and b/images/atstudio-02_5.png differ diff --git a/images/atstudio-03.png b/images/atstudio-03.png new file mode 100644 index 0000000000000000000000000000000000000000..da38a3e676ab809b9da333f95e5fdbb3e767c6cd Binary files /dev/null and b/images/atstudio-03.png differ diff --git a/images/atstudio-04.png b/images/atstudio-04.png new file mode 100644 index 0000000000000000000000000000000000000000..e168e0be5742cbc380b2d03c8d80a9ed997d1742 Binary files /dev/null and b/images/atstudio-04.png differ diff --git a/images/atstudio-05.png b/images/atstudio-05.png new file mode 100644 index 0000000000000000000000000000000000000000..e6478ea9f4f5beb2a19fc393e5804cb8c8aaa041 Binary files /dev/null and b/images/atstudio-05.png differ diff --git a/images/atstudio-06.png b/images/atstudio-06.png new file mode 100644 index 0000000000000000000000000000000000000000..e64c3564f8e6ed18baacddb095706d9124ef7f6d Binary files /dev/null and b/images/atstudio-06.png differ diff --git a/images/atstudio-07.png b/images/atstudio-07.png new file mode 100644 index 0000000000000000000000000000000000000000..c2f95db486886274d925aacb41e4039cd3703bc3 Binary files /dev/null and b/images/atstudio-07.png differ