Moving from an arduino to ARM microcontroller, seeking advise.  - Page 1
Forum section: electronics / general

author: anishkgt
author_rank: Frequent Contributor
timestamp: August 24, 2018, 04:37:07 pm
content: I’ve been working with Arduino for a while and from what i’ve read they don’t seem to be the best for production. Is there any specific reason to that, or is it because of the fact that they are only used for prototyping.I am looking forward to enhance my programming skills with microcontrollers. Found several on Udemy but was not very appealing.Would appreciate if anyone could suggest me a course or where start from. Are there development boards like the arduino that has stm microcontroller.Thanks in Advance.Www.Georgehobby.wordpress.comEquipments: DSO104z, Hakko FX888D, Brymen BM869s

author: ogden
author_rank: Super Contributor
timestamp: August 24, 2018, 04:57:24 pm
content: Quote from: anishkgt on August 24, 2018, 04:37:07 pmTools that are used in the classroom shall stay in the classroomOversimplified hardware abstraction is good when you learn (fast) but pain in thea**back when you are professional and want full control over microcontroller and it's peripherals. CheckMbedandsupported ARM boardsIt's kind of next step away from Arduino "play thing" towards professional ARM development

author: ebclr
author_rank: Super Contributor
timestamp: August 24, 2018, 05:03:24 pm
content: Actually, thousands of products are based on Atmega / Arduino infrastructure, especially for low quantities production is a good choice due to the simple development system with a huge library of code available for free. You have some reasons to move, The processor power isn't enough for your processing, You need something more cost effective on the hardware side, You need a low power system battery based.If you don't fit on this stay where you are nothing else will be so easy

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 24, 2018, 05:05:23 pm
content: Using prototype boards for production is frowned upon by some. What you could do is design your own boards with AVR chips. That way you're already partially familiar with the ecosystem.AVR chips are relatively underpowered when you compare them with more modern ARM chips. Those tend to offer more bang for buck when it comes to pure horsepower. AVR chips are in the other hand much more capable than many people give them credit for and the simple 8 bit architecture means it's much easier to work at a really low level. You'll learn a lot and have more control over the hardware with less hassle when you dig a little deeper than just the Arduino environment.I'll warn you that this is a matter that tends to evoke strong opinions, and you'll inevitably get people telling you to go ARM because 8 bit is outdated or worthless and other people telling you ARM is lazy overkill with too much complexity. Both have a point, but it's mostly a matter of personal preference. As long as your project doesn't have constraints that dictate a choice, of course.

author: rstofer
author_rank: Super Contributor
timestamp: August 24, 2018, 05:16:56 pm
content: The Arduino is a platform, the ATmega328P is a chip. So what if you develop on an Arduino with the intent to move the code to the ATmega328P chip on your product board? As long as the code solves the problem, go for it.However, if you need more horsepower, you need to look toward ARM. Even then, there are simplified platforms like 'mbed' which provide a fairly large library (including networking) and everything else including an online toolchain. Mbed.org is now owned by ARM - for better or worse. I use the original mbed based on the LPC1768 for projects and I simply plug it in like I might with an Arduino Nano. Note that many of the ST boards are also mbed compatible.You can also write all of your own code for the Arduino and try to optimize size and speed. Long before there was an Arduino, I was working with the ATmega128 and it was a very nice chip. It has a lot of pins and the AVRlib stuff all works.I like to think I have outgrown the small uCs like the Arduino and PIC16Fs. I like the virtual garbage can approach to memory on most of the ARM chips. I can write forever and not fill up flash. RAM gets a little tight from time to time. The thing is, every time I want to try some little project, I reach for the Arduino. The project may port somewhere else but for a first cut, the Arduino platform (running on Microsoft Visual Studio) is very nice. I hate the Arduino IDE...There is no comparison in speed. The ARM is vastly faster than the ATmegas. And it is a family of devices from the very trivial up to PC equivalents. There are multi-core variants, those with memory management (for the OS) and hardware floating point.

author: ogden
author_rank: Super Contributor
timestamp: August 24, 2018, 05:22:31 pm
content: Quote from: ebclr on August 24, 2018, 05:03:24 pmWe really shall define what is production, because you can put "product" label on virtually any crap that craftsman in his basement "produces" in low quantities starting from two.

