Eclipse is an excellent 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 excellent with general C/C+ projects and we’ve been using it without problem along with external makefile and…
As you may know, ST also produces his own debugger/programmer called ST-Link. It supports either JTAG and SWD interfaces. You can purchase an ST-Link USB adapter, but there is a better option and if you are into STM32 microcontroller business you probably already own one of ST32 Discovery boards. Since I have STM32VLDiscovery nearby, this is how we can program another STM32F103RBT6 board using only four wires. In discovery, board locate CN3 jumpers and disconnect them as they connect discovery board to a debugger.
Last time we have covered the topic about flashing STM32 microcontrollers using bootlaoder. This is the most comfortable and cheapest way of loading programs to MCU memory. But this isn’t the only way of doing this. The software can also be downloaded to using JTAG adapter which is used for debugging. This time we are not digging into debugging but staying only with programming. You can download latest J-Link software from Segger Download page.
There have been several requests among users to explain more about loading programs in to flash memory of STM32 microcontrollers. This, of course, is a broad topic but let us focus on how to achieve the result – flash program into MCU. Depending on what arsenal is on your desk you can do in several different ways. Let’s try to go through them practically.
STM32F103R board is a simple and easy development board to learn STM32 microcontroller programming. Its heart is STM32F103RBT6 ARM Cortex-M3 microcontroller with 128K of Flash and 20K of SRAM memory. It can be clocked at the maximum 72MHz frequency and is considered to be a medium-density performance line microcontroller. Other features include USB, CAN, seven timers, 2ADCs, and nine communication interfaces. Development board has several nice features to get started. First of all, it has an RS232 interface for communicating and accessing bootloader. There also is a USB 2.0 full speed interface connector that also can work as the power supply. Next is a JTAG connector to program microcontroller using tools like J-Link adapter. Two push buttons and two programmable LEDs are hardwired to MCU pins alongside all I/Os connectors.
A high-density line of STM32 microcontrollers has quite a bunch of features that can be used in user programs. The more features you add to source the more complicated program becomes and this way it starts to be difficult to keep up with all things. Using an only main loop and interrupts becomes a time-consuming task to manage. If you don’t want to struggle in tuning things up manually, you can use one of much real-time operating systems (RTOS). They are great when you need lots of separate functions to run in parallel so no task would be missed. RTOS scheduler takes care of giving each task a decent time to perform. There are lots of great RTOS systems around. Many of them are free and opensource. It happens so that I love using FreeRTOS which has a quite long history and is flexible enough to fit multiple types of…
STM32F103ZET6 board comes with 3.2 inches graphical LCD which features an ILI9320 controller. Equipped LCD is capable of displaying 252144 colors when driven in 18-bit mode. We are going to run it in 16-bit mode, so we are limiting it to 65K colors. LCD driver is based on existing code found on the internet which was originally developed for STM3210E board. Only minor modifications were needed like assigning right control pins.