Author Topic: Which microcontroller should I learn?  (Read 34177 times)

0 Members and 1 Guest are viewing this topic.

Offline LHelge

  • Contributor
  • Posts: 21
  • Country: se
    • My project blog
Re: Which microcontroller should I learn?
« Reply #100 on: February 18, 2016, 07:28:32 pm »
Here are my 5 cents...

Stay away from Arduinos! If you would like to learn embedded programming Arduinos is the completely wrong way to go. They are great if you would like to complete a project quickly without really caring for the software or for rapid prototyping when you're already an experienced embedded programmer, but you will not learn very much.

Apart from the obvious, learning C and some assembly, you should also start learning to use the peripheral hardware of a microcontroller. My suggestion is to start with one of the older/simpler models of the PIC/AVR 8-bit mainly because they have quite short and comprehensive datasheets. Your first weeks with this will be 95% reading datasheets and 5% coding, working with a 100 page datasheet is easier than a 1000 page one. When you are comfortable in setting up timers,  uarts and such as well as navigating datasheets you should move up to a 32-bit microcontroller.

My recommendation is one of the ARM Cortex-M based microcontrollers which seems to gain a lot of popularity nowadays, at least here in northern Europe. Even though 8-bitters still are very common the, usually larger, 32-bitters both allow and require more complex software and hence more developer efforts. My favorite is the ST Microelectronics STM32-series but thats probably because I've used them more than the Cortex-M's from other suppliers.
My Project Blog
http://www.lhelge.se
 

Offline meerweten

  • Contributor
  • Posts: 42
  • Country: be
    • Greendigit Electronics
Re: Which microcontroller should I learn?
« Reply #101 on: February 18, 2016, 08:03:39 pm »
Arduino's are nice for small project that needs to be finnished in e very limited time.

as many might have said before, don't just use a micro to let a led blink, thats totaly misusing a µC.

the choice of what to use ( atleast for me) depends on the requirements of the producs.
in some cases i use 16 bitters (like the pic24), but in a recent project i use a efusA9 and program in C#.
don't just learn one type of micro, start with one.

i started with pic's like the pic16f628A, just because it has a large comunity, many diferent ide's and ofcourse a cheap programmer.
if you are staying with developmentboards it might not be a problem as some (like the arduino) have a 'build in' programmer.

the http://www.keil.com/mcbstm32f400/ is a easy board (arm Cortex™-M4) and is much more powerfull than a pic16.
but a pic16 might do a better job then an arm processor. it all depends on the application you are going to make.

Meerweten, Want meten is Weten
 

Offline LHelge

  • Contributor
  • Posts: 21
  • Country: se
    • My project blog
Re: Which microcontroller should I learn?
« Reply #102 on: February 18, 2016, 09:18:00 pm »
I agree completely about the Arduinos, but if you're greater goal is to learn embedded programming it's definitely wrong.

PIC16F648A is an excellent processor to start with, I revisited that one a few weeks back when i needed something in a DIP-package. Simple enough that you spend more time programming than scrolling through hundreds of pages in a datasheet.

That keil board seems really nice, perhaps one of the cheaper STM32 Discovery or Nucleo boards could be used as an intermediate step.
My Project Blog
http://www.lhelge.se
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 18271
  • Country: nl
    • NCT Developments
Re: Which microcontroller should I learn?
« Reply #103 on: February 18, 2016, 09:43:30 pm »
Oh please no PICs  :palm: :palm: :palm:. Arduino is miles better than hacking assembly on an archaic PIC. If you are getting into embedded programming the experience from Arduino will be way more valuable because a lot of current day embedded programming is high-level.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 3843
  • Country: gb
Re: Which microcontroller should I learn?
« Reply #104 on: February 18, 2016, 10:25:29 pm »
Determination, self-discipline, and doing the work where there is no internet to distract you.

Pretty tough if you've chosen, or had foisted on you, one of those tools that requires you to be online just to use them!  :(
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 1827
  • Country: gb
Re: Which microcontroller should I learn?
« Reply #105 on: February 18, 2016, 10:46:26 pm »
IMHO this is a poor question (but there are some good answers!)

It was suggested that you learn programming... that sounds like a very sensible suggestion... Any platform with a C compiler will provide an environment for that.

... then...