author: Nusa
author_rank: Super Contributor
timestamp: August 24, 2018, 05:24:24 pm
content: Quote from: ogden on August 24, 2018, 04:57:24 pmYour rant about some optional hand-holding software is irrelevant to the suitability of the hardware, since you can stop using part or all of those libraries and do it yourself any time it's required. There's nothing that prevents you from exercising full control over arduino hardware or it's peripherals.There are plenty boards in production that use some version of the arduino microprocessor. We're talking about a single IC on a board in most cases, not a prototype board. Usually in a small SMD package. It's perfectly adequate for a great many tasks. If your task requires something more powerful, then yes you should look elsewhere.

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 24, 2018, 05:27:40 pm
content: ARM van be vastly faster, but also tends to have more overhead when executing instructions. This can make the difference smaller than you'd expect, depending on the application. Both have pros and cons without there being a clear winner for most cases.It seems the predicted camps are already voicing their opinions.

author: ogden
author_rank: Super Contributor
timestamp: August 24, 2018, 05:29:12 pm
content: Quote from: Nusa on August 24, 2018, 05:24:24 pmArduino microprocessor? What's that?

author: anishkgt
author_rank: Frequent Contributor
timestamp: August 24, 2018, 05:32:03 pm
content: I am not asking for comparison between the two microcontrollers just needs some advise on how to learn the professional language of programming microcontrollers. I am 34 and my projects are mostly at the hobby level.My needs had been fulfilled with the arduino not that I have a higher requirement in terms of processing power or memory. Just felt that most ppl prefer the STM32 in there projects than an arduino.Does the professional models like the STM32 have libraries like the Arduino do ?Www.Georgehobby.wordpress.comEquipments: DSO104z, Hakko FX888D, Brymen BM869s

author: ogden
author_rank: Super Contributor
timestamp: August 24, 2018, 05:35:02 pm
content: Quote from: anishkgt on August 24, 2018, 05:32:03 pmYes. Mbed. I gave link in my post.Then there are various HAL (hardware abstraction layer) libraries, high level function libraries and peripheral drivers from chip vendors and 3rd parties and so on.

author: Nusa
author_rank: Super Contributor
timestamp: August 24, 2018, 06:11:36 pm
content: Quote from: ogden on August 24, 2018, 05:29:12 pmmicrocontroller, if you prefer. I understand the technical distinction. My formal education predates the word entirely, so automatically using the word was never hammered into me like it may have been for some of you. Language evolves.As for the word arduino when used as a general term without qualifiers (e.g. Arduino UNO, Arduino DUE, etc), we're usually talking about something in the 8-bit atmega lineup. But it could also include some of the 32-bit ARM chips, since there are a great many different arduino branded prototype boards.When we say production, it's generally understood that we're not talking about prototype boards, regardless of the label on the microprocessor.None of that justifies trash-talking hardware by pointing at software.

author: ogden
author_rank: Super Contributor
timestamp: August 24, 2018, 06:26:57 pm
content: Quote from: Nusa on August 24, 2018, 06:11:36 pmUsually when someone uses word Arduino, he means more than just 8-bit Atmega microcontroller on the PCB.

author: mtdoc
author_rank: Super Contributor
timestamp: August 24, 2018, 06:31:53 pm
content: Quote from: anishkgt on August 24, 2018, 04:37:07 pmThese two courses wil get you programming in C on ARM:https://www.edx.org/course/embedded-systems-shape-the-world-microcontroller-inputoutputhttps://www.edx.org/course/embedded-systems-shape-the-world-multi-threaded-interfacingThey use a TI ARM development board, but will teach you all you need to know to get started with ARM regardless of which vendor.

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 24, 2018, 07:00:25 pm
content: Quote from: anishkgt on August 24, 2018, 05:32:03 pmI would advise you download Atmel Studio or whatever it's called now and have a go. Maybe write some libraries for AVR chips yourself. You'll learn a lot about "real" coding without drowning yourself in ARM oddities and complexities. You can slowly work away from Arduino and more towards just plain AVR.The beauty of the Arduino platform is that there is an almost continuous path from high level handholding and connecting libraries together to the low level of writing to registers, assembly and other advanced matters. You can build upon what you know and venture into the woods ever further. Doing something like writing assembly for ARM is something even industry experts avoid if they can.

