microcontrollers beginning  - Page 1
Forum section: electronics / beginners

author: LuisLDias
author_rank: Contributor
timestamp: December 12, 2015, 12:27:10 am
content: Hi, everyone!I want to learn how to program microcontrollers. I already know C and C++ language I'm starting with Arduino but I want to go further. Is there any good starter kit? Should I buy pickit, another programmer or some dev board?I know nothing.. I don't even know where to search...Anyone could help me or just put me on the right path?

author: Cliff Matthews
author_rank: Unknown
timestamp: December 12, 2015, 03:40:04 am
content: Welcome to EEVblog! You will find some threads on the forum comparing AVR with PIC (the later usually wins on technical strengths) but since you are in Lisbon, I'll suggest a visit here:https://www.facebook.com/MakerFaireLisbon

author: Connoiseur
author_rank: Regular Contributor
timestamp: December 12, 2015, 04:19:37 am
content: Dev-boards are a great way to learn programming, since it comes with all the required parts i.e. crystal, power supply etc. with it. However if you want to get into the intricacies of an MCU and want to develop products around them, then a good way to start is to put the chip on breadboard with the required components and program it this way.There is a very good tutorial on AVR by Patrick Hood-Daniel -https://www.youtube.com/playlist?list=PLE72E4CFE73BD1DE1

author: Psi
author_rank: Super Contributor
timestamp: December 12, 2015, 07:37:16 am
content: The STM32 discovery boards are cheap, powerful and contain a USB programmer and debugger all in one $10 dev board.Having skill with ARM core chips is probably a better plan from a employment perspective.There are opensource IDE's you can use, such as emblocks or coocox.There's no hand holding like you get with arduino though,

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: December 12, 2015, 09:16:38 am
content: Quote from: JacquesBBB on December 06, 2015, 06:15:52 amIf you want to understand how goes the direct programming of a MCU, I strongly recommend to follow the MOOCfrom Austin University "Embedded Systems - Shape The World"by Jonathan Valvano and Dr. Ramesh Yerraballihttps://www.edx.org/course/embedded-systems-shape-world-utaustinx-ut-6-03xIts not about the Atmel chips, but the Ti Launchpad Tiva C which are very powerfulevaluation boards similar to the Arduino, but which you can get at low price from Ti or any main distributor.https://youtu.be/YchfhYsQFPcThe Austin team have done an extraordinary job with their course, as you will be able to directly program a board using a professional IDE (Keil) with step to step instructions and automatic correction and evaluationwith their special module.You will have to buy the EK-TM4C123GXL board which is only 12.5$, and has a on board debugger.The good news is that the new release of the lectures starts January 20, 2016.Even if after that you want to go back to Atmel MCU, you will have learn all the fundamentals.You will learn how to use a debugger,and will be able to easily adapt to any other MCU. You can also choose to continue on Ti MCU, which you can alsoprogram through an Arduino like interface, Energia.Here is the Syllabus of the Ti online lectures.Quote

author: AlxDroidDev
author_rank: Frequent Contributor
timestamp: December 12, 2015, 02:13:00 pm
content: Arduinos are a great starting point. Even though they aren't the most powerful MCUs around - by a long shot - they are powerful enough for lots of projects.The next step would be ARMs, and that's where things start to get ugly: you have to move from the confort of the Arduino ecosystem, where everything interconnects fine, where all of the libraries work with all boards (mostly, at least), where everything seems to work, where you can go from complete noob to a blinking LED in a few minutes, to the complete mess and warzone that is the ARM arena.While Arduinos is dominated by a single vendor - Atmel - and everything is standard, you'll know there are no standards in the ARM arena: there are several IDEs to choose from, there are several toolchains, several boards, several chips, several manufacturers, and everything is too specific: a program written for a STM32F10x may not work on the STM32F20x, and that sucks big time. It is a warzone.My suggestion - if you decide to leave the comfort of Arduino and AVR - is to choose one ARM hardware manufacturer that offers: board, chips and a functional IDE. Although ST Micro has all that, nothing beats TI`s offer in this segment nowadays: their MSP432 MCUs have great specs, excellent support, and are quite cheap at US$ 12.99.http://www.ti.com/lsds/ti/microcontrollers_16-bit_32-bit/msp/low_power_performance/msp432p4x/overview.pageSure, ST Micro has lots of different boards, like the Nucleo and Discovery boards, but it doesn't always deliver all the pieces of the puzzle you need and it's up to you to figure out (and create) what is missing.So, IMHO, start with TI ARM Launchpads (there are several options).