which processor you choose will depend on what you are trying to achieve, the onboard peripherals of these devices varies hugely, (there was an example recently with the 3D printer video that said a Quadrature Encoder influenced the choice)... you might need lots of UARTs, RTC, LCD Drivers, lots of timers, who knows what...

So you are better off finding a project of some kind and then going through the thought process of which processor you would select to minimise the off-chip logic etc, think about cost and why that might be important, maybe you need more than one core? who knows what... but it can only be framed in the context of a problem.

Then once you have some context you can start looking at specific IDEs, language implementations and the libraries they come with.

The next step (perhaps related to the previous one) is to understand how the language C or whatever maps to the registers and together with the datasheet how to squeeze the correct behaviour out of the hardware. 

The good thing about Arduino is that it provides a nice capable 328P or whatever hardware platform but the terrible thing is the 'wiring' hides away the hardware so if you don't dig deeper you won't actually understand how it works... just look at the number of PWM/Comparator options on the 328P datasheet if you don't believe me.

But... You can start with an Arduino clone board at almost zero cost, prototype something and when you feel ready drop the 'Arduino' and program it as an AVR using a Dragon or something similar, just don't stop tinkering until you get to the silicon (you should understand what an interrupt is and why it could cause dither or screw things up if it took too long and all those lovely things).

... but that being said... I've just updated my PIC programmer because I need to control a raw LCD display.

 :)

« Last Edit: February 18, 2016, 10:53:04 pm by NivagSwerdna »
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 10438
  • Country: gb
    • Having fun doing more, with less
Re: Which microcontroller should I learn?
« Reply #106 on: February 18, 2016, 11:04:17 pm »
Determination, self-discipline, and doing the work where there is no internet to distract you.

Pretty tough if you've chosen, or had foisted on you, one of those tools that requires you to be online just to use them!  :(

Doesn't affect the first two, which are more important and are applicable to all aspect of life :)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Which microcontroller should I learn?
« Reply #107 on: February 18, 2016, 11:37:42 pm »
"Also, I'm in limbo because I decided to just learn to program the AVR 328p that came with the Arduino because it seems simple"

Embedded programming existed long people people invented those fancy 32 bit chips.

You can definitively learn to become a great embedded programmer on the avr, or that pic. No 16 bit or 32 bit chip needed.

Once you have mastered the avr and other chips of more complexity, you will find that the cores make minimum difference.

Your problem seems to be a lack of discipline, or a fear of learning.

Just commit yourself to a chip, any chip, and start with the boring stuff and you will come out the other end as a winner.
================================
https://dannyelectronics.wordpress.com/
 

Offline ea_man

  • Contributor
  • Posts: 23
  • Country: it
Re: Which microcontroller should I learn?
« Reply #108 on: February 19, 2016, 12:30:55 pm »
Anyone have any tips?  Please and thank you.
Get yourself in a course, a teacher will tell you what to do providing the best path to learn things. Ask for a detail course program, resources and examples used, better if there's a forum where the students can discuss.

Check if there's just a beginner level (may be noobs improvising) or if they have different levels and a solid path - vision, check if the lab has the right equipment (laptops and just standard arduino kit = not good. Many boards / uC / loads of components, custom kits for each class level = good) and if you can go there to practice.

As for the parent's question: Arduino (learn basics of programming, electronic, uC programming paradigms) -> learn C++ > learn to program AVR with ATmega328p on a breadboard (combinatory logic, "real" embedded programming) -> buy more Attinys -> step up to MSP432P40 or PSOC 
« Last Edit: February 19, 2016, 12:54:16 pm by ea_man »
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 3843
  • Country: gb
Re: Which microcontroller should I learn?
« Reply #109 on: February 19, 2016, 02:11:40 pm »
Anyone have any tips?  Please and thank you.
Get yourself in a course, a teacher will tell you what to do providing the best path to learn things. Ask for a detail course program, resources and examples used, better if there's a forum where the students can discuss.


Classic "Didn't read the question".

The original poster's second sentence was "I'm about to finish college (mechatronics engineering) and I've only worked with arduino".

This guy's just finished what sounds like a degree level course. I somehow don't think he's looking at the level of enrolling on a course at the local technical college/extension college/adult education classes. He's not asking "How do I start" but "Where's best to go next".

Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 3843
  • Country: gb
