1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Learning the ARM Cortex M3

Discussion in 'ARM' started by simonbramble, Mar 15, 2017.

  1. simonbramble

    simonbramble Active Member

    Joined:
    Nov 22, 2010
    Messages:
    430
    Likes:
    63
    I have 'a friend'. He is a die hard analogue expert who works for an analogue silicon chip manufacturer. This company has just been taken over by a company that has an ARM Cortex in its product range. He wants to learn the ARM Cortex M3.

    Is there a book anyone can recommend for him? Rather than Googling and coming up with recommendations, is there one that someone has actually read that he/she thinks is good? A project book showing how to flash LEDs, do UART comms, SPI interfaces etc would be a good place to start.

    I (sorry, he) would like a book rather than web articles as these tend to be more instructive

    Picture someone who has a solid understanding of PICs, Atmels and 8051 and C/assembly code, but is scared witless of anything more advanced.
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,164
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Not much more to learn..

    The M3 cortex is done to death on Atmel studio... If your friend knows a little C, then he will be able to any 32bit chip
    The only difference is the hardware... Most pins are 5v tolerant so all he has done will cross over...
     
  3. Cicero

    Cicero Active Member

    Joined:
    Nov 21, 2014
    Messages:
    335
    Likes:
    36
    Location:
    UK
    I hate to be this guy, but he doesn't need a book. He should just jump straight in and use them.

    He understands C, and the library drivers come with fully setup project examples on how to do everything, each peripheral separately. Seriously.

    I recommend using ST devices, they were one of the first to adopt Cortex, and its really easy and cheap to get going.

    Steps:
    1. Buy an ST Nucleo/Discovery dev board
    2. Download the Cube setup he needs, http://www.st.com/en/embedded-softw...-software.html?querycriteria=productId=LN1897
    3. If he doesn't want to pay for compilers etc, then he can download the http://www.openstm32.org/HomePage . The examples work with it as well.
     
    • Like Like x 1
    • Agree Agree x 1
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. simonbramble

    simonbramble Active Member

    Joined:
    Nov 22, 2010
    Messages:
    430
    Likes:
    63

    Thanks both for the comments. I was hoping to use the ADI ADuCM360.

    For example, with the PIC, you have timer registers and it is just a case of loading them and watching them increment. With the ARM core, it has a SYSTICK count down timer. If I wanted to generate, say, a PWM output that dims an LED, is the SYSTICK the register the most efficient way of doing this? Are there other ways of doing this and if so, what are the advantages? The ARM has a myriad of other resisters, some of which could be used to achieve the same results - maybe?

    Here is the point I am trying to make: If I look at the online ARM Hardware users guide, this will explain the SYSTICK register in great detail, but not necessarily if the SYSTICK is the best way of doing, say, PWM. I was thinking that a book will explain something from the *application* side (you need to dim an LED) as opposed to a Users Guide that explains things from the *register* side (this is what this register does, but not necessarily if it is the best register for the application I am try to design.)

    I'm downloading Atmel Studio to have a look at their code examples...

    If there are any online apps notes that explain basic ARM projects, with code, let me know.

    ... or... as per my OP, is there a book that explains it too?

    I'm all ears

    Thanks once again - Simon
     
  6. Cicero

    Cicero Active Member

    Joined:
    Nov 21, 2014
    Messages:
    335
    Likes:
    36
    Location:
    UK
    I'm not gonna suggest anything to do with ADI devices or Atmel (who were very late to the Cortex party).

    But I have very seldomly had to go down to the register level on a Cortex device. The libraries (CMSIS - https://www.arm.com/products/proces...crocontroller-software-interface-standard.php) are excellent, and provide everything you need, and don't often need modifying.

    Using the systick for a pwm output is not a great idea, the systick should be used like an OS kernel ticker, running at 1ms or 10ms for example, crude timing, service functions and scheduling of tasks.
    For PWM, rather use one of the many timers available with dedicated PWM outputs, just like any other microcontroller actually.
     
  7. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
    You don't care about looking at the Cortex M3 manuals. There's nothing in there that is useful for you unless you are doing seriously low level programming. The Cortex M3, M0, M4 chips are all made to be used with C language and they are optimized and don't even need assembly startup code. You want to pick a manufacturer and start with a chip that is hobby friendly as you will get the most support. That would be either NXP LPC chips, or ST STM32 chips. Those are pretty much the standard for hobby M3 chips right now and I would say STM has made it easier than LPC right now. LPC and STM32 both have cheap and easy starter boards with SWD programmers/debuggers built in. The user manual for the specific manufacturers chip is what you what to look at. It will describe the peripherals you will be using, and programming.

    Systick is not your main timer. Most chips/architectures have a Systick function that is used for some basic timing, but is mostly used for RTOS systems for tick timers for switching threads and doing maintenance. The Cortex core is the same in all the manufacturers, but the peripherals are all different. 8, 16, 32bit timers are peripherals, just like in PICs. Each manufacturers timers will be different. The LPC newer SCT timers are amazing. Love them now that I've figured them out. Complex, but super configurable.
     
  8. simonbramble

    simonbramble Active Member

    Joined:
    Nov 22, 2010
    Messages:
    430
    Likes:
    63
    Thanks for the comments. I opened the Cortex and the User manual and am slowly going through the code to see how it is constructed and what registers it refers to. I think this is useful for me in determining what registers there are in the device and how they are addressed. This also helps me brush up on my C skills which have been dormant for a few years. It is slowly starting to make sense. I know this is probably not the most efficient way of tackling the problem, but it is teaching me about the register set.

    What still bugs me after years of writing amateur code, is the fact that one file contains the typedef that refers to another file that tells you how the register is related to the memory location, and this refers to another file where the typedef is actually initialised and all this is used in a function in another file that is called by the final main() program in another file. I bet it is easier to write, but boy does it make it hard to follow. My mind is telling me there has to be an easier way, but I am sure many others have gone before me and worked out there isn't
     
  9. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,164
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    You are over thinking it!! Most micro providers and compiler providers have included all the libraries you need.

    You only need to select what pin you need to do what... Nowaday's its as easy as Arduino programming...
     
  10. simonbramble

    simonbramble Active Member

    Joined:
    Nov 22, 2010
    Messages:
    430
    Likes:
    63
    Hi Ian

    After a few days of playing with code, it is starting to make sense. It is just like Lego - bolting together pre-written routines with only a small amount of modification. It is quite straight forward seeing how the code relates to the hardware manual.

    I had to go through the process I outlined above just to get used to the register set, Keil tools and twist my brain into understanding C after many years of analogue.

    To be honest, the only problem I had was that ADI have modified the startup file from the standard template one. Their programs complied and mine didn't... until I found out the compiler error I was getting was related to a line of startup code that had been commented out in their code.

    For the sake of the search engines, here is the commented out code from startup_ADuCM360.s (for the ADuCM360/ADuCM361):

    ; IMPORT SystemInit
    IMPORT __main
    ;LDR R0, =SystemInit
    ;BLX R0

    and the error I was getting was

    Undefined symbol SystemInit (referred from startup_aducm360.o).

    If you comment out the above lines (as shown) SystemInit problem goes away
     
  11. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,164
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    This will be in the manual.... It will be a function that you will need to provide...A bit like the putch() and getch() if you want to use the stdio lib...
     
  12. Triode

    Triode Member

    Joined:
    Feb 11, 2009
    Messages:
    925
    Likes:
    22
    Location:
    Bay Area
    I was in the same place, experienced with 8 and 16 bit PIC and Atmel, but I hadn't used ARM 32. It wasn't too steep of a learning curve to just jump in. Besides practice, there are always the things you don't know you don't know, for those I like to go to Github and search for the top rated projects in the field I'm interested in, and then look at things they do. Often there's some stuff I've never seen and looking up what it is and what it's for gives me some great new knowledge.
     
  13. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
  14. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
    I'm not certain why you need so much detail on the core. Unless there's some reason you want to torture yourself with assem. programming them. Pick a chip to program, download the chips user manual and start with some pre-written examples like a blinky. Chip manufacturers all have some basic peripheral libraries that you can use as a basis. I've programmed for 5 different core architectures, gave up learning microcontrollers from the metal up after the second. Of course, I don't make a living at this either.
     
  15. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,702
    Likes:
    426
    Location:
    SCOTLAND
    The book I mentioned is a good one, its not just a list of registers etc. It gives alot of detail on what the cores can do. You could argue whats the point in a datasheet
     

Share This Page