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: (more…)
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. (more…)
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. (more…)
Eclipse is a great multiplatform graphical interface practically for any language. If you choose to use it – you won’t loose. We’ve been using it when writing software for ARM microcontrollers. As compiler Mentor Graphics Sourcery Codebench Lite works just fine. If you have both – Eclipse and Sourcery tools installed we can move on.
So far in our earlier project we’ve been using an external makefile project setup. This means that we had to write/edit makefile in order to compile and link project files. This is hand job and requires some knowledge and time. You cannot run away from them if you are using free tools, but there should be some way out and automate at least some parts of this work. Eclipse Indigo comes with CDT C/C++ development tools. It works great with general C/C+ projects and we’ve been using it without problem along with external makefile and project settings. But there is a better way of developing project for ARM platforms. It’s GNU ARM Eclipse Plug-in. It supports most of GNU toolchains including Sourcery Codebench Lite, Yagarto, GNUARM, WinARM and other. So lets set up Eclipse to use this plugin and see how it works. (more…)