author: ttelectronic
author_rank: Regular Contributor
timestamp: August 24, 2018, 07:02:09 pm
content: I would suggest taking the time to learn C, pickup a book for C programming and have a good read. Arduino has it's uses, but it's not the best tool for learning. imho you don't really move from anything, but add to your knowledge base. There are situations where an 8-bit mcu makes way more sense than ARM or vice versa.

author: anishkgt
author_rank: Frequent Contributor
timestamp: August 24, 2018, 07:09:00 pm
content: Yes I did have a look at the atmel studio once. Felt like a foreign language when I was hooked to the arduino platform. I guess it would be ideal to get used to atmel studio first and latter look at other IDE or other brands like ST32 as they somewhat share the same syntax unlike arduino.I thought atmel and st32 coding was same as the arduino IDE.Www.Georgehobby.wordpress.comEquipments: DSO104z, Hakko FX888D, Brymen BM869s

author: rstofer
author_rank: Super Contributor
timestamp: August 24, 2018, 07:26:40 pm
content: Quote from: anishkgt on August 24, 2018, 05:32:03 pmThis question will start the inevitable language wars! Arduino kind of uses C++, sort of. In my view, for embedded processing, C++ is the wrong thing to use. Most everything that I have seen is done in C. Note that the entire Linux kernel is written in C. The features of C++ don't necessarily apply to a microcontroller.Anyway, here we go with the wars: C vs C++.QuoteYes, the STM32 is becoming quite popular because ST is making interesting development boards that are quite cheap. Some projects DO require more memory and more speed than the 8 bit ATmegas. Most don't. It is important to be able to work in either sandbox and to not take sides.QuoteYes, ST provides an entire universe to play in. CubeMX allocates pins and generates code plus there is a HAL (Hardware Abstraction Layer) {known as bloatware} and plenty of free tools. If you want to go down this road, buy a copy of "Mastering the STM32". The author will get you up and going in a real big hurry.Here are the boards that work with the mbed platform. In this sandbox, you don't even need to install a toolchain, everything is done with a browser. Why do it this way? Because I can reach my project code from anywhere in the world from any machine I happen to have. Your code plus the mbed libraries can be downloaded to your local machine and you can use another toolchain if you wish.https://os.mbed.com/platforms/But, as I said above, don't take sides. The ARM chips offer more speed and more memory but they are orders of magnitude more complex to program than a simple Arduino using the provided libraries. And don't fall in love with the idea of HAL code - it is a PITA to use and finding the documentation isn't always straightforward. More often than not, I write my own stuff rather than rely on code I have never seen. The HAL stuff is bloated simply because it tries to do everything for everybody.At the chip level, you really can't write code for device drivers unless you have a fairly deep knowledge of hardware. That's why the Arduino libraries exist. The Arduino was designed for artists to mechanize their creations. They aren't expected to be hardware gurus.To play in the embedded sandbox, you need to have skills in both hardware and software.

author: rstofer
author_rank: Super Contributor
timestamp: August 24, 2018, 07:38:57 pm
content: Quote from: anishkgt on August 24, 2018, 07:09:00 pmIn some abstract way, it's all the same thing using different ways of getting to the result. You will use different IDEs, there will be different schemes for programming the device, the IDE will have more or less features (although it would be hard to imagine an IDE with less features than the Arduino IDE), more or less library code will be available and, of course, the hardware is totally different (while still doing the same kinds of things).There's nothing wrong with using the Arduinos, I do it all the time. If you are comfortable and the device meets your needs, why move? OTOH, if you want to work your ass off climbing a really steep learning curve, jump into ARM. I did that 10+ years ago with the LPC2106 and the LPC2148 and it took a while to catch on to how things work. In all cases, you learn stuff along the way and much of it ports between platforms. It's all education!Any time a chip comes with a 1700+ page reference manual and the datasheet is a separate 100+ page document, you can expect to have to read quite a bit to gain an understanding of how things work. That's why people stay in their own comfort zone. Having digested to some extent a 1700 page manual, nobody wants to start up with a different chip. All of the details are different. It takes time to get up to speed.