author: halloween360
author_rank: Contributor
timestamp: December 12, 2015, 02:39:43 pm
content: I have done quite a bit with arduinos, and they really can do a lot! They are super easy to interface with just about anything, i.e. leds, sensors, even other mcus. As mentioned previously they do hit a limit unfortunately. Do some research, pick a dev board/software suite, and play!

author: Monkeh
author_rank: Super Contributor
timestamp: December 12, 2015, 02:53:23 pm
content: Quote from: AlxDroidDev on December 12, 2015, 02:13:00 pmQuoteExcept.. there's no chips. You can't buy them yet.There are vague suggestions of Q2 2016.

author: Mechatrommer
author_rank: Super Contributor
timestamp: December 12, 2015, 03:11:59 pm
content: Quote from: Cliff Matthews on December 12, 2015, 03:40:04 amwhat?!

author: bingo600
author_rank: Super Contributor
timestamp: December 12, 2015, 04:00:45 pm
content: Quote from: Cliff Matthews on December 12, 2015, 03:40:04 amWuttt !!!IMHO - Don't go PIC , there's no free (decent) compiler , and you'dd get much more free sourcecode for AVR's or ARM'sBoth AVR & ARM have GCC compiler support , for free.I'd go Arduino for starters (Note that Arduino is AVR with a hardware abstractionlayer on top) , then maybe switch to pure AVR without the Arduino libs. Reusing the same AVR hardware.The later on you could try out ARM , there are some neat STM32F103 boards for $4.And they even have arduino supporthttp://www.stm32duino.com/But ARM is quite a bit tougher to wrap your head around for starters, so get your basuc MCU understanding on AVR. And move on later./Bingo

author: Roeland_R
author_rank: Regular Contributor
timestamp: December 12, 2015, 04:13:31 pm
content: I program my arduino completely in assembler, using atmel's studio 7 (free) programming and debugging environment. Works great. Now i know exactly how many clockcycles a routine takes. Compact and fast programs. Only a lot of work writing them.

author: doobedoobedo
author_rank: Regular Contributor
timestamp: December 12, 2015, 04:36:31 pm
content: I started with Arduino, then started incorporating some non-arduino AVR stuff into my sketches. The Arduino environment takes quite a bit out of the learning curve initially, but then you start to discover it's limitations. Fortunately you can then go to the datasheet for your processor and just bolt things in as you need them.I've just got a NXP LPC11U35 dev board as the ATMega328p just isn't sufficient for my new project. There is a free IDE (LPCXpresso) and development platform (LPCOpen). The learning curve is much steeper, but with the help of the examples and a bit of googling I've got a blink program running and I'll have UART going later today.The biggest problem with ARM is deciding which MCU. There are just so many!

author: AlxDroidDev
author_rank: Frequent Contributor
timestamp: December 12, 2015, 10:36:29 pm
content: Quote from: Monkeh on December 12, 2015, 02:53:23 pmThey are already available, although inPreviewstatus. You can buy or sample them fromhttp://www.ti.com/product/MSP432P401R/samplebuyThe MSP432 LaunchPad board is also available and in stock, and you can order one for $12.99 fromhttp://www.ti.com/tool/MSP-EXP432P401R#buyIn my opinion, no boards out there beat the MSP432 in bang-per-buck.

author: andre_teprom
author_rank: Regular Contributor
timestamp: December 12, 2015, 11:57:09 pm
content: Although some interesting options were recommended above, I feel that it is missing define the exact purpose of your request. The process of coding in C/C++ in embedded systems is in a sense the same as you have done in Desktop, so if you choose kits whose platforms support the most advanced resources (eg. OS) in a way isn't anything different than you already know.If you want taste the electronics in a deep, I strongly recommend you start with 8-bit cores, and just after go to the 16/32 bit cores.

