Individální projekty MPOA

Mikroprocesory s architekturou ARM

Uživatelské nástroje

Nástroje pro tento web


gpoa2019:tilt-sensing

Toto je starší verze dokumentu!


Tilt sensing with a 3-axis accelerometer

Author: Jiri Krivak

Assignment

Calculate the roll and pitch values from a 3-axis accelerometer. Use the development board STM32F4DISCOVERY with LIS302DL / LIS3DSH devices. Consider any accelerometer position relative to the base, i.e. implement the compensation by de-rotation of input data vector as described in DT0076.


Introdunction

STM32F4DISCOVERY

For the project, we selected Development Board from STMicroelectronics STM32F4 - Discovery

KEY FEATURES

  • STM32F407VGT6 microcontroller featuring 32-bit ARM®Cortex®-M4 with FPU core, 1-Mbyte Flash memory, 192-Kbyte RAM in an LQFP100 package
  • On-board ST-LINK/V2 on STM32F4DISCOVERY
  • USB ST-LINK with re-enumeration capability and three different interfaces: Debug port
  • Board power supply: through USB bus or from an external 5 V supply voltage
  • External application power supply: 3 V and 5 V
  • LIS302DL or LIS3DSH ST MEMS 3-axis accelerometer
  • MP45DT02 ST-MEMS audio sensor omnidirectional digital microphone
  • CS43L22 audio DAC with integrated class D speaker driver
  • USB OTG FS with micro-AB connector
  • Comprehensive free software including a variety of examples, part of STM32CubeF4 package or STSW-STM32068 to use legacy standard libraries.

Implementation

The application was created by using HAL Drivers, STM32F4-Discovery (to map PINs for Discovery), Driver for accelerometer from STMicroelectronics. Next, we use a Middleware library from STMicroelectronics to create Virtual Com Port. We also used ARM GCC Libraries: stdio.h, stdlib.h, math.h The app was designed for Em::Bitz and its integrated ARM GCC Compiler. Because we use function Printf with floats we need to give the GCC compiler flag that tells it that floats are used for string formatting we also use mathematical library math.h, so we need to give the linker flag to include mathematical libraries. GCC Compiler Flag: -u _printf_float Linker Flag: -lm

USB Virtual Com Port and communication

To create Virtual Com Port we used middleware libraries from STMicroelectronics. For easier communication, we remapped the Printf function so that when it is called we send data over the USB VCP. Remaping of Printf in ARM GCC is done by modificiation of _write function.

int _write(int fd, char * str, int len)
{
    for (int i = 0; i < len; i++)
    {
 
        VCP_write(&str[i],1);
 
    }
    return len;
}

We used Legacy Middleware library for USB so it is necessarz to instal VCP Driver from STMicroelectronics.

Vícejádrové zpracování dat

Prahování

Detekce hran

Filtr Sobel

Source Code

Summary

References

gpoa2019/tilt-sensing.1556732560.txt.gz · Poslední úprava: 2019/05/01 19:42 autor: Jiří Křivák