EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: Lovely_Santa on April 02, 2016, 04:31:00 pm

Title: Compare different microcontrollers
Post by: Lovely_Santa on April 02, 2016, 04:31:00 pm
Hey EEVbloggers!

I'm an engineering student, and I had a discussion with one of my professors about different microcontrollers...
So last year, I had to make a working DC-engine, starting with only 2 magnets and an inductor, and everything needed to be powered from a microcontroller.
For that job, an easy Arduino Uno did the work, everything worked fine, 1000 rpm at only 5V with constant current of 75mA, could lift 3 kg (=6.6 lbs) without a problem.

This year, I need to make a power supply, an audio amplifier (class AB) and a constant current load all in 1 single machine, driven by a single microcontroller.
The professor said we needed to use the cy8ckit-049-42xx, with the reason that it's a quite nice microcontroller and easy to program...

The next week, I had a question, when I asked it at the professor, at one point I said: "For testing my code, I used a simple Arduino to try it out", and the professor answered that Arduino is trash!

So now... If you have something to make with a microcontroller (in general), which controller would you choose? The biggest, most powerfull one? Or would you look at only what you need?


Just some quick numbers:  :blah:

Arduino Unocy8ckit-049-4200
ATmega328P core:
  • 8 bit
  • 32kb programmable flash
  • 2kb SRAM
  • 1kb EEPROM
  • 16MHz clock
   
ARM Cortex-M0 core:
  • 8 bit
  • 32kb programmable flash
  • 4kb SRAM
  • 1kb EEPROM
  • 48MHz clock
   
22 connections:
  • 14 digital I/O
    • 6 I/O support PWM
  • 6 analog I/O
    • 10 bit A/D converter
  • USB connection
  • ICSP header
   
36 connections:
  • 36 GP-I/O
    • 12 bit A/D converter
    • Segment LCD Drive
    • Serial Communication
    • PWM supported
   
Other things:
  • Price: €20.00 + VAT
  • Link to site (https://www.arduino.cc/en/Main/ArduinoBoardUno)
   
Other things:
  • Price: €4.00 + VAT
  • Link to site (http://www.cypress.com/products/32-bit-arm-cortex-m0-psoc-4200-programmable-digital)
   
Title: Re: Compare different microcontrollers
Post by: nomadd on April 02, 2016, 05:33:32 pm
The next week, I had a question, when I asked it at the professor, at one point I said: "For testing my code, I used a simple Arduino to try it out", and the professor answered that Arduino is trash!

So now... If you have something to make with a microcontroller (in general), which controller would you choose? The biggest, most powerfull one? Or would you look at only what you need?

KISS. Never use more than you need.

I tend to stick with C and PIC stuff for most of what I do. It works fine, loads of supporting chips, and a ton of datasheets, App. Notes and books to turn to when things go wrong. Will look into ARM at some point, but only when my projects need it.

Seems your Prof. is like the one I met at University all those yous ago: hated all students who came in with any hardware or software experience - and worse still, opinion! :)

He does know the "microcontroller" != "Arduino" doesn't he? :)



Title: Re: Compare different microcontrollers
Post by: Lovely_Santa on April 02, 2016, 05:51:14 pm
Thanks for your reply nomadd :)

Maybe I should have told you he turned 62 last week...  ;)
But.. a prof is always the prof and need give me a nice score, so I do what he tell me to do.. (that works well for me...)

I tend to stick with C and PIC stuff for most of what I do. It works fine, loads of supporting chips, and a ton of datasheets, App. Notes and books to turn to when things go wrong. Will look into ARM at some point, but only when my projects need it.

Just a quick note on that: the cy8ckit-049-4200 may be ARM, have a PSoC for programming, but you still can program it as efficient in C as a normal PIC..., but it has some features that are usefull for other students who have more problems with programming...
Title: Re: Compare different microcontrollers
Post by: andyturk on April 02, 2016, 05:55:53 pm
If one of the design requirements is to use a Cypress part, then don't fight it--just use the chip. It'll be much the same after you graduate and a customer chooses some parts you don't like. Flexibility is a good thing to learn, and it won't kill you.

Saying the Arduino is "trash" is a bit strong, but it's not really taken seriously (for good reason, IMO) by embedded engineers. OTOH, the Cortex-M architecture is common in commercial projects and a good one to be familiar with. It's not quite as easy to program as an Arduino, but the Cypress environment is very well done.