author: djnz
author_rank: Regular Contributor
timestamp: August 25, 2018, 02:04:00 am
content: 1. If it serves the purpose, there's nothing wrong with using an Arduino.2. If you want to move away from using simplified / abstracted Arduino-style coding, but want a gentle learning curve, you could use the same microcontroller but program for it in "vanilla" C or if you want to get a little more fancy, "vanilla" C++.3. For a more ARM based approach, check out "Modern Embedded Systems Programming Course" on youtube -https://www.youtube.com/playlist?list=PLPW8O6W-1chwyTzI3BHwBLbGQoPFxPAPM

author: NorthGuy
author_rank: Super Contributor
timestamp: August 25, 2018, 04:55:11 am
content: MCU mostly differ by their periphery. Generally, you want to off-load as much work as you can to the periphery. CPU plays some role in selection, but not the central one.Start from a project. Figure out what tasks you need to perform. Most Arduino people use external modules. Instead, try to find an MCU which can do most of the job for your project by yourself. It will take a while. Once found, you can buy a board for prototyping, you can do breadboarding, or you can build your own PCB. You select one of these methods, get the parts and start developing. Don't worry about brands - your next project may be a different brand. After you do few projects, you'll know what you like and will learn how to make design choices.

author: cstratton
author_rank: Regular Contributor
timestamp: August 25, 2018, 05:06:25 am
content: There have actually been Arduino ports to various STM32 chips, and there may be one today. Unfortunately they tend to stop working, because the Arduino folks change how 3rd party ports are supposed to plug in, and then all the less enthusiastically maintained ports cease working until updated.The mbed stuff can be a way to get a project off the ground quickly, but in a way it is not all that different from Arduino - still a lot of extras, still a lot of shockingly odd things going on under the covers if you have to dig into the details to figure out why something isn't working right.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 25, 2018, 06:00:51 am
content: its interesting to see how many threads got hijacked / derailed when the OP asked something straight forward... esp SW language related, there was once pic vs avr war, now its no more since microchip bought atmel, now its avr vs arm war. i for one is also interested in more info... the only person who replied correctly in this thread link the mbedOS, which seems less intimidating because it seems bloated with OS, IoT etc and any other unnecessary stuffs for beginner imho (i maybe mistaken). i already got some materials and boards but havent got the chance to do serious programming in arm...there you go, moving arduino to arm (or arm to arduino?)...https://www.ebay.com.my/itm/DUE-R3-SAM3X8E-32-bit-ARM-Cortex-M3-Arduino-DUE-R3-Control-Board-Without-Cable/301247046469?hash=item4623b92345:g:DGsAAOxy0bRTCLigbelieve me you can just polish your C/C++ (professional?) skill in arduino the IDE just fine albeit with few limitations... inefficient (slow) compiler, no files/project structure, and lack of debug feature.searching in this forum also may help as this has been asked so many times... i remember one guy here built a website for step by step arm programming but forgot the link... here some...https://www.cs.indiana.edu/~geobrown/book.pdffromhttps://www.eevblog.com/forum/microcontrollers/arm-begginer-questions/msg390182/#msg390182google also may help such ascarmine-noviello-mastering-stm32-2016.pdfymmv.

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 25, 2018, 12:10:59 pm
content: Quote from: Mechatrommer on August 25, 2018, 06:00:51 amThat wasn't the only post to answer OP in helpful ways. Anyone reading between the lines has seen that OP wasn't asking what he was asking. Thanks to this he has gotten a lot of good information and advice about the nature and possibilities of his current platform and roads to different platforms. Dunning-Kruger and not knowing what you don't know and all that.Please don't insult your fellow forum goers. They do go to war sometimes but they're quite helpful and useful most of the time.

author: westfw
author_rank: Super Contributor
timestamp: August 25, 2018, 02:35:28 pm
content: There is this:https://github.com/rogerclarkmelbourne/Arduino_STM32In general, “I want to learn more about embedded programming, so I need a different chip” is NOT a good approach. Start by learning more about the chip that you have...

