Moving from an arduino to ARM microcontroller, seeking ...

29 Apr.,2024

 

Moving from an arduino to ARM microcontroller, seeking ...

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.

This 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++.

Quote

Contact us to discuss your requirements of ARM Board for Industrial Equipment. Our experienced sales team can help you identify the options that best suit your needs.


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.


Yes, 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.

Quote


Does the professional models like the STM32 have libraries like the Arduino do ?


Yes, 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.

This 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++.Yes, 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.Yes, 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.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.

Differences between AVR & ARM - Microcontrollers

Macnerd:
I'm an electronics newbie.

I'm totally confused. Using Google I've tried to find out the differences between AVR architecture & ARM architecture. Google hasn't been much help. I know that I can get 32-bit AVR or 32-bit ARM.

At the base level, an 8-bit AVR, a 32-bit AVR, and a 32-bit ARM are just chips that support a particular instruction set. An instruction set is just ways to interpret the 0's and 1's in the program memory. Think of it like human languages with no translators involved. If you go to France, you must speak French to communicate effectively with people, if you go to Russia you must speak Russian. This is an analogy, just to say that at the core level, the cpus are very different.

If you are looking for more details, kindly visit ARM Board for industrial equipment.

However, most people do not interact with the machine at the core binary level, they use a compiler (GCC in this case) to convert code to the binary form used by the chips. GCC supports many different targets, you use an ARM GCC to compile code for ARM boxes, AVR 8-bit GCC for AVR 8-bit microprocessors, etc. Above the compiler is the IDE (integrated development environment) that most people use to control the compiler. Depending on the capabilities of the chip, you run a Linux environment instead of the Arduino environment.

When people talk about programming an Arduino, they could mean programming a board built by the Arduino company (Uno, Mega, etc.) or more commonly they mean using the Arduino libraries, IDE, etc. for a particular platform. The most common Arduino compatible platform is the 8-bit AVR processor using ATmega or ATtiny chips.

There are Arm chips that run the Arduino environment, including the Due by the Arduino company, the Teensy 3.0 and 3.1 by PJRC: http://www.pjrc.com/teensy/index.html, and the DigiX by Digistump: http://digistump.com/wiki/digix. I have the Teensy 3.0, and it runs most Arduino programs as it, due to the tireless efforts of its creator Paul Stoffregen. I also bought the DigiX during its kickstarter campaign, but so far I haven't powered it up. The Teensy 3.0 is my main platform for coding these days. As far as I know, nobody has come out with the 32-bit AVR in an Arduino platform.

If you need more computing power/memory/etc. you can go up to the Arm based Linux systems, such as the Rasberry Pi, Beagle Bone Black, pcDunio. There you tend to be further away from devices, but you often times have a bigger picture on the environment. You can combine the two, using a Linux computer for the brains, and network connectivity, and one or more boards running chips with the Arduino environment to do real time control. There are some that are combined into a single board, and others that you buy as separate units, and then interconnect them.

Macnerd:
I want to get an Arduino but there are so many different ones that it's hard for me to choose which one. I went to the Atmel website & looked around & it didn't help answer my questions. Does Arduino use only AVR? Does Arduino have any 32-bit Atmel micro-controllers? Is ARM used in the likes of Raspberry Pi & Beaglebone?

I recommend getting an Arduino Uno to people starting out. The Uno is the default platform, and most things will run on the Uno. There is a whole cottage industry of producing shields that sit on top of the Uno to provide extra functionality. If you buy an official Arduino processor, it helps fund this site. I would recommend for starting out, get an Uno and a starter kit that has a breadboard, wires, some LEDs, some simple sensors, etc. Here is one starter kit that is made by Terry King who posts in these forums: http://yourduino.com/sunshop2/index.php?l=product_detail&p=244.

Are you interested in learning more about Rockchip SOM? Contact us today to secure an expert consultation!