PWM for LCD backlight with STM32F4


I needed a PWM power control for my LCD screen connected on the Cortex M4 (STM32F407).  The backlight of the LCD was to bright at 3.3V and a simple solution would be to add a resistor in series with the backlight LEDs.  But such a solution would lock the backlight at the same power forever, thus an obvious solution: you could try to fiddle with a variable resistor (potentiometer).  However a more elegant solution is … Continue reading

Hardware driver for ENC28J60

Based on the hardware abstraction layer for my TCP/IP stack, I wrote a software driver for the ENC28J60 ethernet module.  As said before the module is very cheap but has quite some issues and the software is trying to cover these issues as much as possible.  However there was one I couldn’t solve completely: interrupt on packet reception; that one is completely unreliable even with the workarounds proposed by Microchip.  Thus I decided to stay … Continue reading

IP Stack Hardware Abstraction

The most important component of the TCP/IP stack is the hardware abstraction layer.  Without it, there is simply no way to communicate with the network.  As I’m still unsure about which hardware to use on the long run and being a good software architect, I created a hardware abstraction layer which is pretty simple to understand.  We need to initialize the hardware and to be able send/receive packets, and if somewhat possible keep track of … Continue reading

Common Modules for TCP/IP stack

For the implementation of my version of a TCP/IP stack I need some modules that not always directly related to networking.  These modules will be described here. 1. Pool for packet buffers One of the most important building blocks in the TCP/IP stack is the packet buffer.  All communication (incoming and outgoing) is going through the packet buffer.  The most perfomant way to use a packet buffer is to use static memory, especially when working … Continue reading

IP Stack for STM32F4

EOS 5D Mark III-101-2280

For a couple of my micro controller-based projects I was looking for a good IP platform.  Lots of flavors exist, but none was really standing out.  However one came pretty close: lwIP; but for a micro controller it seemed quite some overkill. Next came also the choice of the ethernet hardware.  After some evaluations 2 options were left over: DP83848 and ENC28J60.  On the overall the DP83848 is doing better than the ENC28J60.  Microchip’s ENC28J60 … Continue reading

STM32F4 GPIO Configuration

EOS 5D Mark III-101-2124

Here I will explain how to configure the general purpose input/output ports (GPIO) of the STM32F4xx micro controllers.  Like most other micro controllers the GPIO pins can have multiple configurations and mappings. In this small tutorial, I’ll show the high level functions provided by the GPIO peripheral provided by CooCox.  In another post I will dig in the deeper, low level details by explaining the registers needed for configuring the GPIO ports on the STM32F4xx … Continue reading

STM32F407 Delay with SysTick

STM32F4 Development Board

An important function in almost all MCU based application is the delay function.  When timing is essential in your application, you can’t live without a good delay function.  From my experience with 8-bit MCU’s, delay functions were always hard to implement if you wanted to get the timing correct.  Most of the time you could get it to work for one specific clock setting; but to get it to work for all clock frequencies it … Continue reading

STM32F407 tutorial with CooCox

STM32F4 Development Board

Buying the development kit was easy, using it, proves to be 10x more difficult.  First of all you’ll need a good integrated development environment (IDE) and as Java architect I’m quite spoiled and I don’t expect anything less for my hobby projects where I use mainly C.  After doing some research I found a couple of very good IDE’s but unfortunately not free to use.  Until I came across CooCox’ CoIDE, reading the testimonials on … Continue reading

STM32F407 Discovery Board + Modules Kit

STM32F4 Development Board

After some years of experience with 8-bit microcontrollers (Motorola, PIC and ARM), I wanted to move on to some more advanced controllers mainly for use in my home automation system and some other hobby projects. I recently received a kit containing a STM32F407 Discovery board with a development board and 15 pluggable modules.  I bought the kit on AliExpress and it was neatly delivered by FedEx last week. Development board with STM32F407 Discovery plugged in:Modules: The … Continue reading