First of all I would like to thank everyone for all the replies. I watch a lot of Dave Jones's videos on youtube so I figured this would be a great place to start, and I wasn't wrong. I would have replied sooner but my right hand has been swollen stiff for the past couple days after injuring it while working on a project. Nevertheless, after reading every comment, I have a much better understanding of the various mcu platforms and I have no doubt it will help countless others in the future.
Anyway, I picked up Arduino uno at microcenter yesterday at the suggestion of HackedFridgeMagnet, wilfred, rstofer, forrestc, NANDBlog, ect. - hard not to at least try it with so many recommendations - and after tinkering with it from a couple hours I have to admit it's a pretty cool little board. Due to how overly simplified everything is and the incredible amount of material and community support around it, Arduino really makes it easy for a beginner to pick up. Plus there is a huge community over at avrfreaks which provide further support outside arduino. I'll definitely be spending a good amount of time with it.
The C++ versus C is the C versus assembler discussion all over again . I can guess the outcome though.
As a beginner, you have this exact question - C or C++(but not assembly obviously). I have no idea why people lump C and C++ into one group. While they are somewhat related, knowing one doesn't necessarily mean you know the other and they are for the most part entirely different languages. The one thing I don't like about the Arduino(and mbed) is that
everything is based around C++, and while it's really easy to understand and follow, it's also extremely inefficient. For example, the blinky demo that everyone starts out with is 928 bytes when compiled, whereas the same exact program when written in C is 176. The C++ compiled code is over 5x bigger but with nearly the same number of lines of source code
. I'd rather master C and have a fast and efficient mcu...
Btw, thanks for your replies nctnico, not just in this thread but in many others. When I'm searching for an answer, you always seem to have a lot of great info to share, so much appreciated.
I have 3 Linux boxes along with 3 Windows machines but since I bought my Surface Book, they remain idle. Adding the bash shell makes command line development a reality under Win 10.
I'm one of the 'geezer geeks' and I like messing around with FORTRAN and the GNU version works quite well in supporting the newer standards. I'm enjoying old school programming again.
I recommended above the "Mastering The STM32" book and I'll do it again. Follow the instructions for installing the toolchain and everything works well. I installed it on my Book and programming STM32F4 projects works well. Not that I have a handle on the STM32F4, that's going to take a while. The number of included HAL and CMSIS files is staggering. Over 3700 bytes of code (Release Mode) to blink an LED. There's a lot to learn and this isn't the way to start! But it's a nice platform and integrates well with the ST supplied tools.
I would still start with the Arduino. There's a lot to offer in that platform. And I would skip the C++ thing.
Thanks for the suggestion. I dl a preview of Mastering the STM32. Really handy book, albeit for someone slightly for advanced than I am. I'll probably buy it if I end up going with STM32.
The one thing I didn't account for was the insane level of complexity some MCUs have for even most trivial tasks - ie your 3700 bytes if code for an led? It's basically the reason I started this thread - to find the platform that can get the most done with the least amount of effort and hair pulling.
When I want to try something in a hurry, I reach for my Arduino Uno. I have a BUNCH of boards (literally dozens) but if it's something fairly simple, the Arduino comes up first.
Very useful! I had an application where I was emulating the plotter output of an old computer. It did step-by-step plotting with 0.01" steps - so a lot of steps to draw a graph...
I wanted to accumulate those commands as they came in over SPI and, if the pen was up, just accumulate until a pen down command came along, then move to the final location. If the pen was down, accumulate until there was a change in direction, then draw the line. In any event, these 6 bits words were eventually converted to HPGL command strings so I could draw the plot on a LaserJet. The LaserJet could be reached by a TCP connection.
I wanted to use large circular buffers on input and output and the SPI rate was 6.25 MHz.
Yup! The mbed is useful... I used the LPC1768 mbed with a MagJack to implement the networking and a couple of pins for SPI and another pin for 'busy'. Works well!
FWIW, all written in C, all through the online toolchain and the library provided all the necessary networking code. All I had to do was write my application.
Great to hear how mbed can be implemented in the real world. I think it would be the natural transition from arduino and I'll probably go that route. Quick question though, I thought most, if not all, of the mbed libraries were written in C++; how were you able to implement the C code in your application?
Arduino! There are shields to plug into the Uno (and others) that implement just about everything. Of course, at some point, you run out of pins. But within that limitation, there is a ton of stuff out there for Arduino.
https://www.sparkfun.com/search/results?term=arduino
As to learning C, you can use Microsoft Visual Studio Community Edition for free. If you use Linux, GCC is always available. Microsoft added the Ubuntu bash shell to the latest Win 10 upgrade which gives you access to many command line tools from Linux. The entire GNU Compiler Collection (includes Java, C, Fortran, Ada) is available. You would be writing command line executables, not windowing applications.
Since I'll mostly be working on PC, Microsoft visual studio is certainly a nice tool. A cool thing I found out is that Atmel studio is based on Microsoft visual studio and with a quick instructables tutorial I'm able to compile and send code directly to the ATmega328p just like with Arduino. If I could familiarize myself with Atmel studio well enough, it could potentially make the transition to their 32 bit ARM based SAM series of MCUs significantly easier. Btw, what is the general consensus of Atmel ARMs?
"when I have to set up a GCC toolchain for ARM, it is magic pain in the ass issues with make files, links missing, path not set up correctly, etc."
Whatever you don't know how to do is hard. GCC is simple as soon as you know how the compilation process works under the hood. That isn't difficult but many IDEs like to hide that from the user and the compiler also seems to know things by magic. But like any magic trick: what really happens is simple.
I dont doubt that these skills are achievable. The issue is: When you need to download an IDE from one site, GCC from an other site and make them work together, it will be more difficult than something that works out of the box. If you are a programmer who likes running linux, posting questions on sourceforge, and debugging logfiles to fix makefiles, sure. It can be done. It is boring, and if you are a beginner, it will discourage you from continuing.
I'm not a programmer, I'm an engineer. You want a button, which you press. The black box uploads your code into the microcontroller, and then it starts running. It should be a black box. If you need a guide, how to install it, it is already too much. Some manufacturers got this right, some rely on IAR/Keil to do this for them, which make them too expensive, some hide their information on the deep web, where only sandal+socks wearing people go, who are too young to realize they should already shave.
I'm more of an engineer than a programmer as well so while I don't mind setting something up, I'd rather avoid hunting down a bug that could have been avoided on a different platform. Could you elaborate on which manufactures got it right, or at least rank the top ones from best to worst? Your experiences and opinion of the various manufactures would be very helpful.
My experience is from a hobbyist pow, I work in the SW field but not on embedded stuff.
I mostly use STM32Fxxx (depending on the specific needs) and a bit of ESP8266 (dirt cheap on "AliBay"), MSP432 and Atmega/tiny, coming all the way from 6502, 6809 and 68HC11.
My 2 cents:
- Focus on learning C: you state in your initial post "...without knowing a single line of code or anything about microcontrollers..." and going Arduino will not help much (it's actually C++, but one tends to just cobble together high(ish) level libraries...); try to learn good style in coding and work your way through a good book, keep you on ANSI standard C (no OS specific stuff) and you'll have a very portable set of C skills.
- To learn C, you don't really need a Raspberry Pi (though I love them, I have several): if you have a PC/MAC with Linux/Windows/OsX there plenty of free IDEs or command line compilers. I'm partial to Visual Studio (community edition is free and very complete) and now VS Code (that's even open source!), but that's just me, good alternatives abound.
- IMO, C++ is a different language that happens to use the same syntax: I would not try to learn both at the same time, lest you end up with some confusion.
- If you still want to program Arduino-style many ARM boards are supported by mbed (Nucleos are much cheaper than Arduinos!): same ease of use, but also more powerful if you use advanced stuff (I'm not a fan myself)
- Psoc is very interesting, but its programmable logic part will add another step to the learning process...
- Don't expect high quality and support in vendor provided libraries (see my ranting with Texas here), some are better, some are worse, none is stellar.
- Hardware-wise: In the STM32 field, if you want something more than a bare bone MCU (Nucleo style) there's a wide choice of Discovery boards, the mentioned F7 is very nice board, maybe a bit daunting for a newcomer (and very few I/Os are free for you to use). I'd settle on a cheap Disco F4 (MEMS accelaration sensor, audio DAC), or Disco F429 if you want a display.
- Good advice. I've been putting every spare minute I have into learning C. While the arduino community may not be the best help in learning C, I do like the fact that I can find an answer to any question I have. That way I can see how someone solved a problem in C++ and try to figure out a way to do it in C. I'm seriously trying to avoid the copy/paste technique that seems to be so popular...
- I actually picked up a raspberry pi zero for $1 when I was at microcenter. After trying it out, it's a very cool idea, but it's not what I'm looking for. If I were learning OS's then yes it could be useful, but it's a far cry from learning embedded systems.
- I would prefer it if everything was in C, but it seems that a good chunk of the info on embedded systems geared towards beginners is in C++. So it's a bit hard not learning both. Which platform would you say is best for a beginner learning C without having to deal with C++?
- mbed is certainly very appealing. Right now I'm trying to decide whether to go with nxp or stm32. I am leaning towards stm32 because of the cheap nucleo boards, cube mx, and the free Keil support for F0/L0.
-
- Which are better, which are worse?
- I looked at the discovery boards and do like the extra features they bring for the price; I will certainly consider getting one but I also like the flexibility of nucleo boards, especially the 32 pin ones with a really small footprint that I can easily throw into a project
Yes. For a beginner, setting up the toolchain IS the biggest issue, after that, getting information on how to do things.
So where to begin... Arduino. Setting up the toolchain is simple. Getting information on how to do stuff is simple. Making prototypes is simple. You learn "kinda-sorta" C programming, you learn about peripherals, you learn about protocols. Start there. Engineers will avoid the topic, or discourage you that it is not real programming or real electronics, dont listen.
I have to agree, starting with PIC is simple, I did that myself, with ASM language and almost only the datasheet as information. You know what? I've learned a lot. But even now, when I have to set up a GCC toolchain for ARM, it is magic pain in the ass issues with make files, links missing, path not set up correctly, etc. Microchip PIC32 with works out of the box. MBED works almost out of the box. Arduino is excellent.
Setting up a toolchain for ST, NXP is horrible. Libraries are pain to track down manage, make them work.
So the only time I design with them, is when someone else writes the code, and I only design the PCB.
What a great post. You basically summed up the concerns of a beginner looking to getting into more advanced MCUs. Arduino is definitely a good place to start - at least at the beginning when
everything seems complicated. I have no regrets buying the UNO.
While ARM is dominating the market among 32 bit MCUs in the commercial world, the PIC32mx series has a lot to bring to the table, which is why I included it in the OP - and posts like yours make me question whether to go with ARM or PIC. When I started this thread, my goal was to find a microcontroller platform that offered tools easy enough for a beginner to learn while offering flexibility for more advanced engineers.
I have read countless other posts from people complaining about how complicated 32 bit ARM based MCUs are and how much more they like PIC32. I really want to like the PIC32 too, but there seems to be no love for it when compared to ARM. Which raises the question - If ARM didn't have such ubiquity in the market, would PIC32 be the better platform?
All I'm interested in is results. Whatever platform is most comprehensive,
easiest, and conducive to learning is the one I want to go with - regardless of market share or what it looks like on a resume. I want something that "just works". Is there an ARM product that fits this criteria?
The only real negative of PIC32 that I can find is that their pro compiler is somewhat expensive. I have to admit that it's pretty retarded for a hardware company to sell software that is designed to optimize code only for their hardware... Nevertheless, it is cheaper than other compilers and they offer monthly payment options which takes the edge off the cost.
Not considering the job/market and/or some heavy computing, what are some real world applications someone would go with ARM over PIC32 even if the support is somewhat fragmented?