Updating STM32 C template with CMSIS V3

So far, we’ve been using an old template with CMSIS version 1.30. Since then, it was updated several times by adding new Cortex processor families, fixing several bugs, and adding new features. They also changed the 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 a few lines of code. So why not upgrading our software template for Sourcery Codebench G++ toolchain with new CMSIS. First of all, download the latest CMSIS package from arm.com/cmsis. You will have to register 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

Using SVN for embedded projects. Part 1.

Writing software is a complex task. In every microcontroller program, you usually try to reuse previously registered libraries, downloaded code, and other data that is being updated. What if you are developing something in the team? How do you keep track of everything? Storing project files in directories eventually gets messy – finally, you lose track of what’s done. For instance, sometimes, you have written an LCD library and used it in several microcontroller projects. But eventually, you found a bug or optimized code. Usually, you would have to copy new library files in every project to keep updated. This is hard when you already have dozens of projects. There is one way to stay organized by using version control software. In this case, we will talk about SVN. Subversion (SVN) is an open-source system that allows controlling files and folders, keep track of changes made during the time. Simply speaking, SVN is a virtual file system that keeps track of every change in files, and directories. It’s a clever way of storing project files whether you are working alone or in a team. Using this system-wise, you will always have things organized and never lose the version of your…

Continue reading

AVR DDS3 boards have arrived

Finally, some updates on the AVR DDS3 signal generator. The circuit is practically done, and PCBs are made. I decided to go with two microcontrollers on board to make it more functional. One microcontroller, Atmega328P, is gonna be dedicated to user interface and signal generator control. The second Atmega88 is gonna be used for signal generators only. This will give un-interruptable signal output while changing parameters or simply doing signal sweeps.

Continue reading

Downloading binaries using STM32 ST-Link Utility

As you may know, ST also produces its own debugger/programmer called ST-Link. It supports JTAG and SWD interfaces. You can purchase an ST-Link USB adapter, but there is a better option if you are into STM32 microcontrollers and probably own one of the ST32 Discovery boards. Since I have STM32VLDiscovery nearby, this is how to program another STM32F103RBT6 board using only four wires. On the discovery board, locate CN3 jumpers and disconnect them as they connect the discovery board to a debugger.

Continue reading

Flashing STM32 using J-Flash ARM

Last time, we covered the topic of flashing STM32 microcontrollers using the bootloader, which is the most comfortable and cheapest way of loading programs into MCU memory. But this isn’t the only way of doing this. The firmware can also be downloaded using the JTAG adapter, which is also used for debugging. This time we are not digging into debugging but staying only with programming. J-Link software You can download the latest J-Link software from the Segger Download page. You will be asked for an adapter serial number which can be found on the backside of the J-Link adapter.

Continue reading

Microcontroller based apps for android mobile phones

Smartphone devices are as valuable as there are some useful apps there. So I started wondering if there are electronics/microcontroller-related apps that could be useful in daily work. Let’s see what we can find in an in-app store. First of all, we are interested in free apps. Search on AVR microcontrollers gave me coupe results: AVR Fuse Calculator and Using Atmega128 apps. Let’s see what they are capable of.

Continue reading

Interrupt driven AVR USART communication

avr usart

Simple USART routines are not always practical because waiting transmitting buffer to be ready in a simple loop occupies processor resources. If we do not know when data will be received, we are just wasting resources inside the waiting loop. Another issue arises when multiple data bytes have to be sent/received. In this case, we have to write complex code to deal with the data flow. Since the microcontroller’s specialty is interrupting, it is better to use them to handle communications, improving overall performance and energy saving. Instead of continuously checking if there new data received in the UDR register or checking if send buffer is free, lets us write a more effective USAR communication code with a guardian, which would wake the MCU if it has received a byte via USART. On the other hand, Interrupt mode allows performing other tasks at total capacity while waiting for USART interrupt. Let us implement interrupt driven AVR USART communication example.

Continue reading

Project demo on STM32F103RBT6 using GCC

STM32F103R board is a simple and easy development board to learn STM32 microcontroller programming. Its heart is an STM32F103RBT6 ARM Cortex-M3 microcontroller with 128K of Flash and 20K of SRAM memory. It can be clocked at the maximum 72MHz frequency and considered a medium-density performance line microcontroller. Other features include USB, CAN, seven timers, 2ADCs, and nine communication interfaces. The Development board has several excellent features to get started. First of all, it has an RS232 interface for communicating and accessing the 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 a J-Link adapter. Two pushbuttons and two programmable LEDs are hardwired to MCU pins alongside all I/Os connectors.

Continue reading

Harvesting energy with home made solar thermal collector

The nearest star from Earth is Sun. And it emits a massive amount of energy, which is free. No surprise, many people try to get most of it at a minimal cost. Photovoltaic solar panels still have low efficiency and yet are quite expensive. Every day we hear how their effectiveness is increased by introducing new technologies. Anyway, solar panels require direct Sun, which in some regions doesn’t appear very often. So how can we get this energy with almost no initial cost? The easiest way to do so is to build a solar thermal collector. You can find lots of high efficient commercial collectors. They look great and, at some level, works in the wintertime when Sun shines. I decided to go simpler. I need hot water only in spring, summer, and fall. In the wintertime, I burn wood to heat the house and so water. I usually boiled water using an electric boiler in the summertime, which generates excellent bills at the end of the month. No more… So I started this project, which is still in the testing phase. But seems to work fine. Let’s go through the build process to make a simple solar collector using…

Continue reading