Note the Cortex-M is a 32-bit architecture (not 8-bit, as you listed).
Title: Re: Compare different microcontrollers
Post by: zapta on April 02, 2016, 05:58:19 pm


But.. a prof is always the prof and need give me a nice score, so I do what he tell me to do.. (that works well for me...)

You got it right. Some professors get upset if their subjective opinions are challenged.


Sent from my Nexus 5X using Tapatalk

Title: Re: Compare different microcontrollers
Post by: nctnico on April 02, 2016, 06:00:34 pm
but you still can program it as efficient in C as a normal PIC..., but it has some features that are usefull for other students who have more problems with programming...
First of all you can't program a PIC (or any 8 bit controller) efficient in C. The underlying architectur (cough) doesn't allow it. From 16 bits and onwards things get a lot better. You are also very likely to run into performance issues with the older and slower 8 bit microcontrollers. One of my regrets is that I stuck with the 8051 for far too long and in the end it was just holding me back. I think your professor is right in pushing you towards a modern ARM chip. First of all you won't run into performance limits quickly and secondly your future employer will want to see experience with ARM on your resume.
That still doesn't take away that the Arduino platform + ecosystem is nice for rapid prototyping so if you combine both in your project (Arduino for a quick proof of concept and ARM for the final product) you could get a good grade. Just never ever propose a generic Arduino board + shields as a final solution for something that needs to work reliable for many years.
Title: Re: Compare different microcontrollers
Post by: Ian.M on April 02, 2016, 06:12:34 pm
The Arduino toolchain is close to being trash.  However the hardware is a reasonable ATmega328P development board.   If you are programming it using the Arduino C++ libraries, the professor's scorn is entirely explicable.  If you are programming in C from the device datasheet, hitting the bare metal of the ATmega register set, and keeping the data structures as simple as possible, that is just like using any other 8 bit MCU with similar capabilities.

You also have to consider the available MIPS and the complexity of the task.  If the chosen MCU merely provides supervisory functions for the project, then just about anything powerful enough to handle your choice of U.I. will do the job.  OTOH, if the task, or your understanding of it is ill-defined, starting out with a more powerful MCU than you initially expect to need can save you a vast amount of work compared to having to port your codebase to a different device if you run out of space or use all the processing time 80% of the way through the project, and can be the difference between success and failure.   

Donald Knuth's aphorism "premature optimization is the root of all evil" doesn't just apply to software.
Title: Re: Compare different microcontrollers
Post by: dannyf on April 02, 2016, 06:36:47 pm
Quote
The professor said we needed to use the cy8ckit-049-42xx, with the reason that it's a quite nice microcontroller and easy to program...

Your professor is the one who grades your work. So I would go with his suggestion. As to whether the Cypress is easier to program, it is quite subjective.

Quote
the professor answered that Arduino is trash!

There are some truth to that.

Quote
So now... If you have something to make with a microcontroller (in general), which controller would you choose? The biggest, most powerfull one? Or would you look at only what you need?

I usually pick the one that gets the job done. That, in this case, means going with your professor.

The cypress is considerably more powerful than the AVR, especially given its CPLD-like features that will come handy in a mostly analog-driven design project like your power supply.

So I think the professor is more right than wrong here.

Arduino is nice as a quick prototyping tool for your code. But it is designed mostly for non-engineering types, by non-engineering types.
Title: Re: Compare different microcontrollers
Post by: mikerj on April 02, 2016, 08:09:15 pm
First of all you can't program a PIC (or any 8 bit controller) efficient in C.

We aren't stuck in the 1980's you know, compilers have moved on quite a bit.
Title: Re: Compare different microcontrollers
Post by: Lovely_Santa on April 02, 2016, 08:17:18 pm
If one of the design requirements is to use a Cypress part, then don't fight it--just use the chip. It'll be much the same after you graduate and a customer chooses some parts you don't like. Flexibility is a good thing to learn, and it won't kill you.

Saying the Arduino is "trash" is a bit strong, but it's not really taken seriously (for good reason, IMO) by embedded engineers. OTOH, the Cortex-M architecture is common in commercial projects and a good one to be familiar with. It's not quite as easy to program as an Arduino, but the Cypress environment is very well done.

Note the Cortex-M is a 32-bit architecture (not 8-bit, as you listed).

I totaly agree! As an engineer you need to be flexible and be able to work with things you don't like or don't know yet... It's just the way he talked about arduino. Becose the other professor said arduino is a good controller to start, easy to program, becose we had a full-time course programming in C and Cpp, so we are familiar with the language... But the other professor told then arduino is trash becose it can't do what the cy8ckit can do...