Re: Which microcontroller should I learn?
« Reply #110 on: February 19, 2016, 02:18:37 pm »
Determination, self-discipline, and doing the work where there is no internet to distract you.

Pretty tough if you've chosen, or had foisted on you, one of those tools that requires you to be online just to use them!  :(

Doesn't affect the first two, which are more important and are applicable to all aspect of life :)

Pah! Self-discipline is over-rated. It tends to get between you and all those cream cakes, bottles of beer and other procrastinatory diversions.  :P
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline captbill

  • Contributor
  • Posts: 37
  • Country: us
Re: Which microcontroller should I learn?
« Reply #111 on: February 19, 2016, 05:43:24 pm »
Arduino's are nice for small project that needs to be finnished in e very limited time.

as many might have said before, don't just use a micro to let a led blink, thats totaly misusing a µC.

the choice of what to use ( atleast for me) depends on the requirements of the producs.
in some cases i use 16 bitters (like the pic24), but in a recent project i use a efusA9 and program in C#.
don't just learn one type of micro, start with one.

i started with pic's like the pic16f628A, just because it has a large comunity, many diferent ide's and ofcourse a cheap programmer.
if you are staying with developmentboards it might not be a problem as some (like the arduino) have a 'build in' programmer.

the http://www.keil.com/mcbstm32f400/ is a easy board (arm Cortex™-M4) and is much more powerfull than a pic16.
but a pic16 might do a better job then an arm processor. it all depends on the application you are going to make.

You have pointed out a very important consideration when you say "a PIC16 might do a better job than an ARM". Very important because, more times than not, an ARM is overkill in the majority of real life scenarios. You just don't need so much processor to do "everyday things". The ARM enables you to do "programming" whereas a PIC(or like) demands you do full scale "engineering" , which I think is what OP (and all of us) is ultimately discussing here.

Ultimately, a well engineered approach is one where you have the right chip for the project, just like you want well fitting clothes. Also, this keeps you on your toes and demands you to become a better programmer whereas with ARM what you end up with the luxury to design without limitations, which invites poor practices, bad habits.

I am quite new to all this myself and don't mean to sound like an expert whatsoever. I am trying to piece together a system to address these same concerns and it's important to be prepared from the starting gate, which is where I am, essentially.



 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Which microcontroller should I learn?
« Reply #112 on: February 19, 2016, 06:07:49 pm »
Quote
more times than not, an ARM is overkill in the majority of real life scenarios.

Many times, a 4Mhz PIC or AVR is an overkill too.
================================
https://dannyelectronics.wordpress.com/
 

Offline Sal Ammoniac

  • Frequent Contributor
  • **
  • Posts: 940
  • Country: us
    • Embedded Tales Blog
Re: Which microcontroller should I learn?
« Reply #113 on: February 19, 2016, 06:33:21 pm »
You have pointed out a very important consideration when you say "a PIC16 might do a better job than an ARM". Very important because, more times than not, an ARM is overkill in the majority of real life scenarios. You just don't need so much processor to do "everyday things".

That is quite true for commercial work when you have to consider the BOM cost of the product. Using a PIC16 might be indicated if it costs less than an ARM and you're making millions of units.

If you're making a one-off or a limited run, say 100 pieces, of a product, then BOM cost isn't a big deal and you have to trade off cost of the part versus the engineering time required to implement the firmware. Sure, a PIC16 might save you $0.50 over an ARM Cortex-M0, but it's not worth it if your engineers spend many extra hours trying to shoe-horn the required functionality into the PIC.

It might be more fun and more "elegant" to try and make due with a lesser MCU, but this sometimes doesn't make engineering sense.

For Hobby projects, on the other hand, anything goes. The cost differential of even a high-end ARM Cortex-M part versus a PIC16 doesn't matter. Most of my hobby projects take a few hundred hours of work, so spending $12 for an ARM Cortex-M4 gets lost in the noise. Hell, I spend more than that on lunch every day.
 

Offline ea_man

  • Contributor
  • Posts: 23
  • Country: it
Re: Which microcontroller should I learn?
« Reply #114 on: February 19, 2016, 10:32:14 pm »
Classic "Didn't read the question".
Sorry if my quoting was misleading, I'll try again:

