Yarm technical documentation Buy

Getting Started Microchip Studio for AVR and SAM Devices

This guide illustrates how to get started with the Yarm development boqrd and Microchip Studio for AVR® and SAM Devices

Step 1: Install Microchip Studio

Microchip Studio for AVR® and SAM Devices (ex Atmel Studio 7) is an Integrated Development Environment (IDE) used to program the Microchip CPU mounted on the Yarm radio module.

To execute it it's requested a modern Windows PC

Microchip Studio for AVR® and SAM Devices includes the Atmel Software Framework (ASF), a large library of free source code with about 1,600 project examples.

Download Microchip Studio for AVR® and SAM Devices

Step 2: Create you first project

Launch Microchip Studio 7 then select File -> New -> Project.

Click on GCC C ASF Board Project and type a name for your new project then press OK.

After a while a form titled "Board Selection" will appear.

Select SAML21 from the Device Family drop down menu and ATSAML21E18B from the related device list then press OK.

The new project is created with a minimal set of files.

Click on src folder and then double click on main.c to open the source template generated by Atmel Studio.

Step 3: Add the ASF libraries required by your project

Step 4: Write your code

Change the default main.c generated by Atmel with this blinking led code example:

#include <asf.h>

// Line PA16 (Pin 24 on YARM-DEV board)
#define MY_LED    IOPORT_CREATE_PIN(IOPORT_PORTA, 16)

int main (void)
{
	system_init();
	ioport_init();
	ioport_set_pin_dir(MY_LED, IOPORT_DIR_OUTPUT);

	for (;;) {
		ioport_set_pin_level(MY_LED, 1);
		delay_s(1);
		ioport_set_pin_level(MY_LED, 0);
		delay_s(1);
	}
}

Wire a led to the YARM-DEV board as shown below:

Step 5: Launch the compilation

Now launch the C compiler by selecting: Build -> Compile.

The output windows will show:

Build started.
Project "YarmFirstProject.cproj" (Compile target(s)):
Target "Compile" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "c:\users\tanzilli\Documents\Atmel Studio\7.0\YarmFirstProject\YarmFirstProject\YarmFirstProject.cproj" (entry point):
    Task "RunCompilerTask"
        Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
        C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe "src/main.o" 
        make: 'src/main.o' is up to date.
    Done executing task "RunCompilerTask".
Done building target "Compile" in project "YarmFirstProject.cproj".
Done building project "YarmFirstProject.cproj".

Build succeeded.

Step 6: Set up the Atmel ICE in-circuit programer/debbugger

  • Plug the ATME-ICE-BASIC programmer on an USB port of your Windows PC and wait until the Atmel driver has been installed correctly.
  • Select the Atmel Studio menu Tools -> Device Programming
  • Select the tool Atmel-ICE... and the device ATSAML21E18B then press Apply

  • Connect the YARM-2-ICE adapter and the YARM-DEV board as shown below:

  • Move the switch on the YARM-2-ICE adapter on SAM position

  • Press the Read button then, if everything goes well, the Device signature will appear. In not be surethat the YARM-DEV boar is plugged to the USB port and to the YARM-2-ICE adapter.


  • Press the Close button and select the menu Debug --> Start Without Debugging to launch the program execution.

Links

To know more about the ATA8510 programming read this article:

More info about Yarm are available on:

Buy

Sergio Tanzilli
Systems designer, webmaster of www.acmesystems.it and founder of Acme Systems srl

Personal email: tanzilli@acmesystems.it
Web pages: https://www.acmesystems.it --- https://www.acmestudio.it
Github repositories: https://github.com/tanzilli --- https://github.com/acmesystems
Telegram group dedicated to the Acme Systems boards: https://t.me/acmesystemssrl

Home page Yarm technical documentation Buy