And yes, it's a 32-bit architecture (forgot to change when I copied it from the arduino  :-[ )

First of all you can't program a PIC (or any 8 bit controller) efficient in C. The underlying architectur (cough) doesn't allow it. From 16 bits and onwards things get a lot better. You are also very likely to run into performance issues with the older and slower 8 bit microcontrollers. One of my regrets is that I stuck with the 8051 for far too long and in the end it was just holding me back. I think your professor is right in pushing you towards a modern ARM chip. First of all you won't run into performance limits quickly and secondly your future employer will want to see experience with ARM on your resume.
That still doesn't take away that the Arduino platform + ecosystem is nice for rapid prototyping so if you combine both in your project (Arduino for a quick proof of concept and ARM for the final product) you could get a good grade. Just never ever propose a generic Arduino board + shields as a final solution for something that needs to work reliable for many years.

I know that we can't program it efficient.. but by efficient I mean thinking about the way we program it, so the code is compact and can be run as fast as it should, without doiing things that are worthless... (in the way that's possible in C) So we think a bit about the performance of the controller itself...  And we have a class that is a theoretical introduction to the 8051... like all the basic stuff... but it's a nice start, to get everyone at the same experience as the others... But it's limiting, so for other classes we don't use the 8051 just becose it hold us back...

So yes the professor is right.. but on the other side.. It's way over-kill for what we are programming... so shouldn't we be programming some 'lower level' stuff to start with? Becose we got so much options that we always go for the easy solution... but when we will have later at work something else with a problem without an easy solution... You get what I mean?


@dannyf, I always do what the professor tells me to do, he has his reasons for that... maybe I don't get it (yet)...
Title: Re: Compare different microcontrollers
Post by: Lovely_Santa on April 02, 2016, 08:23:43 pm
The Arduino toolchain is close to being trash.  However the hardware is a reasonable ATmega328P development board.   If you are programming it using the Arduino C++ libraries, the professor's scorn is entirely explicable.  If you are programming in C from the device datasheet, hitting the bare metal of the ATmega register set, and keeping the data structures as simple as possible, that is just like using any other 8 bit MCU with similar capabilities.

You also have to consider the available MIPS and the complexity of the task.  If the chosen MCU merely provides supervisory functions for the project, then just about anything powerful enough to handle your choice of U.I. will do the job.  OTOH, if the task, or your understanding of it is ill-defined, starting out with a more powerful MCU than you initially expect to need can save you a vast amount of work compared to having to port your codebase to a different device if you run out of space or use all the processing time 80% of the way through the project, and can be the difference between success and failure.   

Donald Knuth's aphorism "premature optimization is the root of all evil" doesn't just apply to software.

We never use libraries! All the code we use is our own code, not that the code of others isn't good, in some cases maybe beter than ours, but we need to learn, so we write all our own codes, the only code we may use is the code the professor gives us (and that's like most likely something about a page of a whole book..) So yes, we use the datasheets of the device and hitting all the squares of the bare metal of the register set. We chose for arduino becose it was a nice thing between hobby and school... And that's why I asked this.. I'm only in my 2nd year of my university carreer... 1st year was basic stuff.. So the tasks we need to program aren't that complex...
Title: Re: Compare different microcontrollers
Post by: hans on April 02, 2016, 08:57:53 pm
What nctnico is trying to say is the 8-bit PIC architecture is not tailored for C compilers. Yes the XC8 compiler is much better than it used to be (which caused many trauma's back then), but still is not up to C99 spec.

Back to OP's question:

In my experience some university teachers are very unwilling to bend their teaching program around to cover a wider area. That is because they invest quite a lot of time and effort to make material and work into 1 eco system for their material.

It does not mean their choice is the best. It's just 1 that was made so they avoid helping 8 students group each with their own microcontroller + hardware + eco-system. If you have to assist each student group 30 minutes to debug a flaky serial UART, then you would have a very long day indeed.
 
However this behaviour can sometimes overshoot in that teachers will stick they knew 20 years ago, and keep teaching 20 year old crap with no hint of modern techniques or technology. E.g. I had a intern last year that was taught ASM on a PIC16F54. There was no alternative possible, otherwise he wouldn't get a score. There is also absolutely none practical value in that, because A) That PIC doesn't have any peripherals to speak of which can be taught. B) Who programs in ASM these days?