author: LuisLDias
author_rank: Contributor
timestamp: December 13, 2015, 01:06:25 am
content: Thanks a lot both for your quick reply and disponibility. There's quite a lot for me to look and read.So I will try some Atmal stuff.What do I need to start? Some crystal, one Atmeal chip and a programmer like Atmel ice or avrisp?Or its a something like SAM4L Xplained Pro Starter Kit better?Arduino is ok, I have done some cool stuff with it. But and to do projects high frequency PWM and with Arduino I can't go higher than approximately 940Hz.Just one more thing is DSP that different from a normal microcontroller?

author: MarkF
author_rank: Super Contributor
timestamp: December 13, 2015, 05:05:39 am
content: Quote from: bingo600 on December 12, 2015, 04:00:45 pmIMHO, you need a little balance here.Don't be put off the PICs because of all the AVR and ARM fan-boys here.The Micochip PICs have a lot too offer and you should have some experience with them in your pocket so you can make informed selections for future projects. Get a PICkit 3, 5VDC power supply and one of the 8-bt PICs to start. I would recommend a pic16f886 or pic18f2550 as a mid-level PIC to start. Lots of features to get you started.The MPLAB X IDE and XC8 compiler are free to start and will provide you with an easy way to get started.

author: timb
author_rank: Super Contributor
timestamp: December 13, 2015, 05:37:56 am
content: Quote from: AlxDroidDev on December 12, 2015, 10:36:29 pmAnother nice thing about TI's MSP430, MSP432 and Tiva C boards is there's an Arduino-like IDE available called Energia.Energia will even let you directly open and compile Arduino sketches and libraries! (Well, assuming the sketch/library doesn't contain calls to low level AVR functions, but you'd have the same problem with the newer ARM based Arduino boards as well.)There's also a nice community over at 43oh.com to help you get started.I'd recommend picking up an MSP432, MSP430-F5529 or Tiva C Connected LaunchPad. They're all cheap and work great!

author: klunkerbus
author_rank: Unknown
timestamp: December 13, 2015, 06:01:23 am
content: Quote from: LuisLDias on December 13, 2015, 01:06:25 amIf you go the ATMEL route, be sure to check outwww.avrfreaks.net. Possibly the largest resource of Atmel user information out there. As others have already mentioned, if you have Arduino hardware, you already have Atmel AVR hardware you can start with. I prefer to program with Atmel Studio and an AVRISPmkII, blowing away the Arduino bootloader, but there's probably countless other programming options. For smaller size, check out small boards like AdaFruit Boarduino, AdaFruit Pro Trinket, or SparkFun Pro Mini. Even though they say they're Arduino, you don't have to run the Arduino libraries on them.

author: bingo600
author_rank: Super Contributor
timestamp: December 13, 2015, 07:09:35 am
content: Quote from: MarkF on December 13, 2015, 05:05:39 amWell i'm one of the AVR/ARM fanboys.I can't see anything that would make me chose PIC as my preferred MCU.They have a neat selection of small 8-pins , but that would not be interesting for a beginner.But one size doesn't fit all, and if you like PIC do continue using it.Maybe a i'd consider a PIC32 if i needed a DIP 32bitter, but that's a MIPS based device.And IMHO it makes the compiler choice and architecture a lot better.I'd go for AVR or ARM, and if i needed serious lowpower a MSP430 .In the end we'll all prob. end up with ARM's anyway , unless doing very specialiced or simple things./Bingo

author: ElektroQuark
author_rank: Unknown
timestamp: December 13, 2015, 08:40:51 am
content: Quote from: AlxDroidDev onYesterdayat 23:36:29Freescales Freedom series of boards. IMHO.

author: Psi
author_rank: Super Contributor
timestamp: December 13, 2015, 08:42:19 am
content: It's true.In 2035 your singing xmas card will be powered by a ARM Cortex A17 with 4k e-ink display and 802.11AACXJOA super ultra speed 15GHz wifi.The battery however, will still be a CR2032.

