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.
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
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.
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
STM32103ZET6 prototyping board comes with LCD having touch screen capability. It is a great way to interact with device. Practically speaking Touch screen is a resistive film that can be read as regular potentiometer which value depends on touch point. Depending on voltage drop it is possible to calculate the coordinates. To make things easy normally there are touch screen controllers used that takes most of hard work – they have internal ADC that measure the voltage and sends value to microcontroller using a selected interface (I2C or SPI). In our board there is a popular ADS7843 controller used, which talks to microcontroller using SPI. After playing around I’ve put a messy code that reads touch screen coordinates. It is a glued code from various sources, so it is only to fix some results.
Currently code reads a bunch of values, then averages to get rid of most garbage and then calculates screen matching coordinates. This is a trickiest part to do. You can do this empirically by getting min and max ADC values for each axis and then calculate coordinates using formula: Continue reading
So far we’ve been using old template with CMSIS version 1.30. Since then it was updated several times by adding support of new Cortex processor families, fixing several bugs and adding new features. They also changed folder structure of CMSIS to be more generic. And there is a CMSIS DSP library integrated. With it you can do complex math tasks using only few lines of code. So why not upgrading our software template for Sourcery Codebench G++ toolchain with new CMSIS. Also we are going to get rid of external makefile with ARM GCC Eclipse plug-in. How to install and use this plugin we discussed in previous posts (part1 and part2). Right now we just do this in quick way. And so first of all download latest CMSIS package from arm.com/cmsis. You will have to register in order to access download files. Package with CMSIS, DSP library and documentation weights about 45MB. Since we are working with ST32 microcontrollers you also need to download STM32F10x Standard Peripheral Library from STMicroelectronics. Continue reading
Continue of part 1.
First of all lets select proper processor type. As we are using Cortex-M3 processor then we go to Project->Properties menu (or right click on project name in project explorer and select Properties). First in Tool Settings list is Target Processor. So we select processor cortex-m3:
Be sure to select settings for all configurations so you don’t have to do this twice when selecting Debug or Release. Continue reading