I was fortunate at my college for Embedded systems where the teacher managing it made sure we had tools for AVR, Altera, Analog DSP, Xilinx, PIC, Philips 8051, ARM and TI. Basic embedded courses were taught on PIC first, but they later refitted courses to AVR. The teacher was quite supportive about students using the tools (if they are available) for their own or college projects, and if he wasn't too busy he was ready for questions even about MCU's he didn't know much about at all. The key here is that going over your rational thought process is a very important thing in understanding & debugging problems.

Unfortunately I also have seen some teachers that are like: "for this course you need to use VisualHDL" (which only runs on college PCs). You could deviate from the choice but then you're on your own. Great if it works, if it doesn't.. bad luck, maybe try VisualHDL next time.

It seems like your professor responded a bit grumpy today. I wouldn't let it distract you too much, assuming you asked him a question he could give a honest answer about (although Arduino=crap is also very honest opinion). What I mean is, I assume the question was about the project & not about some exact shenanigans of an Arduino library.

As for my MCU choices; most projects I've worked on are not very large volume. However, I also never choose to use Arduino. The IDE is not productive enough for me, since I am used to much more productive bigger IDE's. The Arduino libraries are fun for a proof-of-concept and hobby-grade one-offs, but IMHO on an engineering college you should refrain from those.
If you refrain from using the libraries and just use Arduino for the IDE & bootloader, you're basically programming it like any other ATMEGA328P, and maybe should just say you tested your code on an AVR because you had it at home.

For most of my projects I typically design, I would drop in a common MCU I've used before. At work we used to do all designs with a LPC1768, which was sufficient for all our needs. Lately we've upgraded to STM32F427. Cost is absolutely not an issue here, it's basically 2-4$ extra per board, but productivity & sanity is more important (remember; low volume, <500 boards per year).
However if a project has some odd important requirement, I wouldn't go through great effort to make it work on that beloved MCU. For example, I would never consider doing ethernet on an AVR anymore, since so many ARM Cortex m3 chips are around that have built in 10/100 ethernet MAC's that require a $2 ethernet phy, much less lines of code with much greater performance and integration.
Title: Re: Compare different microcontrollers
Post by: Lovely_Santa on April 02, 2016, 09:07:21 pm
Thanks hans :)

I see what you try to say:

The teachers try to do there best to teach something worthfull, getting students out of there comfort zone, let them learn things, but controlling it so they can help everyone sufficent with there problems like debugging..

Unfortunatly my Embedded system teacher only give 8051 to give a basic about everything (example: 3 hours talking about the different timers on the 8051 controller, 6 hours of serial communication, ...) So we understand everything and we can move on our own to the other boards without a problem...
I see that, for the project we use other boars (like now with an ARM corex processor) and we have no problems, we can relate (almost) everything to the basic stuff we saw already..

But like you say: You design with controllers you are familiar with, maybe sometimes get an upgrade, it get you out of your comfort zone, but you get used to the new controller..
Title: Re: Compare different microcontrollers
Post by: ade on April 02, 2016, 09:29:02 pm
Quote
However, I also never choose to use Arduino. The IDE is not productive enough for me, since I am used to much more productive bigger IDE's.
The Arduino platform is really just set of a C++ libraries.  You can use almost any C++ IDE to write Arduino code.  Plenty of people use Eclipse, Visual Studio, etc.
Title: Re: Compare different microcontrollers
Post by: dannyf on April 02, 2016, 09:37:41 pm
Quote
we can relate (almost) everything to the basic stuff we saw already..

That's the beauty of learning on a basic chip like 8051: the basics you learned on 8051 is quite transferable to most other chips (the Cypress is actually more of an exception here). If you boil it down, MCUs are nothing but a programmable device that communicates with the outside world by changing logic states on its pins and you poke around in memory to control how those state changes take place.

Once you understand that, pretty much every mcu is the same.
Title: Re: Compare different microcontrollers
Post by: rstofer on April 03, 2016, 01:45:28 am
For all the moaning and groaning about the 8051, it still commands a huge market share.  The newer clones are quite useful.

At the top of the thread, the OP posts a table comparing the two devices.  Unfortunate, not knowing the CY... chip, I accepted that it was only 8 bits until I went back and saw the ARM Core-M0.  That's a 32 bit processor of very modern design.  The toolchains are superb and, if it works like other ARM devices, it can be programmed over a serial link or with JTAG.

