Bidding adieu to Arduino

Arduino is an amazing platform, it has really lower the technical difficulty of the setup required to compile and upload code a controller. This allows a lot of software engineers, artists and hobbyist in the hardware space and experiment with lights, sensors and motors. This resulted in a boom of amazing projects never heard of. It also served as a teaching tool for physical computing.

Arduino has served me quite well. The first controller I got my hands dirty was ATMEGA32, I got the dev board and used programmer’s notepad supplied with WinAVR, its took me a while to get around the concept of makefile. I would have understood it quicker had I used Linux during that time. Finally did the hello worlds and later on I went on to create robots and stuff, this was done with programming in C and manipulating the register values, this was around 2007 when I think Arduino was in its infancy at that time. I think it was good I used WinAVR before using Arduino. At least I had some clue what was going under the hood when I click the compile and upload button. Naturally I dumped the programmer’s notepad and moved to Arduino IDE due to its simplicity and the plethora of the libraries available for interfacing the various hardware. I consider myself as more of a hardware person, writing drivers is not my strongest suite. Although I can write decent application code.

In hindsight it was not the best decision. I got too used to it. I’ve made a lot I mean a lot of projects on it and I got very familiar with it. I never used UNO board, I always made my custom boards for the projects. The minimum system design is still on the back of my head. I had a brief use of dsPIC32 for a DPS project, used a pickit3 for programming and debugging. but at that time I didn’t realise the power of 32 bit controllers or the debugging tool I had at hand.

Arduino became my comfort zone

It affected my design approach. Instead of asking which controller was best for the project, I asked myself the question will it run UNO or MEGA or any other Arduino supported platform, like teensy or others. This usually resulted in an overkill and not an optimized design, or if was not capable of running on Arduino I’d had to drop the project. There was an industrial project where it fell short of RAM and its was barely working. That is the biggest problem during development, that the project works sometimes. I’m happy when it just doesn’t work, as its easier to figure out the point of failure and make it work. Later on I moved the string to flash memory freeing up the RAM, still it would have been better if I had more RAM at hand.

As the projects became more complex, Arduino didn’t have enough juice on software and hardware. It also fell short in battery-powered applications. And most of all it fell short on the development tools i.e. Debugging tools. I used sublime text with stino plugin to develop code for Arduino, that was much better than using the stock Arduino IDE. I envision Arduino would have two IDEs, the current one and one for advance users with a lot of other features, who knows? I will turn to Arduino for quick tests and use it slave device of sorts.

Arduino is great for rapid prototyping and making proof of concepts, it’s a development board, and people coming from other fields fail to understand this somehow, it’s a long way between the Arduino bread board prototype to a finished product, it’s difficult to convey why finished PCB design cost higher and takes longer to develop than they expected.

If it fits your requirements no problem using the ATMEGA328P, but using a UNO board or nano with a shield or a base board in a product it’s not a good idea. If that is the case just sell the base board or shields as these products are targeted at makers and DIYers.

Going where?

Going to ARM. It is safe to say ARM controllers have acquired a huge chunk of the embedded world. They are quite complex beasts and very powerful compared to 8 bit counter parts who come at similar price points. While reading blog posts on jeelab, I discovered the blue pill, it was love at first sight. That was the start of the rabbit hole, I’ve been going deeper ever since. I didn’t get a discovery board or a nucleo board, because with a minimum board I can get a clear picture on the minimum requirements for the hardware to get it up and running. The blue pill board has STM32-F103-C8T6 MCU on it. It’s a Cortex M3 and has been around since 2007 and ST guarantees availability for next 10 years starting Jan 2017. Good design stays around for a long time.
Developing for ARM is not really straight forward, there are a lot of development tools available from high cost (around $6000) and free ones. I spent a lot of time evaluating number of options available, from notepad and command line to full-blown IDEs. Here is a nice comparison of six different IDEs. There is also an Arduino framework for the blue pill initially developed by leaf labs and now maintained by Roger Clarke here but I stayed clear of it.

On the hardware ST has impressive line-up of ARM cortex controllers Probably the only vendor with all the cotrex controllers. Most of the chip are pin to pin compatible within the family, so if the software needs more RAM or flash, you just bump up the part number and that is it.

Finally, I settled on eclipse with GNU MCU plugin. I chose this as it allows to code without any limitations and if free of cost, the downside is it will take some time to set up the toolchain and get around some caveates. Once that is done its happy sailing from there. I could have chosen to go with System workbench provided by ST, which is also based on eclipse and you can quickly get up and running. I did not go there as I didn’t want to be tied up with a particular vendor. As NXP also have good line up of kinetis ARM controllers, something to look in to. On the hardware side I purchased a couple of blue pill boards and two ST link clones from eBay. I added SWO support to one ST-link and re-flashed the other to function as BMP.

Back to ST, apart from the debugging tools, ST has three tools that I was very impressed with and use the often.

1. STM MCU finder
2. CubeMX
3. STM studio

1. It does what it says, you can set the peripherals you need or look under a specific price range, and select the best MCU for you project, it also provides links to datasheet and product page. It is quite convenient, when designing the system. It narrows down the selection choices.

2. CubeMX is an excellent tool. It allows the user to select the peripherals that are needed and it generates the start-up initialization and skeleton code and marks where the users should put their code. It also very useful when designing the hardware. Many peripherals can be mapped to alternate pins. So while routing if more convenient place is available, the pins can be switched out. Another advantage is you are can check out the pin out of the higher spec IC in the same family and verify the pin compatibility. Although most of them are pin compatible, but there can be extra power pins on some.

3. STM studio: This one just blew my mind. This tool let the code run in real-time and show the value of code variables in real freaking time directly from device RAM. How freaking cool is that. Not only that you can configure the variables to be plotted on pretty graphs. You could not do this while debugging, you need to stop the processor and then readout the values.

So now I’m working up my way to bring up various peripherals and will make simple projects. Then I’ll implement apps using FreeRTOS on the MCU. I’ll post the progress in follow-up blog posts.

Stay tuned!
Cheers!