author: MarkF
author_rank: Super Contributor
timestamp: December 13, 2015, 10:13:23 am
content: Quote from: bingo600 on December 13, 2015, 07:09:35 amI could tell.I'm not in either camp. I have both.How do you know you've made the best design choice if you've CLOSED your mind to one manufactures entire product line?In my career, I've seen several cases where poor choices were made because of closed minds to better options.Case in point: The Linux and Microsoft camps. Where an engineer was unable to get a simple serial port working after a 6 month effort. Using the alternative, the project was completed within several days. Unbelievable waste!!!KEEP an open mind!DON"T limit you design possibilities.Become familiar with as many different products as you can.

author: Howardlong
author_rank: Super Contributor
timestamp: December 13, 2015, 10:50:23 am
content: Quote from: LuisLDias on December 13, 2015, 01:06:25 amYou can typically use DSP devices for more mundane tasks like a blinky, but architecturally they tend to support a combination of one or more of the following, typically for example: very large instruction word; multiple parallel data busses, specific instructions useful for repetitive vector maths, ALUs directly supporting single cycle vector operations.It's not uncommon to find some devices, such as Microchip's dsPIC series for example, making no use of their DSP capabilities, but using some other on-chip facet such as high speed ADCs for data acquisition.Regettably the AVR/PIC argument typically ends up being a meaningless pissing contest between proponents of each. In some respects the same applies to ARM vs non-ARM. The biggest problem with ARM is understanding that although a given core might be the same across vendors, peripherals between vendors are all different. You can't just lift code, not even a blinky, from one ARM vendor and expect it to even compile for another vendor.I remember spending countless hours trying to understand just the different ARM cores and what it meant. The amount of information there is to take in and understand how this matches your requirements is just so much, knowing where to start puts you into analysis paralysis.That last statement about analysis paralysis is key: at this stage you're probably better off restricting yourself to a couple of days' research, pick a device that fits the bill, and go with that. Be careful of going after the latest and greatest device with seemingly endless functionality and performance, the learning curve for these kinds of devices will be gruesome.In the meantime, back to the AVR/PIC debate...http://youtu.be/gb_qHP7VaZE

author: Simon
author_rank: Unknown
timestamp: December 13, 2015, 09:49:05 pm
content: Depending on what you want to do just pick a basic eight bit chip and start to understand it. I started with a small eight pin AVR and started getting basic things working like a blinking LED, then I looked at PWM outputs, then ADC inputs and so on. Once you have learn how to deal with such a simple device you can then look at something bigger like an ARM.

author: savril
author_rank: Regular Contributor
timestamp: December 13, 2015, 10:03:25 pm
content: Choosing a microcontroller is basicaly a project or personal choice. All ?C has theirs fans.Personally, I choose to go with STM32 because:- it is an ARM device which is the dominant architecture. So you could recycle some knowledge on the STM32 on the many other ARM devices.- it has a nice and cheap set of officials dev kits- you could find many cheap Chinese boards with it- it is arduino compatible (see STM32 arduino project)- the programmer/debugger is relatively cheap (and you could find Chinese clones for nothing)- the microcontroller chip alone is cheap and ST line is relatively balanced- it has a full open source IDE solution (GCC ARM, Eclipse, ...)But there are many other ARM chip which are as good. Some has better ADCs, ... The only other shop which I don't like is Atmel. Their ARM SAM range is overpriced compared to the competition...

author: SL4P
author_rank: Super Contributor
timestamp: December 14, 2015, 11:05:11 am
content: once you choose a chipset and toolchains..after the Blinky, port bits, ADC and PWM basics...Learn how to write well formed code - not all code has to be purely linear.Interrupts, sleep, switch() statements... break, continue - will all contribute to more reliable and readable code!You'll also get a lot more code which is easily portable, and may become your own libraries for future re-use.

author: doobedoobedo
author_rank: Regular Contributor
timestamp: December 14, 2015, 11:48:26 am
content: SL4P makes an excellent point.Plan your code, split it into meaningful chunks. If you ever need to maintain it or just debug it it will make it loads easier.

