Becoming an ARM user (from AVR)

Go To Last Post
26 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

I am coming back from some (years) time not doing much programming. I am an experienced AVR programmer and some people her might possible remember me. What happens now is that I will be doing some real development again and that I will switch to ARM. But time has not been kind, much have happened and I realise it was hard to catch up. I have been going through an ARM course (youtube) and fiddled just a little with an SAMD20 Xplained Pro kit.

 

My basic problem is this:

I want to have help setting up a new project and was hoping to get that from some of the examples. But I can't find information about the various include files. It is a sort of "there to start" problem. When I start working with a new microcontroller, like I did with XMEGA, I like to grab a demo project and when browse through all of the initialization and include files until I understand them. But in this case, I have problem making sense of it. First there are so many more files involved and secondary it changes very much from example to example. I haven't really been able to find the right document to get the hold on the CMCIS either. I think I will prefer to use CMSIS for at least initilization and I have read a little of the user guide for M0 at arm.com and some other documents from Atmel. I have more to read there but so far I have not find a good and comprehensive place that give me a list of what files to use when I want to use a specific peripheral.

 

Say that I want to set up the interrupt controller and a timer. I am looking for for the CMSIS setup files and drivers for those functionality in SAM D20. Should it be so hard to find?What am I missing here? I have decided to go for Atmels ARM series, Atmel Studio, GCC and SAMD20 to begin with.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cmsis is for the ARM stuff - like the systick and the nvic. The rest is Atmel. See if you can work your way through the forest that is ASF. I normally start with the printf example. From there you can decide if you want to use ASF or go it alone with just the datasheet and work the registers directly. If in doubt, use ASF and step through the code to see how it does it, then write your own.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you mean that it is more matter of using ASF than CMSIS? I haven't looked much at ASF because I never used it for AVR/Xmega but for ARM i think it is better to start with ASF/CMSIS. At least to begin with. Maybe if I stick to the same cpu I might switch over to working the register directly but I will probably switch between at least one M0+ and one M3.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Cmsis is for the ARM stuff - like the systick and the nvic. The rest is Atmel.

Logo

ARM

System View Description

http://www.keil.com/pack/doc/cmsis/svd/html/index.html

Introduction

The CMSIS System View Description format(CMSIS-SVD) formalizes the description of the system contained in ARM Cortex-M processor-based microcontrollers, in particular, the memory mapped registers of peripherals.

...

CMSIS-SVD files are developed and maintained by silicon vendors.

...

Atmel's more complex ARM Cortex-M are in ASF; as an alternative, there's a software package for those :

http://www.atmel.com/tools/samv71-samv70-same70-sams70-software-package.aspx

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see, so the D20 is not. That explains a lot of my confusion. The documentation at Keil was a good start. But what is the difference between Arm and Keil?

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bengtr wrote:
So you mean that it is more matter of using ASF than CMSIS?

Pretty much, yes.

 

ASF is (largely) "above" CMSIS - ASF uses CMSIS so you don't have to.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bengtr wrote:
But what is the difference between Arm and Keil?
ARM acquired Keil.

Usually : ARM DS-5 for MPU, Keil MDK for MCU


https://developer.arm.com/products/software-development-tools/ds-5-development-studio/editions

http://www2.keil.com/mdk5/selector

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Sat. Sep 17, 2016 - 09:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bengtr wrote:
But what is the difference between Arm and Keil?

Keil just* makes software development tools - particularly compiler toolchains.

 

ARM designs processor cores.

 

But, as already noted, ARM now owns Keil.

 

 

* Well, they do actually make a few other things as well - but principally they are a software tools house.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I understand it, CMSIS defines some standard "core" stuff, AND specifies/suggests something like "peripherals will be defined as pointers to C structures, with certain naming conventions."

 

I found this webinar pretty useful, especially since it discusses some of the things that CMSIS *tried* to do that have since been dropped from the specification.  https://attendee.gotowebinar.com...

 

Atmel seems to think CMSIS definitions are part of ASF.  You might find my "experiments" with the SAMD10 to have some useful data in the README file

https://github.com/WestfW/SAMD10...

In particular, I mention that/

.../component/peripheraltype.h contains C-structure definitions of the layout of Peripheral registers.   Things like "typedef struct {int32_t DATA, STATUS, CONFIG;} USART_T;

.../instance/particularperipheral contains preprocessor symbols for all the registers of that particular peripheral, like:  #define REG_USART0_DATA (*(RwReg *)0x42000800U)

.../../chipname.h includes both of those, and creates #defines for each peripheral type, like #define USART1 ((USART_T *)0x42000800U)

    it also defines "arrays" of similar peripherals on the chip #define USART_INSTS { USART0, USART1, USART2 }

 

This means that there are several ways to access the data register of USART1:

  c = REG_USART1_DATA

  c = USART1->DATA

  c = USART_INSTS[1]->DATA

 

It's not bad once you get used to it.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I have been using atmel studio 4 & all of a sudden I had to use atmel studio 7 with cortex m7 processor.

I do appreciate the ASF by atmel.

But it is really difficult to do any programs without proper support or tutorials.

If anybody has got some spare time, then please do help me with atmel SAM E70 processor.

 

