Electronic – Moving to ARM from 8 bit AVR – how to take the 1st step


I've written code for AVRs for several years now and it seems like my needs are calling for a more powerful processor. Since Atmel Studio is the IDE I'm already using and my debugger also works with ARM MCUs, going with an Atmel device seemed like a no-brainer. The troubles began when I tried to actually start and write some code. AVRs have an endless amount of tutorials on forums such as avrfreaks.net but the Atmel ARM MCUs do not. To make things worse, Atmel offers, almost exclusively, code that is written with its ASF software framework which means that if I want to use it I have to adopt a pretty high level approach which I don't like in coding, as I am not entirely aware of what goes on under the hood.

My question is: if someone went through a similar path, what was the correct place to start and learn how to use these M3 MCUs without the ASF!

Best Answer

No one forces you to use a peripheral library (ASF), you may very well code directly by toggling bits pretty much like on AVRs. The ASF probably includes a file which contains all the registers' definitions so that you can code manually if you want to.

I also found that the peripheral library (for STM32, though) was not easy to use when I started, but once you understand how it works, you no longer need to care about low level idiosyncrasies of your device, so that your code is more portable and faster to develop. I must admit that I prefer to code directly with registers, but there is a reason why ARM provide a kind of standard (CMSIS) for peripheral libraries and it is for ease of use: once you know an ARM, you know most of them, because the peripheral library wraps most differences behind a layer of abstraction. You are better off taking a not-so-steep learning curve with the peripheral library provided for your chip (there are tons of examples on the Internet using peripheral libraries) than using register configuration, because you will end up with very few examples on the Internet.

Start with a small project and then try using peripherals using the library. If you really want not to use it, then you probably will be on your own, but still, you can look in the ASF to see how they implemented stuff and reinvent the wheel if you want to. Your call.