Atmel Studio with ATtiny817 Xplained Mini

Prerequisites

Workflow

  1. 1.Launch Atmel Studio 7.0.
  2. 2.The page shown in the figure below will appear when ATtiny817 Xplained Mini is connected to Atmel Studio 7.0.
    Figure 1. ATtiny817 Xplained Mini Page in Atmel Studio
  3. 3.Start creating a new project by clicking New → Project... or by using the shortcut Ctrl+Shift+N, as shown in the figure below.
    Figure 2. Create New Project in Atmel Studio
  4. 4.Select the GCC C Executable Project template from the new project wizard shown in the figure below, type in the name of the solution and project (e.g. GETTING_STARTED and LED_TOGGLE), and click OK.
    Figure 3. New Project Wizard
  5. 5.Select ATtiny817 from the device selection wizard as shown in the figure below, and click OK.
    Figure 4. Device Selection Wizard
    A new project with a main.c file associated with it will be generated in Atmel Studio.
  6. 6.Replace the main loop in the main.c file with the following code snippet:
    int main (void)
    {
      /* Configure SW0 as input */
      PORTC.DIRCLR = PIN5_bm;
    
      /* Configure LED0 pin as output */
      PORTC.DIRSET = PIN0_bm;
    	
      while (1)
      {
        /* Check the status of SW0 */
        /* 0: Pressed */
        if (!(PORTC.IN & (PIN5_bm)))
        {
          /* LED0  on */
          PORTC.OUTSET = PIN0_bm;
        }
        /* 1: Released */
        else
        {
          /* LED0 off */
          PORTC.OUTCLR = PIN0_bm;
        }
      }
    }
    In the code editor, the code should appear as shown in the figure below.
    Figure 5. Code Editor Window
  7. 7.Open project properties by clicking Project → Properties or by using the shortcut ALT+F7.
  8. 8.In the Tool view (see the figure below) set Selected debugger/programmer to mEDBG and Interface to UPDI.
    Figure 6. Debugger and Interface for ATtiny817
  9. 9.Build the project by clicking Build → Build Solution or by using the shortcut F7.
  10. 10.Program ATtiny817 with the project code and start debugging by clicking Debug → Start debugging and break or by using the shortcut ALT+F5. The application is programmed onto the device and program execution should break in main.
  11. 11.Run the code by clicking Debug → Continue or by using the shortcut F5).
  12. 12.Verify that LED0 is lit when SW0 is pushed on the ATtiny817 Xplained Mini.