author: AlxDroidDev
author_rank: Frequent Contributor
timestamp: December 14, 2015, 11:59:59 am
content: Quote from: savril on December 13, 2015, 10:03:25 pmAlthough I love AVRs, I have to agree 100% with you on that: everything from Atmel is extremely overpriced for what it is. That's why SAMs are my last choice when it comes to ARM, to the point that I don't even consider them. When you consider performance-per-dollar, AVRs should be everyone's last choice, but their simplicity more than make up for the high price.Another vendor worth mentioning is SiLabs. They have 2 lines of ARM chips: the SIM3 (focused on performance) and the EFM32 (focused on low power). It's too bad that their dev boards aren't very affordable and hard to come by (unless you order directly from SiLabs). They're not as common as options from STM or TI .Quote from: doobedoobedo on December 14, 2015, 11:48:26 amIn other words: divide and conquer. That's the best approach for any project, in whatever field.

author: doobedoobedo
author_rank: Regular Contributor
timestamp: December 14, 2015, 01:10:33 pm
content: Quote from: AlxDroidDev on December 14, 2015, 11:59:59 amYou're right, nothing different about coding to anything else, but people new to it tend to dive in do one thing, then add another without thought, then add some more, until without really realising it they've created an unmanageable mess.

author: timb
author_rank: Super Contributor
timestamp: December 15, 2015, 06:30:53 am
content: I think the Cypress PSoC should also be mentioned here. You can get a PSoC 5 dev board for $10, which even includes the programming dongle. (The dongle doubles as a second dev board, too!)The PSoC is quickly becoming my favorite MCU to work with. Actually, MCU isn't even a good description of what these devices can do. It's like a Cortex-M knocked up an FPGA and the PSoC is their offspring.The logic can be programmed in Verilog or you can use the schematic editor in PSoC Creator, which basically lets you drag'n'drop and connect everything from logic gates to counters to look-up tables. The analog components are setup the same way.Anyway, they're super awesome and very easy to start using.

author: miguelvp
author_rank: Super Contributor
timestamp: December 15, 2015, 07:37:13 am
content: As for one of the big PSoC fanboys in this forum, I couldn't agree more.From this post here:https://www.eevblog.com/forum/microcontrollers/grab-a-psoc-4-m-series-proto-kit-for-$10/msg819515/#msg819515I mentioned:QuoteAlso there is the Pioneer PSoC4 ($25) with all these projects (not arduino ported to the PSoC4 I'm afraid but it has compatible headers but the Sparkfun $50 board does.http://www.element14.com/community/thread/23736/l/100-projects-in-100-days?displayFullThread=trueThose projects should run find on the prototype kit after changing the target chip and the output pins.I'm working on a tutorial about how to display VGA on the $10 prototype kit timb talks about.Edit3: to clarify, all VGA signals are implemented in hardware but with the use of an R2R VGA module to get the analog out. What this means is that the Cortex M3 ARM is just filling the buffer and not doing any bit banging at all so it has plenty of cycles to do what an MCU is supposed to do (run programs not the hardware)https://www.eevblog.com/forum/microcontrollers/grab-a-psoc-4-m-series-proto-kit-for-$10/msg814409/#msg814409It does work fine with the internal oscillator, but after one second from the trigger it's all over the place (thankfully VGA LCD displays are fine with that jitter since this is 60 full frames after the fact it looks horrible).Edit: I will reiterate that this is a full second after the trigger.But using a OXCO 26 MHz is steady as a rock (thank you again blueskull), also you can put an XTAL (up to 25MHz I believe) but no space for caps on pins 15.2 and 15.3 but should be easy to put them in there since there is with a small bodge. Funny they did put caps for the RTC pins (15.0, 15.1).Edit: this is also a full second after the trigger and couldn't be cleaner.Edit: both captures are done with infinite persistence after about 30 seconds at least.Edit2: Even if you put an external XTAL (or the built in oscillator or even an external digital clock like the OXCO I used, you can use the built in PLLs to run the master clock up to 80MHz.This is an Sparkfun engineer making a Video Game chair, since the PSoC5LP does have an HID USB component so you can make your own USB peripherals.I could go on, believe me.But then again, the PSoC has a lot of details and the more you dig into them the more doors it opens to the point to despair, but you can stick to the Arduino IDE (if you can port it to the $10 board which should be fairly easy) and then add on to it.So it's a cool chip, easy to learn but really hard to master (I'm not even close to do so). But as for growth, it does have that.Again, I didn't look at the Arduino project for the PSoC5LP nor used Arduino much (Got a Intel Galileo I did play around with that uses the Arduino IDE and also a Papilio Duo FPGA/AVR that also uses the Arduino IDE)Anyways look at the comments from Sparkfun. Is that board worth $50? maybe specially since it has an unpopulated XTAL and caps if you need the precision.Is the PSoC the cheapest or the best? not really, depends what you want to do, but it's flexible (no doubt about it)Edit again: just to mention that you can put several voltages on different pins for level translations, say 5V and 1.8V. The chip supports this, not sure if any of the actual boards expose those pins for doing this.and let me add one more video of the FreeSoc2

