Setting up CoIDE with GNU tools

For some time I’ve been using Codebench ARM GCC tools for developing software for ARM microcontrollers. As IDE I used plain Eclipse which I had to configure by myself. It worked pretty good and there is nothing wrong with this. Anyway sometimes it gets a little annoying to go keep an eye on configurations and manual settings. So I decided to give a try CooCox IDE which claims to be free and open. It seems that already supports all micros I like to use.

coide

Along to this change, I am also moving to different GCC tool collection. Codebench free tools are great, but in other hand, there are some sort limitations. One of them is release times. They are releasing their free tools twice a year, so updates and other improvements cannot reach as fast as you’d expect. Another thing I am concerned – disabled hard float functionality. If you would like to ta take advantage of floating point unit in Cortex-M4, then you get stuck. If you are not using hardware floating point module, then this tool works fine and you can stick with it. Anyway I don’t like limitations, especially with free tools, so I am switching to GCC tools from launchpad.net. It’s been here for a while and seems quite popular among developers. Continue reading

Bit Band operations with ARM Cortex microcontrollers

I got few questions from our readers about bit-band feature in ARM Cortex microcontrollers. This seems to be so obvious but also may lead to come confusion while using bit-banding. So let’s look at this feature a little bit closer.

ARM_Cortex_bitband

Why use bit band

Simply speaking Bit banding method allows to perform atomic bitwise operations to memory areas. Why use bit banding? The simplest answer is because ARM Cortex doesn’t have something like BIT CSET or BIT CLEAR commands like most of 8-microcontrollers do. So this is somewhat a work around solution. Another question may rise – Why not using read-modify-write method? Again this method is not reliable in some cases. For instance f there is an interrupt during this operation it can cause data corruption. Other situation may occur in embedded OS when different tasks may modify same memory location. So we want a method that allows to set or clear individual bits with single instruction. This is where bit band method helps. Continue reading

Setting up Tiva C Launchpad project template with Sourcery Codebench and Eclipse

Tiva C series TM4C123G (MCU:TM4C1233H6PM)Launchpad is updated version of Stellaris Launchpad LM4F120 (MCU: LM4F120H5QR). Practically this is due TI’s choice to change name of product line. Such action led to some confusion especially for software developers. This means that software libraries had to be renamed, software tool adapted and so on. Since this work is most renaming things from one point this is easy task, from another point it may be tricky to check all corners. So if you just in to Texas Instruments ARM Cortex microcontrollers, it is better to start with Tiva C series and forget Stellaris. Otherwise this might get confusing to switch from one to another.

Tiva_C_launcpad_blinky

At the moment TivaWare 1.1 still has some issues due to migration, but most things sould work fine. So lets try to create a project template for Eclipse IDE and Sourcery Codebench Lite GCC compiler tools. First you need to download and install Eclipse with CDT C/C++ tools (Eclipse Indigo includes this). Next you need to install latest Mentor Sourcery Codebench Lite. Also download and extract TivaWare for C series, where all libraries and examples are located. In order to Flash microcontroller download LM Flash Programmer. Other materials and introduction videos are here. So you need everything except CCS. Continue reading

How to calibrate touch screen display on STM32 board

Touch screen displays are common choice in many microcontroller projects. Touch capability won’t take additional space – it sits on top of LCD where you can directly interact with objects you see on screen. In order to get this working touch screen coordinates must match screen coordinates. So could be sure when you touch the point on screen you point where you want.

Touch screen is analog device. It is made of two flexible resistive sheets with gap between. When screen is touched, a connection between sheets is made and thus measurement of voltage drop is taken. Normally resistive touch screen has four wire configuration. And normally there is a specialized IC used to take measurements and send data to MCU for processing. In our case we are dealing with ADS7843 touch screen controller, but in other systems this works pretty same way.

stm32_touch_screen_interface

The fact is that touch screen controller reads screen ADC values and simply passes them via SPI interface. So all you get is raw ADC readings that are not lined up with LCD coordinates. As you know LCD screens can be different resolution, different orientation, so data gathered from resistive touch screen must be scaled down to match all those circumstances. And this is done in different ways. One of the method I tried before was simple mathematical-empirical approach, when you know the ADC readings on screen edges. Then you can calculate what is ADC value per pixel size and thus calculate the coordinates using simple formula: Continue reading

Learn Arm Cortex processor the easy way

Me, like most of you have been using smaller scale microcontrollers like AVR or PIC. These are great chips and you should keep working with them as long as they fit your needs. Eventually you getting to project where your loved chip simply cannot handle the load.

  • You need to run more complex code to do fancy things;
  • You must keep up with more complex interfaces;
  • Meet multimedia challenges;
  • Process more data in a shorter time.

Eventually you realize that you simply need faster and more modern microcontroller to work with. ARM Cortex is a number one choice. Like with all new stuff you may find it a bit frightening to start with new microcontroller. When I first started with ARM Cortex-M3 processor I was looking for some basic and easy to understand guide. I found and highly recommend a wonderful book about ARM Cortex-M3 CPU. Its called [The Definitive Guide to the ARM Cortex-M3, Second Edition]. This is great book written by Joseph Yiu.

Why start with a book, instead of hunting for scattered tutorials on the internet? Especially if you haven’t tried to work ARM microcontroller you may miss lots of features it has comparing to 8-bit micros. ARM Cortex has a pack of many great features that does job not even faster but takes less code space. It may seem that reading and understanding whats in it may be time consuming and boring, but it turned out that it took me to go through in a few hours and understand all aspects.

I highly recommend to get it and read it. It will help to squeeze the most of ARM Cortex-M3 processor in your next project. Don’t hesitate and get it now here:

The Definitive Guide to the ARM Cortex-M3 Second Edition