author: rstofer
author_rank: Super Contributor
timestamp: August 25, 2018, 02:53:36 pm
content: Quote from: cstratton on August 25, 2018, 05:06:25 ammbed is indeed a lot like Arduino in terms of libraries. For my one big LPC1768 project I needed TCP/IP and I didn't want to write it myself. Their lwIP library worked fine. I didn't use any of the other libraries, I just wrote the code in C and called it good. In fact, I had to go this way because the mbed libraries didn't support interrupt driven SPI slave mode and this was an absolute requirement. So, sure, I had to fool around with the NVIC and write a little handler. No big deal!On the LPC1768 chip there are two 16k regions of memory used for USB and such. These aren't generally visible although GCC knows perfectly well how to get there. I needed these two areas for buffers and I didn't see any library code at the time that would allow their use. No problem, C will get you there with a wee bit of help from the linker.Like the Arduino, you can use as much or as little of the library code as you desire. Being able to just pull in an entire TCP/IP stack is fairly powerful. Add a MagJack and you're up and running on the network.Things have changed quite a lot since I put that together in 2011. What is particularly interesting is the STM32F boards being added to the platform. OTOH, I kind of like CubeMX and the autogenerated code and this seems more workable using a local toolchain rather than the web based tools.

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 25, 2018, 03:12:37 pm
content: It seems Mbed scores awfully high on the bullshit bingo. "Cloud services", "IoT" and best of all "transformative device-to-data platform"

author: ogden
author_rank: Super Contributor
timestamp: August 25, 2018, 04:59:10 pm
content: Quote from: Mr. Scram on August 25, 2018, 03:12:37 pmIndeed. Yet it's still best offer for beginner who wants to get his hands dirty with ARM

author: David Hess
author_rank: Super Contributor
timestamp: August 25, 2018, 08:47:46 pm
content: Quote from: anishkgt on August 24, 2018, 04:37:07 pmThere is not much to an Arduino based design so it would tend to be laid out as part of the project instead of installed as a separate module because AVR microcontrollers are available in easy to use packages.With ARM a separate module which contains all of the difficult to mount chips is more appealing.As far as using ARM modules, I would pay very close attention to the development environment and exclude those which require online development; they always seem to lead to trouble.

author: rstofer
author_rank: Super Contributor
timestamp: August 25, 2018, 11:00:36 pm
content: Quote from: Mr. Scram on August 25, 2018, 03:12:37 pmI think all of that started when the mbed.org site was bought out by ARM. I don't recall seeing that crap in the early days.It is not imperative to use the online toolchain but I like it a lot. Several reasons really but among them is the fact that the latest and greatest tools are available. And the libraries are kept current. I like the online IDE and all mbed compatible devices program the same way: You drop the binary onto the USB mass storage device created on your PC. No JTAG, no Serial Programming, no vendor specific process at all. Just drag and drop. In most cases, the IDE will just drop it in the right place, given permission. And I can work on my project from any computer in the world with Internet access and a browser.Nevertheless, I like Eclipse and the GNU toolchain. It's easy enough to bring the entire project (including the libraries) down to the local machine. I also like Rowley CrossWorks. They have an inexpensive 'personal' licensing scheme.The only thing that is truly unique about the mbed approach is the drag and drop binary. Otherwise, it's just another platform, among many. I got along fine with the serial programming of the LPC2106 and LPC2148 although the Rowley CrossConnect JTAG gadget worked a lot better. Particularly useful for debugging. I don't tend to do a lot of in-circuit debugging but having a JTAG dongle is a nice way to do it. I tend to use printf()...

author: Joeri_VH
author_rank: Newbie
timestamp: August 27, 2018, 09:44:08 am
content: You could start by buying one of the ARM (SAMD21) based Arduino's, keeping your current/favourite project.The M0 Pro has an integrated debugger, the others (M0, MKR series) have SWD headers.That way you can get used to the new hardware in the Arduino environment and then evolve to the full Atmel Studio with far better environment and real debugger. To make this easier you can start by importing an Arduino project, so you get exposed to the vastly superior environment and the debugger without having to code everything from the ground up.