In comparison, the professor is right - the Arduino IS junk.  In comparison...  But for rapid prototyping, if it can be done on the Arduino at all, the Arduino is fast to get running.  There's a bit of a learning curve to the ARM chips.

I like the Atmel chips and I mess around with the Arduino from time to time but I must admit, I prefer the ARM 7 or 9 chips.  The linear memory space is one reason.  The paging nonsense in the 8 bit PICs is the reason there are no really decent PIC C compilers.  Paging and banking started out about 1960 and should have disappeared by 1980.  The small 8 bit PICs are a horrible design.  Yet they sell well enough for Microchip to buy out Atmel

The PIC 32 chips are quite nice but they are based on an entirely different architecture.

You have to go with the flow.  If the professor wants you to use a particular device, better get on with it!

Some professors hand out bootable DVDs with all the software required for the course.  It doesn't matter what flavor PC you have, you just boot the 'class' DVD and everybody is equal.  It will be based on Linux, of course.

Title: Re: Compare different microcontrollers
Post by: Stonent on April 03, 2016, 05:38:00 am
I think prototyping on Arduino is perfectly fine. There's a point where you have to get the logic to be sound before you move to getting it into C or ASM.

There is nothing trash about the arduino hardware. The trash part is the language is not really suitable for quick processing. But that's where the prototyping part comes in.
Title: Re: Compare different microcontrollers
Post by: westfw on April 03, 2016, 06:47:19 am
Quote
Arduino Unocy8ckit-049-4200
ATmega328P core:
  • 8 bit
  • 32kb programmable flash
  • 2kb SRAM
  • 1kb EEPROM
  • 16MHz clock
ARM Cortex-M0 core:
  • 8 bit
  • 32kb programmable flash
  • 4kb SRAM
  • 1kb EEPROM
  • 48MHz clock
   
22 connections:
  • 14 digital I/O
    • 6 I/O support PWM
  • 6 analog I/O
    • 10 bit A/D converter
  • USB connection
  • ICSP header
36 connections:
  • 36 GP-I/O
    • 12 bit A/D converter
    • Segment LCD Drive
    • Serial Communication
    • PWM supported
   
Other things:
  • Price: €20.00 + VAT
Other things:
  • Price: €4.00 + VAT
If I my post some corrections...
The Uno and the cy8kit are both "modules" rather than "microcontrollers."
The CM0 CPU on the cy8kit is 32bits.
They each have similar "usb connections."
32k of code space for an ARM, using "typical" libraries, is "not very much."  that's mostly because the "typical libraries" were designed for larger chips.
32k of code space for an AVR, using typical libraries, is "pretty big."  That's because it's a late model of a product line where chips had 1 to 8k, for a long time.
The prices you are comparing are essentially a "retail hobbyist price" vs a "vendor subsidized sample", so they don't really mean much.  They're both ~$3 microcontroller chips when bought in chip form from reputable dealers.

If your professor says "Arduino is junk" and "you should use the cy8kit", then you should certainly use the cy8kit.   That doesn't mean you can't prototype ideas on an Arduino.

Learning to use the Cypress development environment for the cy8kit, and programming it at the "bare" level without a bunch of pre-written libraries, will teach you many more "marketable skills" than using the Arduino environment.  That might be part of the point of the class.
If you used an arduino before, it would be educational to use something else.  The goal isn't really to make a power supply as quickly as possible, is it?


Title: Re: Compare different microcontrollers
Post by: Lovely_Santa on April 03, 2016, 09:11:12 am

If I my post some corrections...
The Uno and the cy8kit are both "modules" rather than "microcontrollers."
The CM0 CPU on the cy8kit is 32bits.
They each have similar "usb connections."
32k of code space for an ARM, using "typical" libraries, is "not very much."  that's mostly because the "typical libraries" were designed for larger chips.
32k of code space for an AVR, using typical libraries, is "pretty big."  That's because it's a late model of a product line where chips had 1 to 8k, for a long time.
The prices you are comparing are essentially a "retail hobbyist price" vs a "vendor subsidized sample", so they don't really mean much.  They're both ~$3 microcontroller chips when bought in chip form from reputable dealers.

If your professor says "Arduino is junk" and "you should use the cy8kit", then you should certainly use the cy8kit.   That doesn't mean you can't prototype ideas on an Arduino.

