Design Win

Embedded firmware for STPM3x data reading and signal THD calculation

ソフトウェア入手 データブリーフのダウンロード



STSW-STPM006 firmware for the STPM32F407 samples STPM3x ADC data synchronously to the device sampling clock and calculates RMS (both wideband and fundamental) and THD of the voltage and current signals.

The firmware has been developed for the STM32F4DISCOVERY board and can be used with any EVALSTPM3x board.

The SPI reading through DMA is synchronized with the ADC sampling rate by an MCU pin connected to the STPM3x CLKOUT pin to trigger an interrupt.

A timer is configured to calculate RMS and THD from the data buffers at the desired rate, not to overload the MCU if a real-time calculation of these parameters is not required.

The firmware is intended as a basic metrology example and integrates the already existing firmware for STPM3x devices.

  • 特徴

    • Fast SPI sampling of the STPM3x current and voltage wideband and fundamental ADC samples
    • Synchronization with the STPM3x ADC sampling clock
    • RMS and THD calculation of voltage and current signal
    • Firmware based on the STM32Cube_FW_F4_V1.16.0 libraries