5.1 Microchip Studio with AVR64EA48 Curiosity Nano
Prerequisites
- Microchip Studio 7.0.2594 or later installed
- The AVR64EA48 Curiosity Nano Board is connected to Atmel Studio 7.0 via the on-board USB connector, which is connected to the embedded debugger. The kit will be powered by the USB, and the embedded debugger will enable debugging and programming via the USB.
Workflow
- Launch Microchip Studio 7.0.
- The page shown below will appear when AVR64EA48 Curiosity Nano is connected to Atmel Studio 7.0.
- Start creating a new project by clicking New → Project... or by using the Ctrl+Shift+N shortcut, as shown in Figure 5-2.
- Select the GCC C Executable Project template, as shown in Figure 5-3, type in the name of the solution and project (e.g., GETTING_STARTED and LED_TOGGLE), and click OK.
- Select AVR64EA48 as shown in Figure 5-4, and click OK.A new project with a
main.c
file associated will be generated in Microchip Studio. - Replace the
main.c
file with the following code snippet:int main (void) { /* Configure SW0 as input */ PORTB.DIRCLR = PIN2_bm; /* Configure LED0 pin as output */ PORTB.DIRSET = PIN3_bm; /* Enable the internal pull-up for SW0 */ PORTB.PIN2CTRL |= PORT_PULLUPEN_bm; while (1) { /* Check the status of SW0 */ /* 0: Pressed */ if (!(PORTB.IN & (PIN2_bm))) { /* LED0 on */ PORTB.OUTCLR = PIN3_bm; } /* 1: Released */ else { /* LED0 off */ PORTB.OUTSET = PIN3_bm; } } }
- Open project properties by clicking Project → Properties or by using the ALT+F7 shortcut.
- In the Tool view (see Figure 5-6), set Selected debugger/programmer to nEDBG and Interface to UPDI.
- Build the project by clicking Build → Build Solution or by using the F7 shortcut.
-
Program AVR64EA48 with the project code and start
debugging by clicking Debug → Start debugging and break or by using the ALT+F5 shortcut.
The application is programmed onto the device, and program execution will break in the
main()
function. - Run the code by clicking Debug → Continue or by using the F5 shortcut.
- Verify that LED0 is lit when SW0 is pushed on the AVR64EA48 Curiosity Nano.