I have a similar problem as OP so I hope he doesn't mind if I jump in with my own thoughts.

I've always had an interest in technology/computers and over the last year it has grown immensely.  I've started to learn about the intricacies of the actual hardware and how it works.  I've been also been learning about electricity and electronics since the go hand in hand.  I've had an Arduino for a few years now but never really used it.  So I've decided that I would like to learn how to program microcontrollers for hobby reasons.  Maybe make an GPS/Alarm system for my car.  Or my own smart thermostat.  I want to bypass the Arduino environment because programming the bare metal gets me excited.  Plus it'll help me understand how CPUs work.  My issue is I can\t focus on one thing at a time.

I bought a great C programming book a few months ago but I haven't passed chapter 8 yet.  The reason being that when I get home I jump on the internet and I start looking at cool projects to make, different development boards, datasheets and etc.  In and of itself that's not bad, but I won't be able to do any of those things because I'm not learning C or how to actually program these chips.  Also, I'm in limbo because I decided to just learn to program the AVR 328p that came with the Arduino because it seems simple.  But then I'm like "maybe I should try a different board?".  Hmmm 16-bit?  ARM?  Maybe a TI board? Maybe, maybe, maybe.  I just want to be able to decide on a direction and actually stick to it and get the work done.

Anyone have any tips?  Please and thank you.
Get yourself in a course, a teacher will tell you what to do providing the best path to learn things. Ask for a detail course program, resources and examples used, better if there's a forum where the students can discuss.

Check if there's just a beginner level (may be noobs improvising) or if they have different levels and a solid path - vision, check if the lab has the right equipment (laptops and just standard arduino kit = not good. Many boards / uC / loads of components, custom kits for each class level = good) and if you can go there to practice.

As for the parent's question: Arduino (learn basics of programming, electronic, uC programming paradigms) -> learn C++ > learn to program AVR with ATmega328p on a breadboard (combinatory logic, "real" embedded programming) -> buy more Attinys -> step up to MSP432P40 or PSOC 
 

Offline leftek

  • Contributor
  • Posts: 28
  • Country: cy
Re: Which microcontroller should I learn?
« Reply #115 on: February 20, 2016, 11:09:01 am »
I have started with PIC microcontroller with MikroC compiler. Have many libraries and is easy way for start.
Any microcontroller you will choose is the right choice. There are not bad choice for microcontrollers.
After you will learn, the change of it will be very easy.  :)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Which microcontroller should I learn?
« Reply #116 on: February 20, 2016, 02:20:47 pm »
Quote
Any microcontroller you will choose is the right choice.

Absolutely agree. Rather than wasting time worrying about which mcu to learn, you should just pick one and start learning.
================================
https://dannyelectronics.wordpress.com/
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 18271
  • Country: nl
    • NCT Developments
Re: Which microcontroller should I learn?
« Reply #117 on: February 20, 2016, 02:56:05 pm »
There are not bad choice for microcontrollers.
After you will learn, the change of it will be very easy.  :)
The change won't be easy if you have choosen a microcontroller which is very limited (processing speed, memory, etc). One of the very nice things about NXP's ARM controllers is that NXP works very hard to keep the peripherals the same. The problem you often encounter when changing to a different microcontroller is that you need to rewrite a lot of code which deals with peripherals or the clock setup.
If walk into a dead-end road (for example starting with an 8 bit PIC) then you will need to change to something completely different at some point. It is better to walk into a road with a clear path towards higher end devices without needing to rewrite lots of code you have written before.

Edit: The point is: there is most definitely a bad choice!
« Last Edit: February 20, 2016, 06:14:49 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 10438
  • Country: gb
    • Having fun doing more, with less
Re: Which microcontroller should I learn?
« Reply #118 on: February 20, 2016, 06:17:52 pm »
Quote
Any microcontroller you will choose is the right choice.

Absolutely agree. Rather than wasting time worrying about which mcu to learn, you should just pick one and start learning.

Ever since the late 70s, for questions such as these the key determining factor has been the development environment.

Pick a development environment that is comfortable and offers the right facilities, then choose a MCU/board that works with that environment.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline cdonate

  • Contributor
  • Posts: 18
  • Country: br
Re: Which microcontroller should I learn?
« Reply #119 on: February 20, 2016, 09:16:30 pm »
Thanks to everybody who gave his 2 cents. I do appreciate every comment and it really changed my views. on the matter.

