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

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

STM32F407 Delay with SysTick

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

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