Blog on embedded programming

The trip to the dark side

Stm32f4 General Purpose Timers Assembly Programming

Hello everyone ! This post introduces a very basic example of stm32f4 timers’ usage. We’re going to drive our four leds on stm32f4discovery with four general purpose timers TIM2..TIM 5. All of them are used as 16 bit. The task is to let timers count their own period and TIM3..TIM5 timers’ periods are multiples of TIM2’s period. To distinguish that periods of blinking are correct I’ve chosen rather long values: 3, 6, 9 and 12 sec.

Plain Gcc Project Workspace for Stm32f4xx

Hello everyone! A couple new thoughts visited me recently. I have no doubt that programming in assembly is extremely useful. Struggling to make the assembly code to work, solving problems gives much experience: makes to read documentation carefully and learn the architecture, trains patience, teaches not to be scared of object dumps. These are fundamental skills. Good fundamental skills are the roots of good higher level skills.

Triggering External Interrupt on Stm32f4discovery

Hello everyone! This post introduces stm32f4xx interrupts and their usage from assembly language. The goal is to react on user-button push (a blue one) using external interrupt. To reach this goal without involving the interrupt we would write a loop “listening” the input level on the pin. That’s a really bad idea because our application should be able to do other useful stuff.

A usual application configures all needed interrupts, peripherals etc. at init stage an then just falls into infinite loop that does nothing - or even it may go to a sleep mode, waking up just to process events and after that go to sleep again.

Clock Control on Stm32f4discovery

Hello everyone! This post is dedicated to learning clock configuration of our stm32f4. By default MC is driven by the internal oscillator (HSI) which generates 16 MHz signal. The Internal oscillator frequency stability isn’t good enough for real world applications. There is a 8 MHz crystal on board of stm32f4discovery. The crystal is needed for another one oscillator called HSE. This oscillator has better than HSI frequency stability characteristics. So we need to know how to change the source of a system clock-signal of the MC.

Assembly Hello World Code for Stm32f4discovery

Hello everyone! First of all: why use assembly language? In my opinion one should remove any kind of intermediary to know something well - remove anything that can be removed and examine the target directly. When programing for PC it’s common not to think what processor is going to execute the code. We don’t think about the amount of bytes that are generated for the execution. I’m talking just about the corresponing level of abstraction - tools should correspond to the task.

The task for this post is:

  • to realize the stm32f4 memory layout
  • to know what’s going on after microcontroller (or MC) is powered up
  • to get familiar with stm32f4 IO port with writing basic blinking program