Learning to use the Cypress development environment for the cy8kit, and programming it at the "bare" level without a bunch of pre-written libraries, will teach you many more "marketable skills" than using the Arduino environment.  That might be part of the point of the class.
If you used an arduino before, it would be educational to use something else.  The goal isn't really to make a power supply as quickly as possible, is it?

The goal is just to make something work with the cy8kit, and if it doesn't work, it's not a problem, the goal is to understand what's goiing on..
But we use the cy8kit and arduino in the same way, just an other IDE to program it, but everything we program is in C, written by our own (no pre-written libraries allowed)...
Yes we learn a lot by just doiing it on different boards.. but I disagree we learn more "marketable skills" by using the cy8kit than the arduino... becose the programming is just the same... (bare C..)
But then I agree again that it's educational to use an other board to get out of our comfort zone, and learn a new environment...
Title: Re: Compare different microcontrollers
Post by: dannyf on April 03, 2016, 01:22:02 pm
Quote
I disagree we learn more "marketable skills" by using the cy8kit than the arduino..

I would say, from personal experience, that you should prepare to be surprised. In today's market, rarely you get asked about your 8-bit experience and people mostly ask if you have done any work on ARM or specialty MCUs. The Cypress presents a very interesting programming experience and knowing it will help you open many doors.

Your professor is superbly right if your goal here is an employment opportunity in this field.
Title: Re: Compare different microcontrollers
Post by: rstofer on April 04, 2016, 02:55:15 pm
Many of the packaged boards like Arduino and mbed, have libraries for all the common peripherals.  Timers, UARTs, even a complete TCP/IP stack (in the case of mbed).  All you really do is write the high level code to interconnect the library modules.  The abstractions are provided.

When you start from iron and write your own functions, chips like the ARM are clearly superior to something like the Arduino simply because the 8 bit Atmel chip can't keep up with the ARMs.  But the startup code and dealing with the interrupts is a learning experience.

A couple of years ago, I needed to implement interrupt driven SPI slave on an mbed.  It was easy to do but it wasn't exactly documented.  I want to run somewhere around 12 Mbps on the channel (I have forgotten what the max rate it, but that's what I wanted) and it all worked out.  But it wasn't a library function!  Why use the mbed?  It had a full TCP/IP stack that I didn't have to write.