author: LuisLDias
author_rank: Contributor
timestamp: December 17, 2015, 12:10:17 am
content: I've been looking for some AVR microcontrolers and dev boards. But recently discover that Atmeal studio does not work on mac PCs. So I ended buying a 8-bit dev board from microchip that bring the pickit3 included, the pic18 explorer.I really don't know if I make the best choice, but it's better than nothing.http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM183032At least Mr. Dick heads from microchip like my choice. When I buy a proper PC I will try some atmeal stuff.Are there some good book about programming or about microcontrollers?Thanks for all the comments.

author: ez24
author_rank: Super Contributor
timestamp: December 17, 2015, 03:55:28 am
content: check out PIC's Microstick IIit is used in some universities to teach MCs

author: Rick Law
author_rank: Super Contributor
timestamp: December 17, 2015, 05:40:17 am
content: Quote from: LuisLDias on December 12, 2015, 12:27:10 amThere are many good advice posted thus far, but few from beginners. I am fresh from no experience to being able to built a few things, so I relate to your feeling overwhelm at the get go.Beginner to beginner, Arduino is cheap and it is easy. If it is your first foray into MCU's, I cannot think of a better choice. There are lots of resource on the web with Arduino, many of them are based on the UNO. So if you get that version, you are sure to find some "how-to's" specific to UNO. It is very comforting when they are demo-ing using exactly what you got so you know it works. Nano is actually better and a bit cheaper, but when you are uncertain and don't know what is what, having the exact model being demonstrated cuts down the confusion and learning cure.I suggest:- get a couple (you will blow something for sure) of Arduino UNO R3 from the cheap Chinese clones,- get a bunch of generic LEDs and a few resistors (1k, 2k, 3k, 10k, ~600, 470, 300, 100) from places like Tayda.Make your Arduino do a traffic light for a cross (+) street. Better have both-green-lights for crossing traffic.Now that you have that going, you are beginning to know what those pins are, and how the MCU does things (in the Arduino Environment).Step 2, input- get a buzzer from Tayda (75cents, so get it with the first group of stuff to avoid long shipping wait)- get some Photo Resisters from Tayda. They are also cheap.- and/or get a PIR motion sensor from the cheap Chinese clones.With the PIR, now you can have a cat alarm. Mine is still in use. I feed homeless cats and I like to see who came.Or with the photo resister, you can have the Arduino blink something when it gets dark.Step 3, fancy output- LCD 20x4 (aka 2004) using I2C- Dot matrix like the Nokia display- TFT display (some with SD card reader)I have a mini photo display using a tiny TFT (about 2 inches)Step 4, which I just started - getting outside the Arduino EnvironmentI just took my baby steps in this direction.- I just completed a project using TINY13A. For other reasons, I got a flashlight to play with, and I decided to get a driver (NANJG 105c) that uses the TINY13A. That became my perfect testbed to move away from Arduino. Perfect environment for learning as there is a ton of info on the Web on that.I blew away their firmware and using the TINY13A datasheet plus examples on the web, I manage to write my own driver. AVR coded totally independent from the Arduino Environment. With Arduino UNO at hand, I have an ISP programmer already, so all I needed to begin doing non-Ardunio software was just to download WinAVR and off I go. I know have a flashlight operated entirely by my software - with different light levels I want. It even blink out the battery voltage at my command. (Blink Hi 3 times and low 4 times means 3.4Volts)I just completed an upgrade to the TINY85 for more space so I can have more options.Well, if I want to dig deeper and do more, now I am equipped with more knowledge to choose better tools.What worked for me may not work for you. But that is how this beginner got into it. Hope this info is helpful to you.