Monthly Archive: September 2014

Precise delay with counter 8

Precise delay with counter

If you work at high speed, as STM32F4 devices do (84MHz or more) then this tutorial is not right for you. But, you are able to descrease system speed to any frequency basicly you want. If you want to use delay with systick down timer, look at my library here. You can use great solution, Systick timer to make an interrups for you. But you can also decrease speed to let’s say 42Mhz, and that systick every 42ticks checks for...

Program STM32F4 with UART 10

Program STM32F4 with UART

STM32F4 devices have great feature. They can be programed with only USB to UART converter. Each device has bootloader inside, which supports UART programming. This is not very great method for Discovery boards, because they have better and faster solution on board, ST-link. But if you are working own board, then this solution can be quite nice. In this tutorial, I will go through step-by-step how to program device with USB->UART converter. I will use FTDI’s home made converter. This...

BMP-180 Pressure sensor 27

Library 37- BMP180 pressure sensor for STM32F4

BMP180 is a digital pressure sensor, with builtin temperature sensor. Its range is between 300 and 1100 hPa (0.3 to 1.1Bar). In relating to the sea level, this is +9000 to -500 meters. Sensor works with I2C communication at 100kHz. If you want sensor from ebay, here is one link. Sensor is quite bad created, because if you want to read pressure, you first need to read current temperature for pressure calculation. To read temperature you have to wait at least...

Square wave 10kHz 27

Library 36- DAC Signal generator for STM32F4

For FFT project purpose, I needed simple, really simple signal generator. I don’t have separate device at home, so I made one with STM32F4. DAC Signal library uses timer for output generation and DMA for transferring data from memory to DAC peripheral. So this library does not use processor for controlling. Everything is behind the scenes. You can use 4 different signal waves: Square Sawtooth Triangle Sinus They are simple, predefined signals. You can adjust signal frequency for specific wave. I...

Library 35- LIS302DL or LIS3DSH accelerometer 62

Library 35- LIS302DL or LIS3DSH accelerometer

Maybe you’ve noticed one chip between four leds on STM32F4-Discovery board. This chip is accelerometer. On market, there are 2 versions of STM32F4-Discovery board. First release had LIS302DL (old board) and new release (current) has LIS3DSH device. LIS3DSH has 5 selectables full scales (2/4/6/8/16G), old LIS302DL has only 2 (2.3/9.2G). I made a simple library which supports both devices. Library automatically recognize connected device, if there is any. You just have to check which is on board, because different devices...

Library 34- STM32F4 as USB HID Device 47

Library 34- STM32F4 as USB HID Device

With USB HID Device library, you can turn STM32F4 to be a keyboard, mouse or gamepad device. It also supports all three settings at the same time. Device is shown to computer as “Keyboard; Mouse; Game controller“. This library allows you to use 2 gamepads at the same time, one keyboard and one mouse. For mouse you can use left, middle and right buttons, X and Y cursor axes and wheel vertical rotation. For gamepads, you can implement 16 buttons...