Am struggling with interrupts, timers, USB.

Please do lend a helping hand.

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's plenty of reading on the internet to get you up to speed.
You really need to put a lot of time into all of this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Harikrishnan911 wrote:
... I had to use atmel studio 7 with cortex m7 processor.

I do appreciate the ASF by atmel.

And the ARM Cortex-M7 SAM software package.

How an RTOS implements similar can be enlightening and will ease one into application software development.


http://www.atmel.com/tools/samv71-samv70-same70-sams70-software-package.aspx

http://www.nuttx.org/Documentation/NuttX.html#armcortexm7

https://www.micrium.com/downloadcenter/download-results/?searchterm=mi-samv71&supported=true

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
This means that there are several ways to access the data register of USART1:   c = REG_USART1_DATA   c = USART1->DATA   c = USART_INSTS[1]->DATA

 

And they say ARM is "easy to use"....

 

Very well, just this simple conversation actually helped me a lot. The first thing I will try is setting up two timer interrupts with different priority and see if I can make it work. It's the start-up code that is complicated but now I know that that there is no ASF for SAMD20 so it is to dig into CMSIS only. Digging directly into the registers is not so interesting because the learning is about CMSIS.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bengtr wrote:
... there is no ASF for SAMD20 ...
http://asf.atmel.com/docs/latest/search.html?device=samd20

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

This means that there are several ways to access the data register of USART1:   c = REG_USART1_DATA   c = USART1->DATA   c = USART_INSTS[1]->DATA

 

bengtr wrote:
And they say ARM is "easy to use"....

Note that the above has absolutely nothing whatsoever to do with ARM: it's just about the peripherals - which are entirely proprietary to Atmel. You could apply exactly the same approaches on any microcontroller with memory-mapped peripherals.

 

It's the start-up code that is complicated

Not particularly.

 

One of the features that is specific to Cortex-M is that you can - and Atmel does - write the startup code entirely in 'C'.

 

there is no ASF for SAMD20

Where on earth did you get that idea? There most certainly is!!

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

there is no ASF for SAMD20

Where on earth did you get that idea? There most certainly is!!

I was looking here:

http://www.atmel.com/tools/avrso...

 

No D20.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I open the LED blink example project for D20 I notice that there is a folder named ASF included in the project tree! (And a CMSIS folder as well)

 

By the way, in the LED blink example, this is the code that is ran as initialization in SystemInit:

void system_init(void)
{
    /* Configure GCLK and clock sources according to conf_clocks.h */
    system_clock_init();

    /* Initialize board hardware */
    system_board_init();

    /* Initialize EVSYS hardware */
    _system_events_init();

    /* Initialize External hardware */
    _system_extint_init();
    
    /* Initialize DIVAS hardware */
    _system_divas_init();
}

 

I would like to understand what is done so I can modify whatever is needed for my project.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The link to http://asf.atmel.com was a great help.

 

About the peripherals I understand that it is not really an ARM thing. ARM specify some of how the interface should be coded but if course the peripherals are Atmels stuff.

 

Anyway, I think I will be able to get forward now. Thanks.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But understanding the function in ASF does take time especially for beginners like me.sad

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes it does but my problem was mostly to find the right place to start reading.

 

If your a completely beginner on microcontrollers I find it hard to recommend to start with ARM although not impossible.

My favorites:
1. My oscilloscope, Yokogawa DLM2024.
2. My soldering iron, Weller WD2M, WMRP+WMRT.
3. JTAGICE3 debugger.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The issue is not with ARM, but with the vendor and tools you chose. Nevertheless, if you are an experienced AVR person, you know how to read the datasheet/documentation. These parts are no different. There's a couple more hoops you need to jump as compared with the AVR in that you need to enable power and clock to the peripherals. Using the likes of ASF just hides the evil from you, but that too has a level of learning. There's always arduino if you want to skip that and just get the job done.

Last Edited: Sun. Sep 25, 2016 - 12:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anybody suggest a couple of good tutorials on programming using ASF.

 

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

am not a beginner in ARM mcus.

I have got some experience in ARM 7 TDMI mcus' (NXP LPC2138/29/48)

 

ASF & ARM cortex M7 is really new to me.

I really do need some help on to this to get my project done on time.

But I don't know where to start.

 

Last day, I spent almost 8 hrs to make the timer module to work using sam e70.

i was able to generate interrupt but I couldn't control the time between interrupts.

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you looked at http://start.atmel.com? That's sort of "the new ASF".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I actually took an Atmel training class on using ASF that wasn't too awful.  I don't know whether it has an online version or not, but a lot of the "meat" was "Use the Getting-started examples at http://asf.atmel.com/docs/latest... for whatever peripheral you were wanting to use, and modify as appropriate.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
"Use the Getting-started examples at http://asf.atmel.com/docs/latest... for whatever peripheral you were wanting to use, and modify as appropriate.)

Absolutely!!

 

But note that you can't just take the code from the documentation - you must use the ASF Wizard in Atmel Studio to create the example project for you.

 

And by far the easiest way to do this is to get the XPlained-Pro board for the MCU you're interested in: when you plug it in, Atmel Studio will recognise it - and will automatically show you the examples specifically written for that board.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...