An Introduction to Atmel Arm Cortex M4: ATSAM4S

This introduction to the ATSAM4S series of Microchip arm microcontrollers will help you get started programming without using ASF. Although the ASF is good, especially when you're porting code from one chip to another, I wanted to directly setup peripherals by setting registers directly rather than having the hardware abstracted away. These tutorials assume that you already have some C experience and have programmed other microcontrollers such as the AVR or XMEGA.

Keep in mind that these examples are the bare minimum required to get started. You should really go through the datasheet to check for other options, power saving techniques and chapters that aren't covered under this basic tutorial. This is still a work in progress and there should be new content weekly. If you have any requests for things you would like to see then feel free to send me an email at rmcmillin@mwmw.ca.

This tutorial doesn't use the Atmel Software Framework. That's not to say it's bad, because it's not. ASF is good when you need to change MCUs in your design without changing the code. You can easily port from chip to another. In the past, I changed from Arduino to bare AVR and Xmega because I felt that Arduino abstracted too much away from the hardware. I get a similar feeling from ASF. When I started with ARM I wanted to toggle pins and set registers rather than use ASF, but when I searched the internet for resources I could only find links to other people looking for similar resources. For that reason, I wrote this tutorial and I hope it helps someone else out. Even though the Atsam4s pdf is ~1200 pages, reading through it is the best way to learn how to use it. It's intimidating, but as you go from chapter to chapter you will see that there are a lot of similarities in the way peripherals are setup and used.

Good Luck!

The basic code examples will help you get started programming the ATSAM4S using:

  • Atmel-Ice programmer/debugger using the JTAG interface
  • Atmel Studio 7
  • C, writing basic drivers from scratch and not using ASF
  • A Dev Board based on ATSAM4S16B