Any ARM project from raw iron will be a marketable skill.
Title: Re: Compare different microcontrollers
Post by: tszaboo on April 04, 2016, 03:19:14 pm
I totaly agree! As an engineer you need to be flexible and be able to work with things you don't like or don't know yet...
Agree. Best is to suck it up, and use what they tell you to use.
When you have a job, and they tell you ,that you have to use that Infineon 8 bit microcontroller, you can either accept it, fight it, or just quit your job. You lose either way. Best is to pull the fire alarm so the building is evacuated, and hope they forget about it.
I always keep a smoke-flash bomb in my drawer, so I can disappear, when a project like this appears.
Title: Re: Compare different microcontrollers
Post by: westfw on April 04, 2016, 11:01:07 pm
Quote
I disagree we learn more "marketable skills" by using the cy8kit than the arduino..
In this case, I mostly meant that the Cypress IDE for cy8kit is more typical of "professional IDEs", and you'll learn a lot about "how to use a professional IDE" that you wouldn't learn by using the simplified "Arduino IDE." (and if you've never used a professional IDE, you might also have some observations about why the Arduino IDE has been left "SO brain dead.")
Title: Re: Compare different microcontrollers
Post by: ez24 on April 04, 2016, 11:40:18 pm
Quote
The professor said we needed to use the cy8ckit-049-42xx, with the reason that it's a quite nice microcontroller and easy to program...

Just curious - what school ?   Another curious question - what language is the course taught in?

I started looking around the Cypress site and am impressed.  So far it looks like you can get started with hardware, IDE, and debugger for $4.00.  Am I missing some $$ ?

Nice Cypress forum also.
Title: Re: Compare different microcontrollers
Post by: westfw on April 05, 2016, 12:47:46 am
Quote
So far it looks like you can get started with hardware, IDE, and debugger for $4.00.  Am I missing some $$ ?
I don't think that the $4 board does debugging.  It has a usb/serial converter and a serial bootloader (rather like arduino), but not an actual debug interface.
You'd either need an external SWD debug probe of some kind, or a more expensive eval board (Like "PSoC Pioneer") to get debugging.  I think I saw someone claim that you have to link in the bootloader code with each project, if you want to continue using the bootloader.  (OTOH, the datasheet claims a separate "SROM" with boot functions, so maybe not.)
Title: Re: Compare different microcontrollers
Post by: jnz on April 05, 2016, 05:25:47 am
Did it really take 17 posts before anyone pointed out that the ARM is 32bit?

I honestly feel bad for the poor souls devoting a second of their lives to learning PICs.
Title: Re: Compare different microcontrollers
Post by: joefarad on April 06, 2016, 06:27:40 pm
Hey EEVbloggers!

I'm an engineering student, and I had a discussion with one of my professors about different microcontrollers...
So last year, I had to make a working DC-engine, starting with only 2 magnets and an inductor, and everything needed to be powered from a microcontroller.
For that job, an easy Arduino Uno did the work, everything worked fine, 1000 rpm at only 5V with constant current of 75mA, could lift 3 kg (=6.6 lbs) without a problem.

This year, I need to make a power supply, an audio amplifier (class AB) and a constant current load all in 1 single machine, driven by a single microcontroller.
The professor said we needed to use the cy8ckit-049-42xx, with the reason that it's a quite nice microcontroller and easy to program...

The next week, I had a question, when I asked it at the professor, at one point I said: "For testing my code, I used a simple Arduino to try it out", and the professor answered that Arduino is trash!

So now... If you have something to make with a microcontroller (in general), which controller would you choose? The biggest, most powerfull one? Or would you look at only what you need?


Just some quick numbers:  :blah:

Other things:
  • Price: €20.00 + VAT
  • Link to site (https://www.arduino.cc/en/Main/ArduinoBoardUno)
   
Other things:
  • Price: €4.00 + VAT
  • Link to site (http://www.cypress.com/products/32-bit-arm-cortex-m0-psoc-4200-programmable-digital)
   

Really... Prototyping on Arduino is a useless endeavor, it isn't in any way close to your target platform.  You might as well program your project in javascript and run it on your IE browser for all that you will gain trying to prototype your project on an Arduino. 

You should primarily be trying to learn about the ARMv7-M architecture (same for the Cortex-M3, Cortex-M4, and Cortex-M7); ARM instructions set; all of the integrated devices; memory; interrupts; etc...

And also do it because your lab manager said to... You got a couple of months left?  Quit wasting time with the Arduino toy.  Better hurry and  Good luck!

What you missed in your original comparison (note the Apple A9) - from Wikipedia:

Key features of the Cortex-M3 core are:
ARMv7-M architecture[7]
3-stage pipeline with branch speculation.
Instruction sets:
Thumb (entire).
Thumb-2 (entire).
32-bit hardware multiply with 32-bit or 64-bit result, signed or unsigned, add or subtract after the multiply.
32-bit hardware divide (2-12 cycles).
saturation arithmetic support.
1 to 240 interrupts, plus NMI.
12 cycle interrupt latency.
Integrated sleep modes.

Silicon options:
Optional Memory Protection Unit (MPU): 0 or 8 regions.

The following microcontrollers are based on the Cortex-M3 core:
Actel SmartFusion, SmartFusion 2
Analog Devices ADuCM3xx
Atmel SAM3A, SAM3N, SAM3S, SAM3U, SAM3X
Cypress Semiconductor PSoC 5
Holtek HT32F
Luminary Micro LM3S1968
NXP LPC1300, LPC1700, LPC1800
ON Semiconductor Q32M210
Silicon Labs Precision32
Silicon Labs/Energy Micro EFM32 Tiny, Gecko, Leopard, Giant
Spansion FM3
STMicroelectronics STM32 F1, F2, L1, W
Texas Instruments SimpleLink Wireless MCUs (CC1310 Sub-GHz and CC2650 BLE+ZigBee+6LoWPAN)
Toshiba TX03

The following chips have a Cortex-M3 as a secondary core:
Apple A9 (Cortex-M3 as integrated M9 motion Co-Processor)
CSR Quatro 5300 series (Cortex-M3 as co-processor)
Samsung Exynos 7420 (Cortex-M3 as a DVS microcontroller)[14]
Texas Instruments F28, LM3, TMS470, OMAP 4470 (one Cortex-A9 + two Cortex-M3)
XMOS XS1-XA family (seven xCORE + one Cortex-M3)
Title: Re: Compare different microcontrollers
Post by: Sal Ammoniac on April 06, 2016, 08:15:27 pm
The following microcontrollers are based on the Cortex-M3 core:

This list is hopelessly outdated and shouldn't be relied upon.
Title: Re: Compare different microcontrollers
Post by: stj on April 06, 2016, 09:54:29 pm
Did it really take 17 posts before anyone pointed out that the ARM is 32bit?

I honestly feel bad for the poor souls devoting a second of their lives to learning PICs.

if you have to replace some obsolete TTL and you only need 8 or 14pins a pic does just fine.
not every job needs complex code - sometimes you just need a handfull of pins with some logic between them.

different tools for different jobs.
Title: Re: Compare different microcontrollers
Post by: rstofer on April 06, 2016, 11:43:15 pm

if you have to replace some obsolete TTL and you only need 8 or 14pins a pic does just fine.
not every job needs complex code - sometimes you just need a handfull of pins with some logic between them.

different tools for different jobs.

Or a CPLD...

Debugging:  If no debugging port is available, no problem.  My first step, on any bare iron project, is to get the UART up and running.  Then I grab a copy of "The C Programming Language" (K&R) and write some conversion routines like itoa(), puts(), putc(), getc(), gets() and so on.  I usually add some hex formats as well:  8 bit, 16 bit and 32 bit.  Now I can do some debugging output as I go along.  To do this, the startup code needs to work, the clock rates need to be set and the UART itself needs to be initialized.  Not a lot of work but sometimes a little datasheet reading helps.

Debugging Part 2:  If you don't put bugs in your code, you won't have to root them out.  Just a little something I picked up over the years.  Not that I am successful, mind you!  I just know I should do better.

Back to the datasheets.  One good reason for using a variety of chips is to get used to the stuff the manufacturers put out as a 'datasheet' or 'user manual'.  Some are better than others but when it gets down to the nits, a lot of reading occurs between the lines.

IDE:  There is no reason not to use something like Visual Studio.  At its core, it just runs makefiles.  Same with Eclipse although I find the Java implementation to be terribly slow to load.  Well, heck, I needed a coffee break anyway.

Title: Re: Compare different microcontrollers
Post by: nctnico on April 06, 2016, 11:50:40 pm
Why would you write your own routines? These are in the libraries which come with every C compiler! Still ARM controllers come in sizes between 8 pins and >200 pins from several big semiconductor manufacturers which also have similar peripherals (NXP is good at this). Learning one kind of controller with a wide variety of choices in peripherals gets you lightyears further than messing around with an 8 bit PIC and needing something else for a different job. Nowadays it is simple: ARM does it all whether it is low power or speed.
Title: Re: Compare different microcontrollers
Post by: westfw on April 06, 2016, 11:52:42 pm
>
Quote
I need to make a power supply, an audio amplifier (class AB) and a constant current load all in 1 single machine, driven by a single microcontroller.
Quote
Prototyping on Arduino is a useless endeavor, it isn't in any way close to your target platform.  You might as well program your project in javascript and run it on your IE browser for all that you will gain trying to prototype your project on an Arduino.
I might argue with you on the usefulness of Arduino (which at least would be C), but instead I think I'll say that prototyping a project in javascript in a web browser isn't necessarily a horrible idea, depending on where in your project the complexity lies.  DSP-like algorithms might be good candidates (are these DSP-like problems, or do they involve interfacing to specialized external hardware?  I can't tell...)

Quote
You should primarily be trying to learn about the ARMv7-M architecture (same for the Cortex-M3, Cortex-M4, and Cortex-M7); ARM instructions set; all of the integrated devices; memory; interrupts; etc...
Certainly NOT!  First of all, the recommended chip has a Cortex-M0 core, which is ARMv6m.  Secondly, it seems pretty common to teach/use ARM chips in C without spending much time on the architecture or instruction set (because of those nasty differences between ARMv6, ARMv6-M, and ARMv7-M, and ARMv7E-M.)   The "integrated devices" are probably important, though...

Quote
because your lab manager said to
He said "professor", whose advice I'd take quite differently than a "lab manager"...  :-)
Title: Re: Compare different microcontrollers
Post by: joefarad on April 07, 2016, 06:16:24 am
Certainly NOT!  First of all, the recommended chip has a Cortex-M0 core, which is ARMv6m.  Secondly, it seems pretty common to teach/use ARM chips in C without spending much time on the architecture or instruction set (because of those nasty differences between ARMv6, ARMv6-M, and ARMv7-M, and ARMv7E-M.)   The "integrated devices" are probably important, though...

...the dog ate my homework. :0