Quote
IMHO this is a poor question (but there are some good answers!)

Yes, I can see that now, it was the wrong question. But I think that's the point of coming here, now I have a much better ideia how to proceed.

I'm taking a step back and focusing on learning good C programming and the development of embedded systems. I'm starting with these two book: http://www.amazon.com/Making-Embedded-Systems-Patterns-Software/dp/1449302149 and http://www.amazon.com/Programming-Language-Brian-W-Kernighan/dp/0131103628.

The first one focus on the development of embedded systems, a very nice read. The second I don't think needs explanation.

After that I'll go to an 8-bitter, the Atmega328PB, the new version.  And since a common theme among the answers was that I needed to know multiple uCs, I'll try a ARM also. Maybe the Tiva C or a STM, since I have both here.

I already have a possible project for the 325PB that uses sensors, PWM, interrupts and ADC. I think it'll give an somewhat broad idea how to use various aspects of the IC. The ARM I still have no idea what to do.

What do you guys think? Is this a good enough path?

I'm working as a front-end designer for 3 years now (couldn't work as an engineer until finishing college), since the middle of my bachelors degree and I can't stand it anymore, I need to move on to another area, and working with embedded system is my goal.

Please, any tips are still welcome.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 10438
  • Country: gb
    • Having fun doing more, with less
Re: Which microcontroller should I learn?
« Reply #120 on: February 20, 2016, 09:38:40 pm »
Thanks to everybody who gave his 2 cents. I do appreciate every comment and it really changed my views. on the matter.

You will find that it is usually relatively easy to give the right answer to a question. But it is much more important - and much more difficult - to determine which is the right question. The right question is one where the answer causes you to go this way or that way.

Quote
What do you guys think? Is this a good enough path?

Whatever you choose and enjoy is a good enough path. (The best is the enemy of the good!)
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Which microcontroller should I learn?
« Reply #121 on: February 21, 2016, 02:07:12 am »
Quote
What do you guys think? Is this a good enough path?

Once you have a good programming habit, you will find that the mcu cores are for the most part transparent, and peripherals are highly alike in terms of functionality and vastly different in terms of implementation and complexity. Blinking a led for example is roughly the same on an AVR and on a Cortex-M4. Getting the pwm to work on the AVR and a Cortex-M4 involve roughly the same thought process but the actual code will differ significantly.

All this 8-bit vs. 32-bit thing is mostly marketing. The differentiation and steep learning curve is in the peripherals.

As to programming books, well, K&R is very good in my view and personally I like to read up on large companies' programming guide books. Running Lint or MISRA on your code can be quite educational as well.

Also, you will find that it is much easier to learn if you actually code to a chip. In this case, you are fortunate in that you have all the tools to practice your learning on.

The AVRs are a good chip for that purpose as they are simple to set up and easy to get going - minimizing distractions and frustrations a beginner may have with a more complex chip like those ARM chips.
================================
https://dannyelectronics.wordpress.com/
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 18271
  • Country: nl
    • NCT Developments
Re: Which microcontroller should I learn?
« Reply #122 on: February 21, 2016, 02:18:34 am »
You keep insisting ARM microcontrollers are complicated but it highly depends on which you choose. I can name a few 8 bit controllers with very obfustigated peripherals and ARM controllers with very simple peripherals. For example: NXP's ARM controllers use the 16450/16550 UART which has been the standard on PCs for decades so there is a huge amount of sourcecode and knowledge for that particular UART.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline legacy

  • Super Contributor
  • ***
  • Banned!
  • Posts: 4426
  • Country: ch
Re: Which microcontroller should I learn?
« Reply #123 on: February 21, 2016, 03:33:38 pm »
PowerPC and MIPS add more complexity by sever orders of magnitude  :D

ARM ones are the most friendly and comfortable side of the RISC family
while, in my opinion, the bloody-dead MC88K was the most elegant
 

Offline legacy

  • Super Contributor
  • ***
  • Banned!
  • Posts: 4426
  • Country: ch
Re: Which microcontroller should I learn?
« Reply #124 on: February 21, 2016, 03:35:19 pm »
take an embedded ARM module by Olimex, be sure it's supported by Keil
and have fun

that's all folks
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf